0
0
Blockchain / Solidityprogramming~10 mins

Ethereum Virtual Machine (EVM) in Blockchain / Solidity - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to declare a simple EVM bytecode sequence that stops execution.

Blockchain / Solidity
bytecode = [[1]]
Drag options to blanks, or click blank then click option'
A0x56
B0x60
C0xF3
D0x00
Attempts:
3 left
💡 Hint
Common Mistakes
Using PUSH1 (0x60) instead of STOP.
Using JUMP (0x56) which jumps to a location.
Using RETURN (0xF3) which returns data.
2fill in blank
medium

Complete the code to push the value 0x05 onto the EVM stack.

Blockchain / Solidity
bytecode = [[1], 0x05]
Drag options to blanks, or click blank then click option'
A0x60
B0x01
C0x50
D0x56
Attempts:
3 left
💡 Hint
Common Mistakes
Using JUMP (0x56) instead of PUSH1.
Using POP (0x50) which removes from stack.
Using ADD (0x01) which adds top stack items.
3fill in blank
hard

Fix the error in the code to correctly add two numbers on the EVM stack.

Blockchain / Solidity
bytecode = [0x60, 0x03, 0x60, 0x04, [1]]
Drag options to blanks, or click blank then click option'
A0x50
B0x01
C0x02
D0x56
Attempts:
3 left
💡 Hint
Common Mistakes
Using JUMP (0x56) instead of ADD.
Using POP (0x50) which removes stack items.
Using MUL (0x02) which multiplies instead of adds.
4fill in blank
hard

Fill both blanks to create bytecode that pushes 0x02 and 0x03, then multiplies them.

Blockchain / Solidity
bytecode = [[1], 0x02, [2], 0x03, 0x02]
Drag options to blanks, or click blank then click option'
A0x60
B0x01
D0x03
Attempts:
3 left
💡 Hint
Common Mistakes
Using ADD (0x01) or MUL (0x02) instead of PUSH1 for pushing values.
Mixing up opcodes for pushing and arithmetic.
5fill in blank
hard

Fill all three blanks to push 0x04 and 0x05, add them, then stop execution.

Blockchain / Solidity
bytecode = [[1], 0x04, [2], 0x05, 0x01, [3]]
Drag options to blanks, or click blank then click option'
A0x60
B0x01
C0x00
D0x50
Attempts:
3 left
💡 Hint
Common Mistakes
Using POP (0x50) instead of STOP.
Forgetting to push both values.
Using wrong opcode for addition or stop.