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.

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.

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

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

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

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

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