EVM Puzzles is a project developed by Franco Victorio (@fvictorio_nan) that is a perfect fit if you are in the process of learning how the Ethereum EVM works, and you want to apply some of the knowledge you have just acquired.
Let’s see what’s this project is all about:
A collection of EVM puzzles. Each puzzle consists on sending a successful transaction to a contract. The bytecode of the contract is provided, and you need to fill the transaction data that won’t revert the execution.
If you are not familiar with Ethereum EVM I would suggest you to start learning more by giving a try to “The EVM Handbook” it will not be an easy and short read, but it contains tons of videos and articles about EVM, and it’s really well-made.
How to play
git clone https://github.com/fvictorio/evm-puzzles.git
cd evm-puzzles
npm install
npx hardhat play
The “puzzle” to solve for each challenge is to understand which is the correct value, calldata or both that you have to send to the contract to not revert.
All Opcodes are executed one by one, and they will interact with the stack, memory or storage.
Useful resources to know
While playing, you will probably need some useful tools that would help you visualize and debug those op codes. Here’s the one I’m using:
If you are new to the EVM, most likely you would need to first have a prime about it. I’m suggesting you to at least finish everything I’ll list down here
- The EVM Handbook
- Solidity EVM Dialect (but also Yul in general)
- Data Representation in Solidity
Solutions to each puzzle
As promised, I will update this blog post every time I will publish a new solution of the puzzle. In every blog post, I’ll explain each new opcode we are going to use and a step-by-step guide to solve the puzzle