Verkle trees (a portmanteau of "Vector commitment" and "Merkle Trees") are a data structure that can be used to upgrade Ethereum nodes so that they can stop storing large amounts of state data without losing the ability to validate blocks.
Verkle trees were proposed as Ethereum's next state tree in EIP-6800 (opens in a new tab), but that proposal is now stagnant and has been set aside in favor of a unified binary tree (EIP-7864 (opens in a new tab)). The binary tree pursues the same goal of small witnesses for stateless clients. This page explains how Verkle trees work and why research moved to a binary tree.
Statelessness
Verkle trees were designed as a step on the path to stateless Ethereum clients. Stateless clients are ones that do not have to store the entire state database in order to validate incoming blocks. Instead of using their own local copy of Ethereum's state to verify blocks, stateless clients use a "witness" to the state data that arrives with the block. A witness is a collection of individual pieces of the state data that are required to execute a particular set of transactions, and a cryptographic proof that the witness is really part of the full data. The witness is used instead of the state database. For this to work, the witnesses need to be very small, so that they can be safely broadcast across the network in time for validators to process them within a 12 second slot. The current state data structure is not suitable because witnesses are too large. Verkle trees solve this problem by enabling small witnesses, removing one of the main barriers to stateless clients.
What is a witness and why do we need them?
Verifying a block means re-executing the transactions contained in the block, applying the changes to Ethereum's state trie, and calculating the new root hash. A verified block is one whose computed state root hash is the same as the one provided with the block (because this means the block proposer really did the computation they say they did). In today's Ethereum clients, updating the state requires access to the entire state trie, which is a large data structure that must be stored locally. A witness only contains the fragments of the state data that are required to execute the transactions in the block. A validator can then only use those fragments to verify that the block proposer has executed the block transactions and updated the state correctly. However, this means that the witness needs to be transferred between peers on the Ethereum network rapidly enough to be received and processed by each node safely within a 12 second slot. If the witness is too large, it might take some nodes too long to download it and keep up with the chain. This is a centralizing force because it means only nodes with fast internet connections can participate in validating blocks. With Verkle trees there is no need to have the state stored on your hard drive; everything you need to verify a block is contained within the block itself. Unfortunately, the witnesses that can be produced from Merkle tries are too large to support stateless clients.
Why do Verkle trees enable smaller witnesses?
The structure of a Merkle Trie makes witness sizes very large - too large to safely broadcast between peers within a 12 second slot. This is because the witness is a path connecting the data, which is held in leaves, to the root hash. To verify the data it is necessary to have not only all the intermediate hashes that connect each leaf to the root, but also all the "sibling" nodes. Each node in the proof has a sibling that it is hashed with to create the next hash up the trie. This is a lot of data. Verkle trees reduce the witness size by shortening the distance between the leaves of the tree and its root and also eliminating the need to provide sibling nodes for verifying the root hash. Even more space efficiency will be gained by using a powerful polynomial commitment scheme instead of the hash-style vector commitment. The polynomial commitment allows the witness to have a fixed size regardless of the number of leaves that it proves.
Under the polynomial commitment scheme, the witnesses have manageable sizes that can easily be transferred on the peer-to-peer network. This allows clients to verify state changes in each block with a minimal amount of data.
What is the structure of a Verkle tree?
Verkle trees are (key,value) pairs where the keys are 32-byte elements composed of a 31-byte stem and a single byte suffix. These keys are organized into extension nodes and inner nodes. Extension nodes represent a single stem for 256 children with different suffixes. Inner nodes also have 256 children, but they can be other extension nodes. The main difference between the Verkle tree and the Merkle tree structure is that the Verkle tree is much flatter, meaning there are fewer intermediate nodes linking a leaf to the root, and therefore less data required to generate a proof.
A key lookup, drawn top to bottom in four bands. Stem tree: a root node and a row of its children; only the middle child, an inner node, is on the key's path, and the dashed ones are other children. Extension: the stem's extension node, a commitment to (1, stem, C1, C2). Suffix tree: the commitments C1 and C2, each over half of the stem's 256 suffix slots, C1 over suffixes 0 to 127 and C2 over 128 to 255. Data: the value's two halves, value_lower and value_upper. With the Verkle tree chosen, step 1: the key's first 31 bytes, its stem, lead from the root down the stem tree, one byte per level, each node having up to 256 children. Step 2: the path reaches the stem's extension node. Step 3: the key's last byte, its suffix, here 1, picks a slot under C1. Step 4: the 32-byte value is read as two 16-byte halves, because one field element holds only 252 bits safely. Step 5: the proof carries one commitment per level below the root, 3 in all, plus one opening proof shared by the whole witness, and no sibling nodes. Choosing the Merkle trie instead draws today's hexary Patricia trie: 7 branch nodes, each a row of 16 child slots with one slot on the key's path, and the value at the end. Step 1: the path takes 7 levels, against 4 in the Verkle tree. Step 2: a leaf holds the value. Step 3: the proof must carry the other 15 children of every node on the path, 105 sibling hashes. EIP-6800 puts the average witness for one account at about 200 bytes with Verkle trees, against close to 3 kB today.
Read more about the structure of Verkle trees (opens in a new tab)
Current progress
EIP-6800 (opens in a new tab), the proposal to move Ethereum's state into a unified Verkle tree, is now stagnant. Research has moved to EIP-7864 (opens in a new tab), which proposes a unified binary tree instead. EIP-7864 is a draft, and no network upgrade has been scheduled for it.
EIP-7864 gives two main reasons for the change. Verkle trees rely on elliptic-curve cryptography that is not secure against quantum computers, so they would eventually need to be replaced, while a binary tree relies only on hash functions. Progress in proving systems also reduces the need for the small, fast-to-generate proofs that were the main advantage of Verkle trees. Because each node in a binary tree has only two children, its proofs are also much smaller than proofs from today's hexary trie.
Further reading
- Verkle Trees for Statelessness (opens in a new tab)
- Dankrad Feist explain Verkle trees on PEEPanEIP (opens in a new tab)
- Verkle Trees For The Rest Of Us (opens in a new tab)
- Anatomy of A Verkle Proof (opens in a new tab)
- Guillaume Ballet explain Verkle trees at ETHGlobal (opens in a new tab)
- "How Verkle trees make Ethereum lean and mean" by Guillaume Ballet at Devcon 6 (opens in a new tab)
- Piper Merriam on stateless clients from ETHDenver 2020 (opens in a new tab)
- Dankrad Fiest explains Verkle trees and statelessness on Zero Knowledge podcast (opens in a new tab)
- Vitalik Buterin on Verkle trees (opens in a new tab)
- Dankrad Feist on Verkle trees (opens in a new tab)
- Verkle tree EIP documentation (opens in a new tab)
- EIP-6800: Ethereum state using a unified verkle tree (opens in a new tab)
- EIP-7864: Ethereum state using a unified binary tree (opens in a new tab)