EVM (Ethereum Virtual Machine)

Smart Contract Updated Jun 2026

What is the EVM?

The Ethereum Virtual Machine (EVM) is the runtime environment that executes smart contract bytecode on Ethereum. Think of it as a decentralized, global computer — every node in the Ethereum network runs a copy of the EVM, ensuring that smart contracts execute identically everywhere.

The EVM is what makes Ethereum “programmable.” Before Ethereum, blockchains (like Bitcoin) could only process simple transactions. The EVM introduced Turing-complete computation — meaning it can run any program (with the gas limit as the only constraint).

The EVM is not just on Ethereum. It’s been adopted by dozens of L1s (BNB Chain, Avalanche C-Chain, Polygon, Fantom) and all major L2s (Arbitrum, Optimism, Base, Scroll). This ecosystem of EVM-compatible chains is the largest in crypto.

How the EVM Works

The Execution Pipeline

  1. Write smart contract in Solidity (or Vyper)
  2. Compile to EVM bytecode (the low-level machine code the EVM understands)
  3. Deploy by sending a transaction with the bytecode
  4. Execute when someone calls a function — the EVM processes the bytecode instructions
  5. State change — the EVM updates on-chain storage if the execution succeeds
  6. Gas metering — each instruction costs gas, and the total must not exceed the gas limit

EVM Architecture

┌─────────────────────────┐
│      Smart Contract      │
│  (Solidity → Bytecode)   │
├─────────────────────────┤
│      EVM Runtime         │
│  ┌─────────┐ ┌────────┐  │
│  │  Stack  │ │ Memory │  │
│  ├─────────┤ ├────────┤  │
│  │Storage  │ │ Program│  │
│  │(permanent)│ │Counter│  │
│  └─────────┘ └────────┘  │
├─────────────────────────┤
│   Blockchain State       │
│  (balances, nonces, etc) │
└─────────────────────────┘
  • Stack: LIFO stack for computation (max 1,024 items)
  • Memory: Volatile byte array (resets after each call)
  • Storage: Persistent key-value store (persists across transactions)
  • Program Counter: Tracks which bytecode instruction to execute next

Opcodes

The EVM has ~150 opcodes (operations), including:

CategoryOpcodesExamples
ArithmeticADD, MUL, DIV, MODMathematical operations
ComparisonLT, GT, EQ, ISZEROCompare values
MemoryMLOAD, MSTORE, SLOAD, SSTORERead/write memory and storage
EnvironmentCALLER, VALUE, TIMESTAMP, BLOCKHASHAccess blockchain context
Control flowJUMP, JUMPI, STOP, REVERTBranching and halting
CryptographicSHA3, ECRECOVERHash functions, signature verification
Contract interactionCALL, DELEGATECALL, STATICCALLCall other contracts

EVM Gas Costs

Every opcode has a fixed gas cost. This prevents infinite loops (exhausting gas) and incentivizes efficient code:

OperationGas CostNotes
ADD (addition)3Very cheap
MUL (multiplication)5Still cheap
SLOAD (read storage)2,100 (warm) / 2,100+ (cold)Expensive — storage reads are costly
SSTORE (write storage)2,100 (update) / 22,100 (new)Very expensive — writing new storage is costliest
CALL (call another contract)700 base + 2,600 warmCalling contracts is expensive
SHA3 (hash)30 + 6 per wordModerate cost

EVM Equivalence

Types of EVM Compatibility

TypeDefinitionExamples
Type 1 (Full)Bytecode-identical to EthereumScroll
Type 2 (Almost)EVM-equivalent with minor differenceszkSync, Polygon zkEVM
Type 2.5EVM-compatible with gas cost changesSome modified EVMs
Type 3 (Almost)Nearly EVM-compatible, but not quiteEarly zkEVMs
Type 4 (High-level)Solidity-compatible but different VMStarknet (Cairo VM)

Most developers prefer Type 1-2 EVMs because existing Solidity tools (Hardhat, Foundry, Etherscan) work without modification.

The EVM Ecosystem

Chains Running the EVM

ChainTypeTVLNotes
EthereumNative$50B+The original
ArbitrumL2 (Type 2)$15B+Most popular L2
BaseL2 (OP Stack)$8B+Coinbase-backed
OptimismL2 (OP Stack)$5B+OP Superchain
BNB ChainL1 (Type 2)$5B+EVM-compatible since launch
Polygon zkEVML2 (Type 2)$100M+ZK EVM
Avalanche C-ChainL1 (Type 2)$1B+Subnet architecture

Development Tools

ToolPurpose
HardhatDevelopment framework
FoundryFast development (Rust-based)
Ethers.js / ViemJavaScript libraries for interacting with the EVM
OpenZeppelinAudited contract library
SlitherStatic analysis security tool
RemixBrowser-based IDE

Limitations of the EVM

  • 256-bit word size: All values are 256 bits, even when smaller would suffice (wastes gas)
  • No native floating point: All math is integer-based (precision handled in application code)
  • Sequential execution: No parallel processing within a single transaction
  • Storage is expensive: SSTORE costs 20,000+ gas, making on-chain data storage costly
  • Stack depth limit: Max 1,024 items (deeply recursive functions can fail)

Frequently Asked Questions

Q: Is Solana EVM-compatible? A: No. Solana uses its own runtime (SVM) and smart contracts are written in Rust, not Solidity. However, projects like Neon and Eclipse are building EVM-compatible environments on Solana.

Q: Can the EVM be upgraded? A: The EVM evolves through Ethereum Improvement Proposals (EIPs). Major changes include: EIP-1559 (fee market), EIP-4844 (blob transactions), and Shanghai/Cancun upgrades. Changes require network consensus.

Q: What’s the difference between EVM and WASM? A: EVM uses custom bytecode designed for blockchain. WASM (WebAssembly) is a general-purpose runtime used by chains like Polkadot, Cosmos, and NEAR. WASM supports more languages but is newer to the blockchain space.