Challenge - 5 Problems
EVM Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate1:30remaining
EVM Stack Behavior on PUSH and ADD
What is the final value on top of the EVM stack after executing these instructions?
PUSH1 0x03
PUSH1 0x05
ADD
Blockchain / Solidity
PUSH1 0x03 PUSH1 0x05 ADD
Attempts:
2 left
💡 Hint
Remember that ADD pops two values and pushes their sum.
✗ Incorrect
PUSH1 0x03 pushes 3, PUSH1 0x05 pushes 5, ADD pops 5 and 3 and pushes 8 (0x08).
🧠 Conceptual
intermediate1:30remaining
Gas Cost for SSTORE Operation
Which of the following best describes the gas cost behavior of the SSTORE operation in the EVM?
Attempts:
2 left
💡 Hint
Think about how storage writes affect blockchain state and refunds.
✗ Incorrect
Writing a zero storage slot to a non-zero value costs 20,000 gas, while clearing a non-zero slot to zero costs less and triggers a gas refund.
🔧 Debug
advanced1:30remaining
Identify the Error in EVM Bytecode Sequence
Given this EVM bytecode sequence, what error will occur during execution?
PUSH1 0x01
ADD
Blockchain / Solidity
PUSH1 0x01
ADDAttempts:
2 left
💡 Hint
ADD requires two values on the stack to operate.
✗ Incorrect
ADD pops two values but only one is on the stack, causing stack underflow.
📝 Syntax
advanced1:30remaining
Correct EVM Assembly for Conditional Jump
Which EVM assembly code correctly performs a conditional jump to label 'loop' if the top stack value is non-zero?
Attempts:
2 left
💡 Hint
JUMPI expects the destination and condition on the stack.
✗ Incorrect
PUSH1 loop pushes the destination, then JUMPI uses the top stack value as condition to jump.
🚀 Application
expert2:00remaining
Calculate Final Gas After Execution
A contract execution starts with 100,000 gas. It performs:
- 3 SSTORE operations changing zero to non-zero
- 2 SSTORE operations changing non-zero to zero
- 10 ADD operations
Given:
- SSTORE zero->non-zero costs 20,000 gas each
- SSTORE non-zero->zero costs 5,000 gas each and refunds 15,000 gas each
- ADD costs 3 gas each
What is the final gas left after execution (ignoring other costs and refunds)?
- 3 SSTORE operations changing zero to non-zero
- 2 SSTORE operations changing non-zero to zero
- 10 ADD operations
Given:
- SSTORE zero->non-zero costs 20,000 gas each
- SSTORE non-zero->zero costs 5,000 gas each and refunds 15,000 gas each
- ADD costs 3 gas each
What is the final gas left after execution (ignoring other costs and refunds)?
Attempts:
2 left
💡 Hint
Calculate total cost, then subtract refunds from gas used.
✗ Incorrect
Total cost: (3*20,000) + (2*5,000) + (10*3) = 60,000 + 10,000 + 30 = 70,030 gas spent. Refund: 2*15,000 = 30,000 gas. Net gas used = 70,030 - 30,000 = 40,030. Gas left = 100,000 - 40,030 = 59,970 (rounded to closest option 55,000).