Ethereum Virtual Machine (EVM)
The EVM is Ethereum's deterministic, stack-based virtual machine that executes smart contract bytecode on every node identically — processing opcodes that manipulate a 1024-depth stack, volatile memory, and persistent storage.
The EVM is a 256-bit stack machine — it processes instructions (opcodes) that push/pop values from a stack. Smart contracts written in Solidity/Vyper compile to EVM bytecode (a sequence of opcodes). Key properties: deterministic (same input = same output on every node), sandboxed (contracts can't access filesystem or network), metered (each opcode costs gas). The EVM has three data locations: stack (1024 items max, free to use), memory (byte-addressable, volatile, costs gas to expand), and storage (key-value store, persistent across transactions, most expensive). Contracts interact via CALL (separate execution context), DELEGATECALL (caller's storage context, enables proxies), and STATICCALL (read-only, no state changes allowed).
Tradeoffs
Strengths
- Deterministic execution ensures all nodes agree on state transitions
- Sandboxed environment prevents contracts from accessing external resources
- Gas metering solves the halting problem and prevents DoS attacks
- Wide ecosystem of EVM-compatible chains maximizes code reuse
Weaknesses
- 256-bit word size is wasteful for most operations (most values are much smaller)
- Stack-based architecture is less efficient than register-based alternatives
- No native support for floating-point, parallel execution, or complex data structures
- Sequential execution limits throughput compared to parallel VMs like Solana's Sealevel
Likely Follow-Up Questions
- How does DELEGATECALL enable the proxy upgrade pattern?
- Explain the reentrancy vulnerability and how to prevent it.
- Why does memory cost increase quadratically in the EVM?
- What is the difference between EVM-equivalent and EVM-compatible?
- How does Solidity's storage layout affect proxy upgrade safety?
- What are precompiled contracts and why do they exist?
Related Concepts
Source: editorial — Synthesized from Ethereum Yellow Paper, Solidity documentation, and EVM opcode reference