Track byte positions and stack changes before reasoning about state.
LET’S PICTURE IT
A good calculation worksheet records each intermediate step instead of only the final answer.
SEE IT FOR YOURSELF
Watch a stack machine execute a tiny programStep 1 / 4
The program bytes are PUSH1 02, PUSH1 03, ADD, STOP. The program counter begins at byte zero.
The program bytes are PUSH1 02, PUSH1 03, ADD, STOP. The program counter begins at byte zero.PUSH1 reads its next byte as an immediate value and places two on the stack. The next instruction begins at byte two.The next PUSH1 places three above two. Stack order matters for operations that are not commutative.ADD consumes the top two values and pushes five. The next instruction is STOP at byte five; no storage write is implied by ADD.
Animated local teaching model. No wallet, RPC or live blockchain data. Some labels and hashes are abbreviated for readability.
Decode the byte sequence
The toy code 600260030100 contains PUSH1 2, PUSH1 3, ADD and STOP. Immediate bytes belong to their PUSH instructions.
Write the stack after each step
Starting empty, the stack becomes [2], then [2,3], then [5]. ADD consumes both input values and leaves one result.
Separate an internal result from output
STOP finishes successfully but does not return the stack contents as output. A return operation would need a selected memory range.
State the model’s limits
This program does not write storage, emit a log or transfer value. A correct trace does not invent those effects merely because a number was calculated.
Trace the idea
bytecode: 0x600260030100
PC 0 PUSH1 2 → [2]
PC 2 PUSH1 3 → [2,3]
PC 4 ADD → [5]
PC 5 STOP → success, empty output
Stack examples list the bottom first and the top last. These small traces omit gas and surrounding dispatch unless stated.
QUICK CHECK · NO PRESSURE
Does STOP automatically return the remaining stack value 5?
A returned payload is selected from memory with RETURN.