These are my (sseefried
's) solutions to the Ethernaut CTF. However, I forked this repository from cmichel
's
Ethernaut solutions repo.
I did this because I wanted to borrow his hardhat
test infrastructure, which is a much faster way to interact with smart contracts than calling out to a real testnet with its inconsisent and lengthy block times.
It might be hard to believe, but I am one of those people who is capable of not looking at the answers "at the back of the book", even when conveniently within reach. In order to fully benefit from the learning experience it's best to do it this way. "You're only cheating yourself" is the principle of this approach. I removed all of cmichel
's solutions from my fork of the repo in commit 313c6964352de8e201ff0e3ed96f8d848ffc85ca.
Also, more levels were added to Ethernaut since cmichel
solved them, hopefully proving that I'm capable of solving these challenges without the assistance of others.
npm i
You need to configure environment variables:
cp .env.template .env
# fill out
Pick a mnemonic and the resulting accounts will be used in the challenges.
This repo uses hardhat to run the CTF challenges.
Challenges are implemented as hardhat tests in /test
.
The tests run on a local hardnet network but it needs to be forked from Rinkeby because it interacts with the challenge factory and submission contract. To fork the Rinkeby testnet, you need an archive URL like the free ones from Alchemy.
Optionally set the block number in the hardhat.config.ts
hardhat network configuration to the rinkeby head block number such that the challenge contract is deployed.
# fork rinkeby but run locally
npx hardhat test test/0-hello.ts