EVM Puzzles 4 Walk-Through

EVM Puzzle 4 combines a number of opcodes that we have already been introduced to and one new one, XOR.

The first two codes are CALLVALUE and CODESIZE.
CALLVALUE is equal to the amount of Wei we use to make the call.
CODESIZE is equal to the byte size of the code.

XOR

The description of XOR tells us that it takes 2 binary values, a and b and pushes (a ^ b) to the top of the stack.

CALLVALUE

Running the code with 6 Wei, CALLVALUE pushes 6 to the top of the stack.
Next is CODESIZE.

CODESIZE

CODESIZE pushes c to the top of the stack.
Next on to XOR.

XOR returns

XOR returns a to the top of the stack.
Next onto JUMP, which should JUMP to our JUMPDEST that is at [0a].

JUMPDEST reached

Looks like we’ve solved this one, JUMPing to our DEST.
Head back to your terminal to submit our CALLVALUE.

Solved

Enter the value to send: 6… PUZZLE SOLVED! Good job and see you in the next one.

DAVE

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top