In this track: Inside the EVM
advanced · 4 MIN READ

Bytecode versus source code

The EVM executes bytes produced by a compiler, not Solidity text.

LET’S PICTURE IT

A written recipe differs from the machine instructions used by an automated kitchen.

SEE IT FOR YOURSELF
Watch a stack machine execute a tiny programStep 1 / 4
Watch a stack machine execute a tiny programProgram→ PUSH1 0x02PUSH1 0x03ADD · STOPStackEmptyPC = 0A fixed local model; not a complete EVM implementationPUSH1 0x02Push immediate 2Next PC = 2Stack · top first2PUSH1 occupies one opcode byte plus one immediate bytePUSH1 0x03Push immediate 3Next PC = 4Stack · top first32The first value is below the most recently pushed valueADD3 + 2 = 5Next: STOP at PC 5Stack5No automatic SSTOREStack, memory and persistent storage are different locations

The program bytes are PUSH1 02, PUSH1 03, ADD, STOP. The program counter begins at byte zero.

Animated local teaching model. No wallet, RPC or live blockchain data. Some labels and hashes are abbreviated for readability.

Separate source and runtime

Solidity declarations describe program behavior at a higher level. Compilation produces byte sequences interpreted under the target EVM rules.

Distinguish creation code

Deployment input includes creation logic that can return runtime code. The deployed runtime is not generally the complete original deployment input.

Use build metadata

Compiler version, optimization and target settings affect output. Similar source names or comments do not establish a reproducible match to deployed code.

Read traces at the right layer

An opcode trace shows execution details that source maps can help relate to source. Optimized output may not follow source statements one instruction at a time.

Trace the idea

Solidity source → compiler + settings → creation code
creation execution → returned runtime code

Stack examples list the bottom first and the top last. These small traces omit gas and surrounding dispatch unless stated.

QUICK CHECK · NO PRESSURE

What does the EVM directly interpret?

Your progress stays in this browser.
Keep exploring the original referenceethereum.org ↗

Original explanations by EtherTools. Examples are educational and source-linked; this site is independent of the Ethereum Foundation. Our approach.