EVM Puzzle 1 - Warm Up!
Shiran Sukumar
Engineering Manager @ Rula | EQ>IQ | Ex Amazon, Nike, & hyper-growth startups
Introduction
EVM puzzles provide a hands-on way to grasp the nuances of how the Ethereum Virtual Machine operates. This series will explore these puzzles, offering in-depth analysis and solutions.
Puzzle #1
00 34 CALLVALUE
01 56 JUMP
02 FD REVERT
03 FD REVERT
04 FD REVERT
05 FD REVERT
06 FD REVERT
07 FD REVERT
08 5B JUMPDEST
09 00 STOP
The goal is to craft a transaction that executes this contract successfully (without encountering a revert).
Understanding EVM Puzzles
Before diving in, let's outline a general approach to solving EVM puzzles:
Key Concepts
Reminder of relevant EVM concepts:
Solution
Let's analyze the bytecode: https://www.evm.codes/
领英推荐
The Catch: For successful execution, you must avoid the REVERT opcodes. The JUMP immediately sends execution to the JUMPDEST. The only way to reach the STOP opcode (and succeed) is to ensure the CALLVALUE is 8.
The Stack:
[8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
Successful Transaction: You must send the jump destination to jumpdest so enter the location 8 solves the puzzle.
Stay tuned for Puzzle #2 in the EVM Puzzle, where the challenges intensify!
Let me know if you'd like to add extra complexity or nuances to future puzzles!
More Tools
I found tons of tools for working with the EVM. I am just going to drop them here and figure out overtime which ones are most useful