{"eip":8364,"title":"SSZ Compact Multiproofs","description":"A request-friendly Merkle multiproof format using a proof descriptor bitlist","authors":["Zsolt Felföldi (@zsfelfoldi)","Cayman (@wemeetagain)","Lodekeeper (@lodekeeper)"],"status":"Draft","type":"Standards Track","category":"Core","created":"2026-08-04","discussionsTo":"https://ethereum-magicians.org/t/eip-8364-ssz-compact-multiproofs/29277","repo":"EIPs","label":"EIP-8364","officialUrl":"https://eips.ethereum.org/EIPS/eip-8364","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-8364.md","url":"https://eips.huatuo.xyz/eip-8364/","tldr":{"en":"A compact Merkle multiproof format for SSZ that describes a proof's shape as a bitlist of about two bits per node, so clients can request arbitrary proofs cheaply and servers can produce them in one tree walk.","ja":"SSZ 向けのコンパクトな Merkle マルチプルーフ形式。証明の形状をノードあたり約 2 ビットのビットリストとして記述するため、クライアントは任意の証明を安価に要求でき、サーバーは 1 回のツリー走査で生成できる。","ko":"SSZ를 위한 간결한 Merkle 멀티프루프 형식. 증명의 모양을 노드당 약 2비트의 비트리스트로 기술해, 클라이언트는 임의의 증명을 저렴하게 요청하고 서버는 한 번의 트리 순회로 생성할 수 있다.","zh":"一种紧凑的 SSZ Merkle 多重证明格式，用每个节点约两位的位列表来描述证明的形状，使客户端能以很低的代价请求任意证明，服务器也能在一次树遍历中生成它们。"},"tags":["ssz","merkle","proofs","light-client","consensus"],"explainers":{"en":{"lang":"en","tldr":"A compact Merkle multiproof format for SSZ that describes a proof's shape as a bitlist of about two bits per node, so clients can request arbitrary proofs cheaply and servers can produce them in one tree walk.","tags":["ssz","merkle","proofs","light-client","consensus"],"related":[7916],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-8364/","markdown":"## What problem does it solve?\n\nLight clients and proof-serving APIs often want a *multiproof*: several leaves of an SSZ Merkle tree proven together against one root, sharing helper nodes. The existing SSZ format identifies nodes by a list of **generalized indices**, which has two drawbacks when proofs are requested on the fly:\n\n- **Bandwidth**: every index costs two to eight bytes.\n- **Server work**: given requested indices, the server must compute the helper indices and plan how to walk its tree before it can answer.\n\nEIP-8364 replaces the index list with a **proof descriptor**, a bitlist that encodes the shape of the proof directly. It works both as the request a client sends and as the framing of the response.\n\n## How it works\n\nWalk the tree depth-first, left to right, from the root:\n\n- If the current node is one of the proof nodes (requested or helper, treated the same), emit `1` and stop descending.\n- Otherwise emit `0` and visit its left child, then its right child.\n\nA proof with `N` nodes yields exactly `N` ones and `N - 1` zeros, `2N - 1` bits in total. The list is self-delimiting: it ends at the first point where ones outnumber zeros. Bits are packed most-significant-bit first, with up to seven zero padding bits.\n\nThe proof itself is the descriptor followed by the `N` nodes in traversal order (equivalently, sorted by the binary form of their generalized index). A verifier replays the walk: each `1` consumes a node, each `0` hashes its two children with SHA-256, and the result must equal the known root.\n\nValidity rules make the encoding canonical: at least one `1`, no more than seven bits after the final `1`, and the ones-exceed-zeros point must be exactly the final `1`. Implementations must reject anything else.\n\n## Sample code\n\nBuilding and checking a descriptor, using the spec's worked example (requesting generalized index 42):\n\n```python\ndef compute_proof_descriptor(proof_indices):            # already includes helpers\n    bits = \"\"\n    for idx in sorted(proof_indices, key=bin):          # traversal order\n        b = bin(idx)\n        bits += \"0\" * (len(b) - len(b.rstrip(\"0\"))) + \"1\"\n    bits += \"0\" * (-len(bits) % 8)\n    return int(bits, 2).to_bytes(len(bits) // 8, \"big\")\n\n# proof nodes for index 42: 4, 20, 42, 43, 11, 3\nassert compute_proof_descriptor([4, 20, 42, 43, 11, 3]) == bytes.fromhex(\"25e0\")\nassert compute_proof_descriptor([2, 3]) == bytes.fromhex(\"60\")   # bits 011\n```\n\n| Descriptor | Valid? | Reason |\n| --- | --- | --- |\n| `0x80` | yes | single node (the root) |\n| `0x00` | no | no `1` bit |\n| `0xff` | no | ends at bit 0 but more `1`s follow |\n| `0x25e000` | no | more than seven padding bits |\n\n## Things to know\n\n- **Status: Draft.**\n- It adds a new format only; existing generalized-index multiproofs and all SSZ data structures are unchanged.\n- A descriptor describes positions, not tree structure. A verifier should derive the descriptor itself from the indices it means to check (or compare a supplied one against that), otherwise a peer could prove the wrong positions. For variable-size types such as SSZ lists, also verify the shape (for example the length mix-in) first.\n- Validate the descriptor and node count before hashing, cap descriptor length, and prefer an iterative walk: a chain-shaped descriptor can force recursion depth `N`.\n- The format works for any binary Merkle tree, including the progressive shapes of [EIP-7916](/eip-7916/).\n"},"ja":{"lang":"ja","tldr":"SSZ 向けのコンパクトな Merkle マルチプルーフ形式。証明の形状をノードあたり約 2 ビットのビットリストとして記述するため、クライアントは任意の証明を安価に要求でき、サーバーは 1 回のツリー走査で生成できる。","tags":["ssz","merkle","proofs","light-client","consensus"],"related":[7916],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-8364/","markdown":"## 何を解決するのか\n\nライトクライアントや証明を提供する API は、*マルチプルーフ*を求めることがよくあります。SSZ Merkle ツリーの複数のリーフを、ヘルパーノードを共有しながら、1 つのルートに対してまとめて証明するものです。既存の SSZ 形式は**一般化インデックス**のリストでノードを識別しますが、証明をその場で要求する場合には 2 つの欠点があります。\n\n- **帯域幅**: インデックスごとに 2〜8 バイトかかります。\n- **サーバーの作業**: 要求されたインデックスが与えられたとき、サーバーは応答する前にヘルパーインデックスを計算し、ツリーをどう走査するかを計画しなければなりません。\n\nEIP-8364 はインデックスのリストを**証明ディスクリプタ**に置き換えます。これは証明の形状を直接エンコードするビットリストです。クライアントが送るリクエストとしても、レスポンスのフレーミングとしても機能します。\n\n## 仕組み\n\nルートから、深さ優先で左から右へツリーを走査します。\n\n- 現在のノードが証明ノードの 1 つ（要求されたものもヘルパーも同じ扱い）なら、`1` を出力して、それ以上降りません。\n- そうでなければ `0` を出力し、左の子、続いて右の子を訪れます。\n\n`N` 個のノードを持つ証明は、ちょうど `N` 個の 1 と `N - 1` 個の 0、合計 `2N - 1` ビットになります。リストは自己終端的で、1 の数が 0 の数を上回る最初の時点で終わります。ビットは最上位ビットから順に詰められ、末尾に最大 7 ビットのゼロパディングが付きます。\n\n証明自体は、ディスクリプタに続いて `N` 個のノードが走査順（同じことですが、一般化インデックスの 2 進形式でのソート順）に並んだものです。検証者は走査を再現します。各 `1` はノードを 1 つ消費し、各 `0` は 2 つの子を SHA-256 でハッシュし、その結果が既知のルートと等しくなければなりません。\n\n妥当性ルールによってエンコーディングは正準になります。少なくとも 1 つの `1` があること、最後の `1` の後に 7 ビットを超えるビットがないこと、そして 1 の数が 0 を上回る時点がちょうど最後の `1` であることです。実装はそれ以外をすべて拒否しなければなりません。\n\n## サンプルコード\n\n仕様の具体例（一般化インデックス 42 を要求）を使って、ディスクリプタを構築・検証する:\n\n```python\ndef compute_proof_descriptor(proof_indices):            # already includes helpers\n    bits = \"\"\n    for idx in sorted(proof_indices, key=bin):          # traversal order\n        b = bin(idx)\n        bits += \"0\" * (len(b) - len(b.rstrip(\"0\"))) + \"1\"\n    bits += \"0\" * (-len(bits) % 8)\n    return int(bits, 2).to_bytes(len(bits) // 8, \"big\")\n\n# proof nodes for index 42: 4, 20, 42, 43, 11, 3\nassert compute_proof_descriptor([4, 20, 42, 43, 11, 3]) == bytes.fromhex(\"25e0\")\nassert compute_proof_descriptor([2, 3]) == bytes.fromhex(\"60\")   # bits 011\n```\n\n| ディスクリプタ | 有効か | 理由 |\n| --- | --- | --- |\n| `0x80` | はい | 単一ノード（ルート） |\n| `0x00` | いいえ | `1` ビットがない |\n| `0xff` | いいえ | ビット 0 で終わるが、さらに `1` が続く |\n| `0x25e000` | いいえ | 7 ビットを超えるパディング |\n\n## 知っておくべきこと\n\n- **ステータス: Draft。**\n- 追加されるのは新しい形式だけで、既存の一般化インデックスのマルチプルーフと、すべての SSZ データ構造は変わりません。\n- ディスクリプタは位置を記述するもので、ツリーの構造ではありません。検証者は、確認したいインデックスからディスクリプタを自分で導出すべきです（または渡されたものをそれと比較します）。さもないと、ピアが誤った位置を証明する可能性があります。SSZ リストのような可変サイズの型では、先に形状（たとえば長さのミックスイン）も検証してください。\n- ハッシュする前にディスクリプタとノード数を検証し、ディスクリプタの長さに上限を設け、反復的な走査を優先してください。鎖状のディスクリプタは、再帰の深さを `N` にさせ得ます。\n- この形式は、[EIP-7916](/eip-7916/) のプログレッシブな形状を含め、あらゆるバイナリ Merkle ツリーで機能します。\n"},"ko":{"lang":"ko","tldr":"SSZ를 위한 간결한 Merkle 멀티프루프 형식. 증명의 모양을 노드당 약 2비트의 비트리스트로 기술해, 클라이언트는 임의의 증명을 저렴하게 요청하고 서버는 한 번의 트리 순회로 생성할 수 있다.","tags":["ssz","merkle","proofs","light-client","consensus"],"related":[7916],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-8364/","markdown":"## 어떤 문제를 해결하나요?\n\n라이트 클라이언트와 증명을 제공하는 API는 종종 *멀티프루프*를 원합니다. SSZ Merkle 트리의 여러 리프를 헬퍼 노드를 공유하면서 하나의 루트에 대해 함께 증명하는 것입니다. 기존 SSZ 형식은 **일반화 인덱스(generalized index)** 목록으로 노드를 식별하는데, 증명을 즉석에서 요청할 때 두 가지 단점이 있습니다.\n\n- **대역폭**: 인덱스마다 2~8바이트가 듭니다.\n- **서버 작업**: 요청된 인덱스가 주어지면, 서버는 응답하기 전에 헬퍼 인덱스를 계산하고 트리를 어떻게 순회할지 계획해야 합니다.\n\nEIP-8364는 인덱스 목록을 **증명 디스크립터(proof descriptor)**로 대체합니다. 증명의 모양을 직접 인코딩하는 비트리스트입니다. 클라이언트가 보내는 요청으로도, 응답의 프레이밍으로도 쓰입니다.\n\n## 어떻게 동작하나요?\n\n루트에서 시작해 깊이 우선, 왼쪽에서 오른쪽으로 트리를 순회합니다.\n\n- 현재 노드가 증명 노드 중 하나(요청된 것이든 헬퍼든 똑같이 취급)이면 `1`을 내보내고 더 내려가지 않습니다.\n- 그렇지 않으면 `0`을 내보내고 왼쪽 자식, 이어서 오른쪽 자식을 방문합니다.\n\n`N`개의 노드가 있는 증명은 정확히 `N`개의 1과 `N - 1`개의 0, 총 `2N - 1`비트를 만듭니다. 리스트는 스스로 끝이 정해지며, 1의 개수가 0의 개수를 처음 넘어서는 지점에서 끝납니다. 비트는 최상위 비트부터 채워지고, 끝에 최대 7비트의 0 패딩이 붙습니다.\n\n증명 자체는 디스크립터 뒤에 순회 순서(같은 말로, 일반화 인덱스의 이진 형태로 정렬한 순서)로 `N`개의 노드가 오는 것입니다. 검증자는 순회를 재현합니다. 각 `1`은 노드를 하나 소비하고, 각 `0`은 두 자식을 SHA-256으로 해시하며, 결과는 알려진 루트와 같아야 합니다.\n\n유효성 규칙이 인코딩을 정규적으로 만듭니다. 최소 하나의 `1`이 있어야 하고, 마지막 `1` 뒤에 7비트를 넘는 비트가 없어야 하며, 1이 0을 넘어서는 지점이 정확히 마지막 `1`이어야 합니다. 구현은 그 밖의 것을 모두 거부해야 합니다.\n\n## 샘플 코드\n\n명세의 실제 예시(일반화 인덱스 42 요청)를 사용해 디스크립터를 만들고 검사하기:\n\n```python\ndef compute_proof_descriptor(proof_indices):            # already includes helpers\n    bits = \"\"\n    for idx in sorted(proof_indices, key=bin):          # traversal order\n        b = bin(idx)\n        bits += \"0\" * (len(b) - len(b.rstrip(\"0\"))) + \"1\"\n    bits += \"0\" * (-len(bits) % 8)\n    return int(bits, 2).to_bytes(len(bits) // 8, \"big\")\n\n# proof nodes for index 42: 4, 20, 42, 43, 11, 3\nassert compute_proof_descriptor([4, 20, 42, 43, 11, 3]) == bytes.fromhex(\"25e0\")\nassert compute_proof_descriptor([2, 3]) == bytes.fromhex(\"60\")   # bits 011\n```\n\n| 디스크립터 | 유효한가 | 이유 |\n| --- | --- | --- |\n| `0x80` | 예 | 단일 노드(루트) |\n| `0x00` | 아니오 | `1` 비트가 없음 |\n| `0xff` | 아니오 | 비트 0에서 끝나지만 `1`이 더 이어짐 |\n| `0x25e000` | 아니오 | 7비트를 넘는 패딩 |\n\n## 알아둘 점\n\n- **상태: Draft.**\n- 새로운 형식만 추가하며, 기존의 일반화 인덱스 멀티프루프와 모든 SSZ 데이터 구조는 바뀌지 않습니다.\n- 디스크립터는 위치를 기술할 뿐 트리 구조를 기술하지 않습니다. 검증자는 확인하려는 인덱스로부터 디스크립터를 직접 도출하거나(또는 받은 것을 그것과 비교해야) 합니다. 그렇지 않으면 상대 피어가 잘못된 위치를 증명할 수 있습니다. SSZ 리스트 같은 가변 크기 타입에서는 먼저 모양(예: 길이 믹스인)도 검증하세요.\n- 해시하기 전에 디스크립터와 노드 수를 검증하고, 디스크립터 길이에 상한을 두고, 반복적 순회를 선호하세요. 사슬 모양의 디스크립터는 재귀 깊이를 `N`까지 강제할 수 있습니다.\n- 이 형식은 [EIP-7916](/eip-7916/)의 점진적(progressive) 구조를 포함해 모든 이진 Merkle 트리에서 동작합니다.\n"},"zh":{"lang":"zh","tldr":"一种紧凑的 SSZ Merkle 多重证明格式，用每个节点约两位的位列表来描述证明的形状，使客户端能以很低的代价请求任意证明，服务器也能在一次树遍历中生成它们。","tags":["ssz","merkle","proofs","light-client","consensus"],"related":[7916],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-8364/","markdown":"## 它解决什么问题？\n\n轻客户端和提供证明的 API 经常需要*多重证明*：针对同一个根，把 SSZ Merkle 树的多个叶子一起证明，并共享辅助节点。现有的 SSZ 格式用一个**广义索引**列表来标识节点，在临时请求证明时有两个缺点：\n\n- **带宽**：每个索引占两到八个字节。\n- **服务器工作量**：给定请求的索引，服务器必须先计算辅助索引并规划如何遍历它的树，然后才能回答。\n\nEIP-8364 用**证明描述符（proof descriptor）**取代索引列表，这是一个直接编码证明形状的位列表。它既可作为客户端发送的请求，也可作为响应的帧格式。\n\n## 它如何运作\n\n从根开始，以深度优先、从左到右的顺序遍历树：\n\n- 如果当前节点是证明节点之一（无论是被请求的还是辅助的，一视同仁），输出 `1` 并停止向下。\n- 否则输出 `0`，并先访问其左子节点，再访问其右子节点。\n\n含有 `N` 个节点的证明恰好产生 `N` 个 1 和 `N - 1` 个 0，共 `2N - 1` 位。该列表是自定界的：在 1 的数量首次超过 0 的数量处结束。位按最高有效位在前的顺序打包，最多带有七个零填充位。\n\n证明本身是描述符，后面跟着按遍历顺序排列的 `N` 个节点（等价地，按其广义索引的二进制形式排序）。验证者重放这次遍历：每个 `1` 消耗一个节点，每个 `0` 用 SHA-256 对其两个子节点做哈希，结果必须等于已知的根。\n\n有效性规则使编码具有规范性：至少有一个 `1`，最后一个 `1` 之后不超过七位，并且 1 的数量超过 0 的位置必须恰好是最后一个 `1`。实现必须拒绝其他任何情况。\n\n## 示例代码\n\n使用规范中的实例（请求广义索引 42）构建并检查描述符：\n\n```python\ndef compute_proof_descriptor(proof_indices):            # already includes helpers\n    bits = \"\"\n    for idx in sorted(proof_indices, key=bin):          # traversal order\n        b = bin(idx)\n        bits += \"0\" * (len(b) - len(b.rstrip(\"0\"))) + \"1\"\n    bits += \"0\" * (-len(bits) % 8)\n    return int(bits, 2).to_bytes(len(bits) // 8, \"big\")\n\n# proof nodes for index 42: 4, 20, 42, 43, 11, 3\nassert compute_proof_descriptor([4, 20, 42, 43, 11, 3]) == bytes.fromhex(\"25e0\")\nassert compute_proof_descriptor([2, 3]) == bytes.fromhex(\"60\")   # bits 011\n```\n\n| 描述符 | 是否有效 | 原因 |\n| --- | --- | --- |\n| `0x80` | 是 | 单个节点（根） |\n| `0x00` | 否 | 没有 `1` 位 |\n| `0xff` | 否 | 在第 0 位结束，但后面还有 `1` |\n| `0x25e000` | 否 | 超过七个填充位 |\n\n## 需要注意\n\n- **状态：Draft。**\n- 它只新增一种格式；现有的广义索引多重证明以及所有 SSZ 数据结构都保持不变。\n- 描述符描述的是位置，而不是树的结构。验证者应当根据自己要检查的索引来自行推导描述符（或把收到的描述符与之比较），否则对端可能证明了错误的位置。对于 SSZ 列表这类可变大小类型，还应先验证其形状（例如长度混入）。\n- 在哈希之前先验证描述符和节点数量，限制描述符的长度，并优先使用迭代遍历：链状的描述符可能迫使递归深度达到 `N`。\n- 该格式适用于任何二叉 Merkle 树，包括 [EIP-7916](/eip-7916/) 的渐进式形状。\n"}}}
