Ethernaut Solutions

Solutions for the Ethernaut challenges implemented as Hardhat tests

GitHub: ethernaut-hardhat

Each test interacts with an instance of an Ethernaut level and submits the instance to the validator on successful completion. For some levels, there's an attack contract which is deployed by the test. Write‑ups were generated from commented code for each solution ― test or contract: in most cases, only one of them needed commenting ― and are available here:

Level Test Contract
01: Fallback tests/01_Fallback.html
02: Fallout tests/02_Fallout.html
03: Coin Flip tests/03_CoinFlip.html contracts/03_CoinFlipAttack.html
04: Telephone contracts/04_TelephoneAttack.html
05: Token tests/05_Token.html
06: Delegation tests/06_Delegation.html
07: Force contracts/07_ForceAttack.html
08: Vault tests/08_Vault.html
09: King contracts/09_KingAttack.html
10: Re-entrancy contracts/10_ReentranceAttack.html
11: Elevator contracts/11_ElevatorAttack.html
12: Privacy tests/12_Privacy.html
13: Gatekeeper One contracts/13_GatekeeperOneAttack.html
14: Gatekeeper Two contracts/14_GatekeeperTwoAttack.html
15: Naught Coin contracts/15_NaughtCoinAttack.html
16: Preservation contracts/16_PreservationAttack.html
17: Recovery tests/17_Recovery.html
18: MagicNumber contracts/18_MagicNumAttack.html
19: Alien Codex tests/19_AlienCodex.html
20: Denial contracts/20_DenialAttack.html
21: Shop contracts/21_ShopAttack.html
22: Dex tests/22_Dex.html