玩 Ethernaut 闯关游戏,顺便学习Solidity Smart Contract Programing

in #cn5 years ago (edited)

ethernaut.zeppelin.solutions.png

Ethernaut 是个由 Zeppelin 团队开发的闯关游戏, 玩家可透过闯关学习很多写Solidity 和web3.js 的知识。

游戏网址是 : https://ethernaut.zeppelin.solutions

要玩这个游戏,首先要用 metamask 这个 chrome extension, 然后使用 ropsten 这个testnet。
玩家首先要去 ropsten 的 faucet 去领一点免费的 testnet ethereum 才能做transaction。
然后在到 browser 的console 里 输入指令。

不是所有题目都能在console 里解决, 大多数的题目要你用游戏的create instance 来生产一个即时生成的 contract instance, 然后你破解后在submit 那个instance 。 成功后就会有一个勾在题目标题傍边。

有些题目会要求你写smart contract, 你可以用 remix.ethereum.org 或者 solc + truffle , 我是用 remix 的。 用remix 的话 ,直接在 browser + metamask 就可以了。

里头有很题目会考验玩家对Solidity 知多少,例如:

考验的概念:

  1. 玩家是否明白如何用web3.js 做call() 或 sendTransaction()
  2. 玩家是否明白 fallback 的概念。
  3. 玩家是否知道如何call contract function 来夺取contract 的owner 权。
  4. 玩家是否知道用 block hash 来做random seed 是可以被人用contract front run 的
  5. 玩家是否知道 msg.sender 和 tx.origin 的差别。
  6. 玩家是否知道 uint 过龙是会wraparound的 。
  7. 玩家是否明白 delegatecall 跟 context 的概念。
  8. 玩家是否知道如何用selfdestruct
  9. 玩家是否知道 private property 是可以被人看光光的。
  10. 玩家是否知道 如何send ether 到 contract。
  11. 玩家是否会写造成 recursion(递归)的smart contract
  12. 玩家是否知道 contract callee 可以call回 contract caller ,而且因为你是caller 你可以操控你的contract 来达到目的。
  13. 玩家是否知道 private property 是可以被人看光光的。
  14. 玩家是否知道如何知道 contract 在某个执行点会剩下多少gas , 和一些基本的 大container 去小container 的转化。
  15. 玩家是否明白 一个contract 在什么时候它的size是0
  16. 玩家是否明白锁住一个function 还是有其它没被implement 的function 可以达到一样的目的。
  17. 玩家是否明白 delegatecall 跟 context 的概念。
  18. 玩家是否明白 struct 在function 里instantiate 会有盖过storage 的危险
  19. 玩家是否明白 selfdestruct
  20. 玩家是否会用 evm bytecode。
  21. 玩家是否知道 dynamic array 是如何在storage 里收藏的, 玩家是否知道如何在sendtransaction 里制作 array 的argument, 还有结合其它题目的概念。
  22. 玩家是否知道 如何在别的contract call 你的contract 时,让整个程序终止
  23. 玩家是否知道 Contract 不但会被别的contact call , 还会回call 给call 它的contract

有兴趣的朋友可以试试看玩 。。

谢谢阅读。

Sort:  

Congratulations! This post has been upvoted from the communal account, @minnowsupport, by tensaix2j from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, someguy123, neoxian, followbtcnews, and netuoso. The goal is to help Steemit grow by supporting Minnows. Please find us at the Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.

If you would like to delegate to the Minnow Support Project you can do so by clicking on the following links: 50SP, 100SP, 250SP, 500SP, 1000SP, 5000SP.
Be sure to leave at least 50SP undelegated on your account.

帅哥/美女!你好!家中可愛的寵物照想要跟大家分享嗎?或是出去玩拍到一些可愛的動物,別忘了到@dpet分享,可以得到@dpet的獎勵喔!如果不想再收到我的留言,请回复“取消”。

@tensaix2j purchased a 16.94% vote from @promobot on this post.

*If you disagree with the reward or content of this post you can purchase a reversal of this vote by using our curation interface http://promovotes.com

Coin Marketplace

STEEM 0.31
TRX 0.12
JST 0.033
BTC 64485.37
ETH 3156.53
USDT 1.00
SBD 4.05