{"eip":7864,"title":"Ethereum state using a unified binary tree","description":"Switch Ethereum state tree to a unified binary tree","authors":["Vitalik Buterin (@vbuterin)","Guillaume Ballet (@gballet)","Dankrad Feist (@dankrad)","Ignacio Hagopian (@jsign)","Kevaundray Wedderburn (@kevaundray)","Tanishq Jasoria (@tanishqjasoria)","Gajinder Singh (@g11tech)","Danno Ferrin (@shemnon)","Piper Merriam (@pipermerriam)","Gottfried Herold (@GottfriedHerold)"],"status":"Draft","type":"Standards Track","category":"Core","created":"2025-01-20","discussionsTo":"https://ethereum-magicians.org/t/eip-7864-ethereum-state-using-a-unified-binary-tree/22611","repo":"EIPs","label":"EIP-7864","officialUrl":"https://eips.ethereum.org/EIPS/eip-7864","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7864.md","url":"https://eips.huatuo.xyz/eip-7864/","tldr":{"en":"Proposes replacing Ethereum's hexary Merkle-Patricia tries with one binary tree holding accounts, code and storage, giving smaller proofs and a structure suited to zero-knowledge proving of blocks.","ja":"Ethereum の 16 分木の Merkle-Patricia トライを、アカウント、コード、ストレージをすべて保持する 1 本のバイナリツリーに置き換える提案。証明が小さくなり、ブロックのゼロ知識証明に適した構造が得られる。","ko":"이더리움의 16진 머클-패트리시아 트라이를 계정, 코드, 스토리지를 모두 담는 하나의 이진 트리로 교체하자는 제안. 증명이 작아지고 블록의 영지식 증명에 적합한 구조가 된다.","zh":"提议用一棵容纳账户、代码和存储的二叉树，取代以太坊的十六叉 Merkle-Patricia 树，从而获得更小的证明，以及更适合对区块做零知识证明的结构。"},"tags":["state","binary-tree","stateless","zk","core"],"explainers":{"en":{"lang":"en","tldr":"Proposes replacing Ethereum's hexary Merkle-Patricia tries with one binary tree holding accounts, code and storage, giving smaller proofs and a structure suited to zero-knowledge proving of blocks.","tags":["state","binary-tree","stateless","zk","core"],"related":[6800,7612,4762,7748],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-7864/","markdown":"## What problem does it solve?\n\nEthereum's state today lives in a **Merkle-Patricia Trie (MPT)**: a hexary (16-way) tree of accounts, where each contract has its own separate storage trie. This design is hard to prove efficiently:\n\n- Proofs are large. Each level of a hexary tree needs up to 15 sibling hashes, so proving even small pieces of state is expensive. Contract code is not part of the tree, so proving one byte of code can mean shipping the whole contract.\n- It uses RLP encoding and Keccak, and it is a \"tree of trees\", all costly inside ZK circuits.\n\nThe long-term goal is for blocks to be verified with validity proofs and for nodes to run statelessly. EIP-7864 proposes a state tree designed for that, replacing the earlier unified Verkle tree plan ([EIP-6800](/eip-6800/)).\n\n## How it works\n\n- **One tree, one key space.** Account headers, code and storage all live in a single binary tree whose keys map to 32-byte values. No separate storage tries, no RLP.\n- **Stems of 256 leaves.** A key is made of a type prefix byte, a **stem**, and a final subindex byte. Keys sharing a stem sit together under one `StemNode` with 256 leaf slots, so data that is accessed together is proved together.\n- **Grouped by type.** The first key byte separates headers, code and storage into their own subtrees, so each can be synced or handled differently.\n- **Account header leaf.** Version, code size, nonce and balance are packed into one 32-byte `BASIC_DATA` leaf; the code hash sits in a neighbouring leaf. The first code chunks and storage slots share the account's stem.\n- **Chunked code.** Bytecode is split into 31-byte chunks, each prefixed by one byte saying how many leading bytes are `PUSH` data, so a chunk can be executed and proved on its own.\n- **Simple hashing.** Internal nodes hash `left || right`; stem nodes hash the stem plus the root of their 256 leaves; empty subtrees hash to 32 zero bytes. There are no extension nodes.\n\nThe new tree starts **empty**. New writes go to it while the MPT is frozen; moving the old data over is left to a later fork ([EIP-7748](/eip-7748/)). The transition is described in [EIP-7612](/eip-7612/) and the gas changes for state access in [EIP-4762](/eip-4762/).\n\n## Sample code\n\nPacking an account's basic-data leaf, following the layout in the spec (Python):\n\n```python\ndef pack_basic_data(version: int, code_size: int, nonce: int, balance: int) -\u003e bytes:\n    leaf = bytearray(32)\n    leaf[0] = version                                # byte 0\n    # bytes 1..4 reserved\n    leaf[5:8] = code_size.to_bytes(3, \"big\")        # bytes 5..7\n    leaf[8:16] = nonce.to_bytes(8, \"big\")           # bytes 8..15\n    leaf[16:32] = balance.to_bytes(16, \"big\")       # bytes 16..31\n    return bytes(leaf)\n\ndef address32(addr20: bytes) -\u003e bytes:\n    return b\"\\x00\" * 12 + addr20                     # addresses are widened to 32 bytes\n\n# key = [HEADER_SUBTREE=0] + hash(address32) + [BASIC_DATA_LEAF_KEY=0]\n```\n\n## Things to know\n\n- **Status: Draft.** Nothing here is scheduled for a network upgrade.\n- **The hash function is not decided.** Reference code uses BLAKE3 for experimentation only; Keccak and Poseidon2 are also candidates. Do not treat any root computed today as final.\n- Some constants in the draft (how many code chunks and storage slots live in the account stem) are stated inconsistently between the parameter table and the prose, so check the latest version before implementing.\n- Switching trees changes the root hash and the proof formats that light clients, bridges and `eth_getProof` users depend on.\n- It replaces the Verkle plan: the earlier Verkle EIPs ([EIP-6800](/eip-6800/), [EIP-7612](/eip-7612/), [EIP-7748](/eip-7748/)) still carry Verkle titles, while this EIP reuses their transition and gas mechanics.\n"},"ja":{"lang":"ja","tldr":"Ethereum の 16 分木の Merkle-Patricia トライを、アカウント、コード、ストレージをすべて保持する 1 本のバイナリツリーに置き換える提案。証明が小さくなり、ブロックのゼロ知識証明に適した構造が得られる。","tags":["state","binary-tree","stateless","zk","core"],"related":[6800,7612,4762,7748],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-7864/","markdown":"## 何を解決するのか\n\n現在の Ethereum のステートは **Merkle-Patricia Trie（MPT）** にあります。これはアカウントの 16 分木（16-way）で、各コントラクトは別個のストレージトライを持ちます。この設計は効率的に証明するのが困難です。\n\n- 証明が大きくなります。16 分木では各階層で最大 15 個の兄弟ハッシュが必要になるため、ステートのごく一部を証明するだけでも高コストです。コントラクトのコードはツリーの一部ではないため、コードの 1 バイトを証明するのに、コントラクト全体を送る必要が生じることがあります。\n- RLP エンコーディングと Keccak を使い、しかも「木の木」という構造で、いずれも ZK 回路の中ではコストがかかります。\n\n長期的な目標は、ブロックを有効性証明で検証し、ノードをステートレスに動かすことです。EIP-7864 は、そのために設計されたステートツリーを提案し、以前の統一 Verkle ツリー計画（[EIP-6800](/eip-6800/)）に置き換わるものです。\n\n## 仕組み\n\n- **1 本のツリー、1 つのキー空間。** アカウントヘッダー、コード、ストレージはすべて、キーが 32 バイトの値に対応する 1 本のバイナリツリーに置かれます。別個のストレージトライも RLP もありません。\n- **256 リーフからなるステム。** キーは、タイプを示すプレフィックスバイト、**ステム**、そして最後のサブインデックスバイトからなります。同じステムを共有するキーは、256 個のリーフスロットを持つ 1 つの `StemNode` の下にまとまるため、一緒にアクセスされるデータは一緒に証明されます。\n- **タイプ別のグループ化。** 最初のキーバイトによって、ヘッダー、コード、ストレージがそれぞれ別のサブツリーに分けられ、それぞれ別々に同期したり扱ったりできます。\n- **アカウントヘッダーのリーフ。** バージョン、コードサイズ、nonce、残高が 1 つの 32 バイトの `BASIC_DATA` リーフに詰め込まれ、コードハッシュは隣のリーフにあります。最初のコードチャンクとストレージスロットは、アカウントのステムを共有します。\n- **チャンク化されたコード。** バイトコードは 31 バイトのチャンクに分割され、各チャンクの先頭に、その直後の何バイトが `PUSH` のデータかを示す 1 バイトが付くため、チャンクを単独で実行・証明できます。\n- **シンプルなハッシュ。** 内部ノードは `left || right` をハッシュし、ステムノードはステムと 256 個のリーフのルートをハッシュし、空のサブツリーは 32 バイトのゼロにハッシュされます。拡張ノードはありません。\n\n新しいツリーは**空の状態**から始まります。新しい書き込みはこのツリーに行われ、MPT は凍結されます。古いデータの移行は、後のフォーク（[EIP-7748](/eip-7748/)）に委ねられています。移行は [EIP-7612](/eip-7612/) に、ステートアクセスのガス変更は [EIP-4762](/eip-4762/) に記述されています。\n\n## サンプルコード\n\n仕様のレイアウトに沿って、アカウントの basic-data リーフを詰める例（Python）:\n\n```python\ndef pack_basic_data(version: int, code_size: int, nonce: int, balance: int) -\u003e bytes:\n    leaf = bytearray(32)\n    leaf[0] = version                                # byte 0\n    # bytes 1..4 reserved\n    leaf[5:8] = code_size.to_bytes(3, \"big\")        # bytes 5..7\n    leaf[8:16] = nonce.to_bytes(8, \"big\")           # bytes 8..15\n    leaf[16:32] = balance.to_bytes(16, \"big\")       # bytes 16..31\n    return bytes(leaf)\n\ndef address32(addr20: bytes) -\u003e bytes:\n    return b\"\\x00\" * 12 + addr20                     # addresses are widened to 32 bytes\n\n# key = [HEADER_SUBTREE=0] + hash(address32) + [BASIC_DATA_LEAF_KEY=0]\n```\n\n## 知っておくべきこと\n\n- **ステータス: Draft。** ここにあるものは、ネットワークアップグレードにスケジュールされていません。\n- **ハッシュ関数は決まっていません。** リファレンスコードは実験用にのみ BLAKE3 を使っており、Keccak と Poseidon2 も候補です。現時点で計算したルートを最終的なものとして扱わないでください。\n- ドラフトの一部の定数（アカウントのステムにコードチャンクとストレージスロットがいくつ入るか）は、パラメーターの表と本文で一貫せずに書かれているため、実装する前に最新版を確認してください。\n- ツリーを切り替えると、ルートハッシュと、ライトクライアント、ブリッジ、`eth_getProof` の利用者が依存する証明形式が変わります。\n- Verkle 計画に置き換わるものです。以前の Verkle の EIP（[EIP-6800](/eip-6800/)、[EIP-7612](/eip-7612/)、[EIP-7748](/eip-7748/)）は今も Verkle のタイトルのままで、この EIP はそれらの移行とガスの仕組みを再利用しています。\n"},"ko":{"lang":"ko","tldr":"이더리움의 16진 머클-패트리시아 트라이를 계정, 코드, 스토리지를 모두 담는 하나의 이진 트리로 교체하자는 제안. 증명이 작아지고 블록의 영지식 증명에 적합한 구조가 된다.","tags":["state","binary-tree","stateless","zk","core"],"related":[6800,7612,4762,7748],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-7864/","markdown":"## 어떤 문제를 해결하나요?\n\n오늘날 이더리움의 상태는 **머클-패트리시아 트라이(MPT)**에 있습니다. 계정의 16진(16-way) 트리이며, 각 컨트랙트는 별도의 스토리지 트라이를 가집니다. 이 설계는 효율적으로 증명하기 어렵습니다.\n\n- 증명이 큽니다. 16진 트리는 층마다 최대 15개의 형제 해시가 필요하므로, 상태의 작은 일부를 증명하는 데도 비용이 큽니다. 컨트랙트 코드는 트리에 포함되지 않아서 코드 1바이트를 증명하려면 컨트랙트 전체를 보내야 할 수도 있습니다.\n- RLP 인코딩과 Keccak을 사용하고 \"트리의 트리\" 구조라서, 모두 ZK 회로 안에서는 비용이 큽니다.\n\n장기 목표는 블록을 유효성 증명으로 검증하고 노드를 스테이트리스로 운영하는 것입니다. EIP-7864는 이를 위해 설계된 상태 트리를 제안하며, 이전의 통합 Verkle 트리 계획([EIP-6800](/eip-6800/))을 대체합니다.\n\n## 어떻게 동작하나요?\n\n- **하나의 트리, 하나의 키 공간.** 계정 헤더, 코드, 스토리지가 모두 키가 32바이트 값에 매핑되는 하나의 이진 트리에 들어갑니다. 별도의 스토리지 트라이도, RLP도 없습니다.\n- **256개 리프의 스템.** 키는 타입 접두사 바이트, **스템**, 마지막 서브인덱스 바이트로 구성됩니다. 같은 스템을 공유하는 키는 256개의 리프 슬롯을 가진 하나의 `StemNode` 아래에 모이므로, 함께 접근되는 데이터는 함께 증명됩니다.\n- **타입별 그룹화.** 첫 번째 키 바이트가 헤더, 코드, 스토리지를 각자의 서브트리로 나눠서 각각 따로 동기화하거나 처리할 수 있습니다.\n- **계정 헤더 리프.** 버전, 코드 크기, nonce, 잔액이 하나의 32바이트 `BASIC_DATA` 리프에 담기고, 코드 해시는 인접한 리프에 있습니다. 처음 몇 개의 코드 청크와 스토리지 슬롯은 계정의 스템을 공유합니다.\n- **청크로 나뉜 코드.** 바이트코드는 31바이트 청크로 나뉘고, 각 청크 앞에 선두 몇 바이트가 `PUSH` 데이터인지 알려 주는 1바이트가 붙으므로 청크를 단독으로 실행하고 증명할 수 있습니다.\n- **단순한 해싱.** 내부 노드는 `left || right`를 해시하고, 스템 노드는 스템과 256개 리프의 루트를 해시하며, 빈 서브트리는 32바이트의 0으로 해시됩니다. 확장 노드는 없습니다.\n\n새 트리는 **비어 있는 상태**로 시작합니다. 새로운 쓰기는 이 트리로 가고 MPT는 동결되며, 기존 데이터를 옮기는 일은 이후 포크([EIP-7748](/eip-7748/))로 미뤄집니다. 전환 방식은 [EIP-7612](/eip-7612/)에, 상태 접근의 가스 변경은 [EIP-4762](/eip-4762/)에 설명되어 있습니다.\n\n## 샘플 코드\n\n명세의 레이아웃에 따라 계정의 basic-data 리프를 채우기(Python):\n\n```python\ndef pack_basic_data(version: int, code_size: int, nonce: int, balance: int) -\u003e bytes:\n    leaf = bytearray(32)\n    leaf[0] = version                                # byte 0\n    # bytes 1..4 reserved\n    leaf[5:8] = code_size.to_bytes(3, \"big\")        # bytes 5..7\n    leaf[8:16] = nonce.to_bytes(8, \"big\")           # bytes 8..15\n    leaf[16:32] = balance.to_bytes(16, \"big\")       # bytes 16..31\n    return bytes(leaf)\n\ndef address32(addr20: bytes) -\u003e bytes:\n    return b\"\\x00\" * 12 + addr20                     # addresses are widened to 32 bytes\n\n# key = [HEADER_SUBTREE=0] + hash(address32) + [BASIC_DATA_LEAF_KEY=0]\n```\n\n## 알아둘 점\n\n- **상태: Draft.** 여기 있는 어떤 것도 네트워크 업그레이드 일정에 잡혀 있지 않습니다.\n- **해시 함수는 정해지지 않았습니다.** 레퍼런스 코드는 실험용으로만 BLAKE3를 쓰며, Keccak과 Poseidon2도 후보입니다. 오늘 계산한 루트를 최종 값으로 취급하지 마세요.\n- 초안의 일부 상수(계정 스템에 코드 청크와 스토리지 슬롯이 몇 개 들어가는지)는 파라미터 표와 본문에서 서로 다르게 적혀 있으므로, 구현하기 전에 최신 버전을 확인하세요.\n- 트리를 바꾸면 루트 해시와, 라이트 클라이언트, 브리지, `eth_getProof` 사용자가 의존하는 증명 형식이 바뀝니다.\n- Verkle 계획을 대체합니다. 이전의 Verkle EIP([EIP-6800](/eip-6800/), [EIP-7612](/eip-7612/), [EIP-7748](/eip-7748/))는 아직 Verkle 제목을 달고 있으며, 이 EIP는 그들의 전환 및 가스 메커니즘을 재사용합니다.\n"},"zh":{"lang":"zh","tldr":"提议用一棵容纳账户、代码和存储的二叉树，取代以太坊的十六叉 Merkle-Patricia 树，从而获得更小的证明，以及更适合对区块做零知识证明的结构。","tags":["state","binary-tree","stateless","zk","core"],"related":[6800,7612,4762,7748],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-7864/","markdown":"## 它解决什么问题？\n\n如今以太坊的状态存放在 **Merkle-Patricia 树（MPT）**中：这是一棵账户的十六叉（16-way）树，每个合约有自己独立的存储树。这种设计很难高效地证明：\n\n- 证明很大。十六叉树的每一层最多需要 15 个兄弟哈希，所以即使证明一小部分状态也很昂贵。合约代码不在树中，因此证明一个字节的代码可能意味着要传送整个合约。\n- 它使用 RLP 编码和 Keccak，而且是\"树中之树\"，这些在 ZK 电路中都代价高昂。\n\n长期目标是用有效性证明来验证区块，并让节点以无状态方式运行。EIP-7864 提出了一种为此设计的状态树，取代此前的统一 Verkle 树方案（[EIP-6800](/eip-6800/)）。\n\n## 它如何运作\n\n- **一棵树，一个键空间。**账户头、代码和存储都放在同一棵二叉树中，键映射到 32 字节的值。没有独立的存储树，也没有 RLP。\n- **256 个叶子的 stem。**一个键由类型前缀字节、一个 **stem** 和最后一个子索引字节组成。共享同一个 stem 的键放在同一个带有 256 个叶子槽位的 `StemNode` 之下，因此一起访问的数据会被一起证明。\n- **按类型分组。**第一个键字节把账户头、代码和存储分到各自的子树，因此每一类都可以单独同步或处理。\n- **账户头叶子。**版本、代码大小、nonce 和余额被打包进一个 32 字节的 `BASIC_DATA` 叶子；代码哈希位于相邻的叶子。最前面的几个代码块和存储槽共享该账户的 stem。\n- **分块的代码。**字节码被切成 31 字节的块，每块前面有一个字节，说明开头有多少字节是 `PUSH` 数据，因此一个块可以被单独执行和证明。\n- **简单的哈希。**内部节点对 `left || right` 做哈希；stem 节点对 stem 加上其 256 个叶子的根做哈希；空子树哈希为 32 个零字节。没有扩展节点。\n\n新树从**空**开始。新的写入进入新树，而 MPT 被冻结；把旧数据迁移过来留待后续分叉（[EIP-7748](/eip-7748/)）。过渡方案见 [EIP-7612](/eip-7612/)，状态访问的 gas 变更见 [EIP-4762](/eip-4762/)。\n\n## 示例代码\n\n按规范中的布局打包账户的 basic-data 叶子（Python）：\n\n```python\ndef pack_basic_data(version: int, code_size: int, nonce: int, balance: int) -\u003e bytes:\n    leaf = bytearray(32)\n    leaf[0] = version                                # byte 0\n    # bytes 1..4 reserved\n    leaf[5:8] = code_size.to_bytes(3, \"big\")        # bytes 5..7\n    leaf[8:16] = nonce.to_bytes(8, \"big\")           # bytes 8..15\n    leaf[16:32] = balance.to_bytes(16, \"big\")       # bytes 16..31\n    return bytes(leaf)\n\ndef address32(addr20: bytes) -\u003e bytes:\n    return b\"\\x00\" * 12 + addr20                     # addresses are widened to 32 bytes\n\n# key = [HEADER_SUBTREE=0] + hash(address32) + [BASIC_DATA_LEAF_KEY=0]\n```\n\n## 需要注意\n\n- **状态：Draft。**这里的内容都没有排入任何网络升级。\n- **哈希函数尚未确定。**参考代码仅为实验使用 BLAKE3；Keccak 和 Poseidon2 也是候选。不要把今天计算出的任何根当作最终结果。\n- 草案中的一些常量（账户 stem 中放多少个代码块和存储槽），在参数表和正文中的表述并不一致，因此实现之前请查看最新版本。\n- 切换树会改变根哈希以及轻客户端、桥和 `eth_getProof` 用户所依赖的证明格式。\n- 它取代了 Verkle 方案：此前的 Verkle EIP（[EIP-6800](/eip-6800/)、[EIP-7612](/eip-7612/)、[EIP-7748](/eip-7748/)）仍然沿用 Verkle 的标题，而本 EIP 复用了它们的过渡方案和 gas 机制。\n"}}}
