EVM Puzzle full solution

Simon Busch
10 min readNov 18, 2022
https://unsplash.com/es/@karlahrnndz

As you dive into Solidity, it’s quite important to understand what opcodes are and how to use them. I strongly recommend checking this link :

https://www.evm.codes/?fork=grayGlacier

What are the EVM puzzles?

This is a set of 10 puzzles created by Franco Victorio (https://github.com/fvictorio) to get us more comfortable with opcodes. You can find it in the below link. Follow the instruction to get started: https://github.com/fvictorio/evm-puzzles

What are opcodes?

You can understand “opcode” as low-level human-readable instructions to program. Let’s take a look at the following contract:

// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
contract Sum { uint256 a = 5; uint256 b = 10; bool isItTrue = true; function addNumbers() public view returns (uint256) { return a+b; }}

Here would be the resulting opcode:

000 PUSH1 80002 PUSH1 40004 MSTORE005 PUSH1 05

--

--

Simon Busch
Simon Busch

Written by Simon Busch

Full Stack JS/TS @code4rena building the future of smart contract auditing. Solidity/blockchain security learner 🚀