- Install foundry
forge test -vvvv
Run for a specific file :
forge test -vvvv --match-path ./test/Level01.t.sol
cp .env.example .env
Add wallet information, for better security don't use your main wallet for testing code.
- Add RPC url to
foundry.toml - Add
PRIVATE_KEYto.env - Call possible using :
forge script ./script/Level01.s.sol --broadcast -vvvv --rpc-url goerli
Goerli price have exploded since I've done ethernaut, recommended to use a L2 testnet
forge create --rpc-url goerli --private-key <your_private> src/Level04-Attacker.sol:AttackerLevel04
cast storage <contractAddress> <slotNumber> --rpc-url goerli
All the files to deploy & test the exploit locally
All the files to test exploit on chain
| Levels | locally | on-chain (script) |
|---|---|---|
| 00-HelloEthernaut | ✅ | ✅ |
| 01-Fallback | ✅ | ✅ |
| 02-Fallout | ✅ | ✅ |
| 03-CoinFlip | ✅ | ❌ |
| 04-Telephone | ✅ | ✅ |
| 05-Token | ❌ | ❌ (logic present) |
| 06-Delegation | ❌ | ✅ |
| 07-Force | ✅ | ✅ |
| 08-Vault | ❌ | ✅ |
| 09-King | ✅ | ✅ |
| 10-Reentrancy | ❌ | ✅ |
| 11-Elevator | ✅ | ✅ |
| 12-Privacy | ❌ | ✅ |
| 13-GatekeeperOne | ❌ | ❌ |
| 14-GatekeeperTwo | ❌ | ❌ |
| 15-NaughtCoin | ✅ | ✅ |
| 16-Preservation | ✅ | ✅ |
| 17-Recovery | ❌ | ✅ |
| 18-MagicNumber | ❌ | ✅ |
| 19-AlienCodex | ❌ | ✅ |
| 20-Denial | ✅ | ✅ |
| 21-Shop | ❌ | ❌ |
| 22-Dex | ✅ | ✅ |
| 23-DexTwo | ✅ | ✅ |
| 24-PuzzleWallet | ❌ | ✅ |
| 25-Motorbike | ❌ | ✅ |
| 26-DoubleEntryPoint | ❌ | ❌ |
| 27-GoodSamaritan | ❌ | ✅ |
| 28-GateKeeperThree | ❌ | ❌ |
Note: most of levels are solved. I encountered some difficulties to make them all work locally and on-chain, feel free to drop a PR to solve that 🙏