Conceptual Guide - For API reference and method documentation, see State API.
What is Ethereum State?
Ethereum maintains a single, canonical world state - a mapping from 20-byte addresses to account data. This state changes with every transaction in every block.Two Types of State
Ethereum distinguishes between account state (global) and storage state (per-contract):- Account State: Maps addresses to account objects (balance, nonce, storageRoot, codeHash)
- Storage State: Maps 256-bit slots to 256-bit values within each contract
{address, slot} uniquely identifies any storage location.
Account State
Two account types exist in Ethereum:- Externally Owned Accounts (EOA)
- Contract Accounts
Storage State
Each contract account has its own storage trie mapping 256-bit slot numbers to 256-bit values:- TypeScript
Solidity Storage Layout
Solidity compiles variables to storage slots following specific rules:Merkle Patricia Trie Structure
Ethereum stores state in a Merkle Patricia Trie - a cryptographic data structure combining:- Merkle Tree: Any change to data changes the root hash
- Patricia Trie: Space-efficient prefix tree for key-value lookups
How It Works
- The state root proves the entire account state
- Each account’s storageRoot proves that contract’s storage
State Root
The state root is a single 32-byte hash proving the entire world state:- TypeScript
Storage Key Operations
Tevm provides utilities for working with storage keys:- TypeScript
State Transitions
Every transaction modifies state. The EVM applies state transitions:- TypeScript
Contract Storage Changes
Storage changes also trigger state root updates:Merkle Proof Verification
Merkle proofs allow proving account or storage data without the full state:- TypeScript
Common Use Cases
Light Client Verification
Light clients verify state without downloading full blockchain:Storage Proof for Token Balances
Prove token balance without trusting the RPC provider:Optimistic Rollup Fraud Proofs
Rollups use state proofs for fraud detection:Contract Storage Analysis
Analyze storage layout and usage:Resources
- Ethereum Yellow Paper - Formal state specification (Section 4.1, Appendix D)
- ethereum.org State Docs - Account and state overview
- Patricia Merkle Trie Spec - Trie structure details
- @ethereumjs/trie - Production trie implementation
- evm.codes SLOAD/SSTORE - Storage access opcodes
- EIP-1186 - eth_getProof RPC method
- Solidity Storage Layout - Storage slot computation rules
Next Steps
- Overview - Type definition and API reference
- Storage Keys - Creating storage keys
- Merkle Trees - Trie operations and verification
- Usage Patterns - Real-world examples

