Merkle Patricia Trie
Ethereum's key-value structure that combines hashing with efficient lookups.
Basically
Ethereum uses a Merkle Patricia trie to store account data. You can find records quickly and check that the data is correct.
Key Takeaways
- A Merkle Patricia trie combines Merkle tree hash verification, Patricia trie prefix compression, and key-value storage. Identical states always produce the same root hash.
- Ethereum uses three main tries per block header: a state trie for all account data, a storage trie for each smart contract, and a transaction trie per block. Each trie root commits to its entire dataset with a single 32-byte hash.
- Ethereum's state trie only grows and has no built-in way to prune inactive accounts, making full nodes increasingly expensive to run. Verkle trees are planned to replace the MPT and reduce proof sizes by roughly 23x.
What Is a Merkle Patricia Trie?
A Merkle Patricia trie (MPT), sometimes called a modified Merkle Patricia trie, is a cryptographically authenticated key-value data structure. It combines Merkle tree hash verification, Patricia trie prefix compression, and key-value storage.
Ethereum adopted the MPT as its core state storage mechanism to store every account balance, contract state, and transaction record. Any participant can verify claims about that state. Unlike Bitcoin's UTXO model, Ethereum's account model maintains a global state database that changes with every transaction, while the MPT preserves cryptographic integrity.
How It Works
The MPT organises data with four node types. Keys are traversed one nibble (4 bits, or one hex character) at a time, so a 32-byte key becomes 64 nibbles and each nibble selects one of 16 possible branches at each level.
Node Types
The Ethereum Yellow Paper defines four node types. These nodes form the structure of each trie.
Hex-Prefix Encoding
Leaf and extension nodes are both 2-element arrays, so the MPT uses hex-prefix (HP) encoding to distinguish them. The first nibble of the encoded path acts as a flag.
Bit 1 is the termination flag, with 0 for extension and 1 for leaf. Bit 0 is the oddness flag. For even-length paths, a padding nibble follows the flag so the data aligns to byte boundaries.
RLP Serialization
All trie nodes are serialised with Recursive Length Prefix (RLP) encoding before storage, which encodes nested arrays of bytes in binary. Nodes are referenced by keccak256(rlp(node)) when the RLP-encoded output is 32 bytes or longer. Shorter nodes are stored inline within their parent, reducing storage overhead.
Path Construction
Keys are constructed differently depending on which trie they belong to. Each trie uses its own key format.
Ethereum's Trie Architecture
Every Ethereum block header contains three root hashes. Each root hash commits to a complete trie.
State Trie (World State)
The state trie is a single global structure mapping every Ethereum address to its account state. Each account value is an RLP-encoded object with four fields.
The state trie is mutable and updates after every transaction execution. The resulting root hash (stateRoot) in the block header commits to the entire world state at that point in time.
Storage Trie
Each smart contract has its own storage trie, referenced by the storageRoot field in the account object. It maps 256-bit storage slot keys to 256-bit values representing the contract's persistent variables. The nested structure means the state trie root indirectly commits to every variable in every contract on the network.
Transaction and Receipts Tries
Each block also includes a transaction trie, which maps transaction indices to transaction data, and a receipts trie, which maps indices to execution results, including status codes and event logs. Both are immutable once the block is finalised. Their root hashes (transactionsRoot and receiptsRoot) appear in the block header.
Proof Verification
Efficient proof generation is one of the MPT's most useful properties. You can use a Merkle proof to verify data in the trie.
Non-inclusion proofs can demonstrate that a key does not exist by showing that the path terminates or diverges before reaching the expected leaf. Light clients can therefore verify account balances and contract states without downloading the full state.
State Bloat
Ethereum's MPT faces monotonic state growth because every new account, contract, and storage slot adds data permanently. As of 2025, Ethereum has over 335 million cumulative unique addresses, and the execution client database requires approximately 0.9 to 1.3 TB of storage. The database grows at roughly 7 to 8 GB per week.
Full node hardware now costs $2,000 to $10,000, threatening decentralisation as fewer participants can afford to validate the network independently. Ethereum has no built-in mechanism to remove abandoned accounts or expired contract state.
Proof Size
Branch nodes have 16 children, so a Merkle proof must include up to 15 sibling hashes per level. Proofs can become large because the MPT has a maximum depth of 64 nibbles. A witness covering 1,000 state items in the current MPT requires approximately 3.5 MB, making stateless validation impractical.
Verkle Trees: The Planned Replacement
Verkle trees, from "vector commitment" + "Merkle", are designed to replace the MPT on Ethereum. Verkle trees use polynomial commitments instead of hash-based child references, so a proof of any single element has a constant size regardless of the tree's width. Each node can therefore have 256 children while proofs stay small.
The same 1,000-item witness that requires approximately 3.5 MB in the MPT shrinks to roughly 150 KB with Verkle trees. This 23x reduction enables stateless validation, where nodes can verify blocks without storing the full state locally.
Ethereum's Verkle tree implementation uses Pedersen commitments with Inner Product Arguments (IPA) over the Bandersnatch elliptic curve. The specification is defined in EIP-6800, and the transition is targeted for the Hegota upgrade. The migration requires touching every existing account and contract in the state.
Comparison with Other Approaches
Bitcoin takes a fundamentally different approach to state management: rather than maintaining a global state trie, it tracks unspent transaction outputs (UTXOs) and uses Merkle trees only for transaction inclusion proofs within blocks. The design avoids the state bloat problem but limits programmability. Layer 2 protocols like Spark operate off-chain and avoid the state overhead of maintaining a global trie entirely, enabling faster and cheaper transactions while anchoring security to Bitcoin's base layer.
The glossary entry is for informational purposes only and does not constitute financial or investment advice. Always do your own research before using any protocol or technology.