The ethernaut is a Web3/Solidity based wargame inspired in overthewire.org and in the comic El Eternauta, to be played in the Ethereum Virtual Machine. Each level is a smart contract that needs to be 'hacked'.
The game acts both as a tool for those interested in learning ethereum, and as a way to catalogue historical hacks in levels. Levels can be infinite and the game does not require to be played in any particular order.
Level PR's are welcome!
You can find the current, official version at: ethernaut.zeppelin.solutions
You can find the DEVCON3 version (ctf contest) at: ethernaut-devcon3.zeppelin.solutions
git clone ...
andnpm install
as usual.- Start deterministic testrpc with
npm run rpc
(to stopnpm run killrpc
). - You might want to import one of the private keys in scripts/rpc.sh to your Metamask wallet.
- Set target network ACTIVE_NETWORK in constants.js.
- Deploy contracts with
npm run deploy:contracts
. - Start react client with
npm start
. - To run solidity tests
truffle test
.
- Develop level contract in contracts/levels. Levels must extend contracts/base/Level.sol for basic game compatibility. Levels emit instances whose state can be modified by players, and check such state to determine if the player has completed the level.
- Be nice and add a test xD
- Add an entry to gamedata/gamedata.json for the level. This will be used by the contract deployment script to automatically deploy and upload the contract to Ethernaut.sol.
- Create and edit gamedata/descriptions/levels/xxx.md and xxx_complete.md. One will be shown on the level's page and the other when the level is completed). Note that your entry in gamedata.json must point to these md files.
To deploy the react app use npm run deploy:ui
. Of course, you will need ssh credentials for this.
To deploy the contracts on ropsten, first set the ACTIVE_NETWORK variable in constants.js and then edit gamedata.json. This file keeps a history of all level instances in each level data's deployed_ropsten array. To deploy a new instance, add an "x" entry to the array, like so:
"deployed_ropsten": [
"x",
"0x4b1d5eb6cd2849c7890bcacd63a6855d1c0e79d5",
"0xdf51a9e8ce57e7787e4a27dd19880fd7106b9a5c"
],
Then run npm run deploy:contracts
. This action will effectively deploy a new version of the level data item whose deployed_ropsten array was updated, and will point the ethernaut dapp to use this new deployed contract instance for the level.