Ethereum state is the complete set of account data at a given block: every balance, nonce, contract bytecode and contract storage slot. Clients keep it in a modified Merkle Patricia Trie, a tree keyed by hashes whose single root hash, the stateRoot, is stored in every block header. Changing any value changes the root, so the root commits to the entire state in 32 bytes.
This guide explains the ethereum state trie in detail: what an account holds, how storage is separate from state, how the trie nodes are built, and why this design shapes proofs, node sizes and the roadmap.
Ethereum is a state machine. A transaction takes the world state at block N and produces the state at block N+1. The world state maps a 20-byte address to an account. There are two account types:
Both have the same four fields:
| Field | Meaning |
|---|---|
nonce | For an EOA, the number of transactions sent. For a contract, the number of contracts it created. |
balance | Amount of wei owned by the account. |
storageRoot | Root hash of the account's own storage trie. Empty for EOAs. |
codeHash | Keccak-256 hash of the EVM bytecode. For EOAs it is the hash of empty bytes. |
The bytecode itself is not stored inside the account. Only its hash is, and the code is looked up by that hash from a separate database. Two contracts with identical code therefore share one code entry.
A contract's variables live in its storage: a key-value store of 32-byte slots to 32-byte values. Each contract has its own storage trie, and the account's storageRoot is the root of that trie. The world state trie then contains the account, including that storageRoot.
This gives a two-level structure:
Keys are hashed before they are used in the trie. Hashing spreads keys evenly, which keeps the tree balanced, and stops an attacker from crafting addresses that create a very deep path.
A block header also commits to two more tries built per block: the transactionsRoot and the receiptsRoot. That gives four tries in total: state, storage, transactions and receipts. Only the state and storage tries persist across blocks.
The structure combines three ideas.
There are three node types:
| Node | Content | Purpose |
|---|---|---|
| Branch | 16 child slots (one per nibble) plus an optional value, 17 items | Splits the path where keys diverge |
| Extension | A shared path fragment and one child | Compresses a common prefix |
| Leaf | The remaining path fragment and the value | Ends a key |
Path fragments are stored with hex-prefix encoding, which adds a flag nibble telling whether the node is a leaf or an extension and whether the fragment length is odd or even. Node content is serialised with RLP (recursive length prefix). If a node's encoding is shorter than 32 bytes it is embedded inside its parent instead of being referenced by hash.
Because nodes are immutable and addressed by hash, updating one account creates new nodes only along the path from that leaf to the root. Everything else is shared with the previous state. This structural sharing is why clients can keep recent historical states without copying the whole tree.
The trie lets someone prove a value without the whole state. A proof is the list of nodes along the path from the root to the leaf. A verifier hashes the nodes, checks each hash appears in its parent, and confirms the top matches a trusted stateRoot.
The eth_getProof method (EIP-1186) returns such a proof for an account and for chosen storage slots:
The result contains accountProof, an array of RLP-encoded nodes, and a storageProof for each requested slot. Light clients and bridges use this to check data against a block header they already trust, without running a full node. Not every public RPC provider enables this method, so use your own node or a provider that documents it.
Solidity packs variables into 32-byte slots in declaration order. A uint256 fills one slot, while smaller types can share a slot. Mappings and dynamic arrays store values at keccak256(key . slot), which is why their storage keys look random. The storage trie stores only non-zero slots: writing zero deletes the entry.
State access is expensive by design. Every slot read or write touches the trie, so the EVM charges extra gas the first time a slot is accessed in a transaction (cold access) and less afterwards (warm access, EIP-2929). Writing a new non-zero value costs far more than updating an existing one.
The state keeps growing, and this affects who can run a node:
| Node type | Keeps | Used for |
|---|---|---|
| Full node | Recent state plus all blocks, prunes old states | Verifying and serving the chain |
| Archive node | Every historical state | Historical queries and analytics |
| Light client | Block headers and proofs | Resource-limited devices |
Clients also use a flat key-value layer or snapshot alongside the trie, so reading an account is one lookup rather than a walk down a dozen nodes. The trie is then used mainly to compute and verify the root. Hexary trees need large proofs because every branch node carries 16 hashes.
This is the reason for the Verkle tree proposal on the roadmap. Verkle trees use vector commitments to make proofs far smaller, which would enable stateless clients that verify blocks using witnesses instead of holding all state. Treat this as planned research and engineering work rather than something live on mainnet.
State is the mapping of every address to its account. Storage is the key-value data inside one contract account, held in its own trie and referenced by storageRoot.
Hashing distributes keys uniformly, keeping the trie balanced and its depth predictable. It also stops anyone choosing addresses or slots that would build a deliberately deep path.
Only its hash is. The codeHash field points to the bytecode stored in a separate database keyed by that hash.
The root sits in a block header that the consensus layer has attested to. Given a trusted header, a Merkle proof lets a client verify any account or slot without downloading the state.
Ethereum state is a map from addresses to accounts with nonce, balance, storageRoot and codeHash. It lives in a Merkle Patricia Trie with branch, extension and leaf nodes, hashed with Keccak-256 and encoded with RLP, and every contract owns a separate storage trie. The stateRoot in each header commits to everything, which enables compact proofs through eth_getProof. State growth drives gas pricing, node sizing and the move toward Verkle trees.