{"eip":4881,"title":"Deposit Contract Snapshot Interface","description":"Establishing the format and endpoint for transmitting a snapshot of the deposit Merkle tree","authors":["Mark Mackey (@ethDreamer)"],"status":"Final","type":"Standards Track","category":"Interface","created":"2021-01-29","discussionsTo":"https://ethereum-magicians.org/t/eip-4881-deposit-contract-snapshot-interface/8554","repo":"EIPs","label":"EIP-4881","officialUrl":"https://eips.ethereum.org/EIPS/eip-4881","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-4881.md","url":"https://eips.huatuo.xyz/eip-4881/","tldr":{"en":"Defines a compact snapshot of the beacon chain deposit Merkle tree, served at a standard Beacon API endpoint, so new consensus clients can rebuild it without replaying every historical deposit.","ja":"ビーコンチェーンのデポジット Merkle ツリーのコンパクトなスナップショットを定義し、標準の Beacon API エンドポイントで提供する。新しいコンセンサスクライアントは過去のデポジットをすべて再生しなくてもツリーを再構築できる。","ko":"비콘 체인 예치(deposit) Merkle 트리의 간결한 스냅샷을 정의하고 표준 Beacon API 엔드포인트로 제공하여, 새 합의 클라이언트가 과거의 모든 예치를 재생하지 않고도 트리를 다시 구성할 수 있게 한다.","zh":"定义信标链存款 Merkle 树的紧凑快照，并通过标准 Beacon API 端点提供，使新的共识客户端无需重放每一笔历史存款即可重建该树。"},"tags":["consensus","deposits","beacon-api","sync","staking"],"explainers":{"en":{"lang":"en","tldr":"Defines a compact snapshot of the beacon chain deposit Merkle tree, served at a standard Beacon API endpoint, so new consensus clients can rebuild it without replaying every historical deposit.","tags":["consensus","deposits","beacon-api","sync","staking"],"related":[2982,3675,6110],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-4881/","markdown":"## What problem does it solve?\n\nEvery validator joins by sending ETH to the deposit contract on the execution layer. The contract keeps an incremental Merkle tree of all deposits, and beacon blocks must include each new deposit with a Merkle proof against that tree.\n\nTo build those proofs, most consensus clients downloaded and stored *every* deposit log since the contract launched. That slowed down new nodes, especially those using weak-subjectivity (checkpoint) sync, and it prevented execution nodes from ever pruning old logs. Yet once a deposit has been processed and finalized, most of the hashes on its path are never needed again.\n\nEIP-4881 standardises a small snapshot of just the parts of the tree that still matter, and an endpoint to fetch it.\n\n## How it works\n\nClients may store the tree however they like internally, but when transmitting it they must use:\n\n```python\nclass DepositTreeSnapshot:\n    finalized: List[Hash32, DEPOSIT_CONTRACT_DEPTH]  # roots of fully finalized subtrees\n    deposit_root: Hash32\n    deposit_count: uint64\n    execution_block_hash: Hash32\n    execution_block_height: uint64\n```\n\n- `finalized` holds, for the finalized part of the tree, only the root hash of each complete left subtree. With a depth-32 tree this is at most 32 hashes, whatever the number of deposits.\n- `deposit_root`, `deposit_count` and `execution_block_hash` match the beacon chain's `Eth1Data` for that point. `execution_block_height` is included too, so a syncing client does not have to ask a possibly unsynced execution engine for it.\n- A receiver can recompute the root from `finalized` and `deposit_count` and compare it with `deposit_root` to validate the snapshot cheaply.\n- New deposits after the snapshot are appended on top, and proofs can be generated from there.\n\nConsensus clients serve the snapshot at the Beacon Node API endpoint `/eth/v1/beacon/deposit_snapshot`. Once deposits pass the finalization conditions, clients may prune the hashes underneath.\n\n## Sample code\n\nFetching the snapshot from a beacon node (TypeScript):\n\n```ts\nconst res = await fetch(`${process.env.BEACON_URL}/eth/v1/beacon/deposit_snapshot`);\nconst { data } = await res.json();\n\nconsole.log(data.deposit_count);            // number of deposits covered\nconsole.log(data.finalized.length);         // at most 32 hashes\nconsole.log(data.execution_block_hash);\n```\n\nValidating a snapshot, adapted from the spec's reference implementation:\n\n```python\ndef calculate_root(snap) -\u003e Hash32:\n    size, index = snap.deposit_count, len(snap.finalized)\n    root = zerohashes[0]\n    for level in range(DEPOSIT_CONTRACT_DEPTH):\n        if size \u0026 1:\n            index -= 1\n            root = sha256(snap.finalized[index] + root)\n        else:\n            root = sha256(root + zerohashes[level])\n        size \u003e\u003e= 1\n    return sha256(root + to_le_bytes(snap.deposit_count))  # mix in the count\n\nassert calculate_root(snap) == snap.deposit_root\n```\n\n## Things to know\n\n- This is an **Interface** EIP for consensus clients and node operators; it does not change consensus rules or the deposit contract, and is fully backwards compatible.\n- Snapshots are trusted data from whoever serves them, much like a checkpoint-sync state. Fetch them from a node you trust and check the root.\n- The spec includes test vectors and a reference implementation in Python.\n- [EIP-6110](/eip-6110/) later moved deposit delivery onto the execution layer, which reduces how much clients rely on the old `Eth1Data` deposit flow over time.\n"},"ja":{"lang":"ja","tldr":"ビーコンチェーンのデポジット Merkle ツリーのコンパクトなスナップショットを定義し、標準の Beacon API エンドポイントで提供する。新しいコンセンサスクライアントは過去のデポジットをすべて再生しなくてもツリーを再構築できる。","tags":["consensus","deposits","beacon-api","sync","staking"],"related":[2982,3675,6110],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-4881/","markdown":"## 何を解決するのか\n\nバリデーターはすべて、実行レイヤー上のデポジットコントラクトに ETH を送ることで参加します。コントラクトはすべてのデポジットの増分 Merkle ツリーを保持しており、ビーコンブロックは新しいデポジットごとに、そのツリーに対する Merkle 証明を含めなければなりません。\n\nこの証明を作るため、ほとんどのコンセンサスクライアントは、コントラクトのローンチ以降の*すべての*デポジットログをダウンロードして保存していました。そのため、特に weak subjectivity（チェックポイント）同期を使う新しいノードの起動が遅くなり、実行ノードが古いログをプルーニングすることもできませんでした。しかし、デポジットが処理されてファイナライズされた後は、そのパス上のハッシュの大半は二度と必要になりません。\n\nEIP-4881 は、ツリーのうち依然として重要な部分だけの小さなスナップショットと、それを取得するエンドポイントを標準化します。\n\n## 仕組み\n\nクライアントは内部でツリーを好きな形で保存してよいですが、送信するときは次の形式を使わなければなりません。\n\n```python\nclass DepositTreeSnapshot:\n    finalized: List[Hash32, DEPOSIT_CONTRACT_DEPTH]  # roots of fully finalized subtrees\n    deposit_root: Hash32\n    deposit_count: uint64\n    execution_block_hash: Hash32\n    execution_block_height: uint64\n```\n\n- `finalized` には、ツリーのファイナライズ済みの部分について、完成した各左サブツリーのルートハッシュだけが入ります。深さ 32 のツリーなら、デポジット数にかかわらず最大 32 個のハッシュです。\n- `deposit_root`、`deposit_count`、`execution_block_hash` は、その時点のビーコンチェーンの `Eth1Data` と一致します。`execution_block_height` も含まれているので、同期中のクライアントが、まだ同期していないかもしれない実行エンジンに問い合わせる必要はありません。\n- 受信側は `finalized` と `deposit_count` からルートを再計算し、`deposit_root` と比較することで、スナップショットを低コストで検証できます。\n- スナップショット以降の新しいデポジットはその上に追加され、そこから証明を生成できます。\n\nコンセンサスクライアントは、Beacon Node API のエンドポイント `/eth/v1/beacon/deposit_snapshot` でスナップショットを提供します。デポジットがファイナライズの条件を満たしたら、クライアントはその下にあるハッシュをプルーニングしてかまいません。\n\n## サンプルコード\n\nビーコンノードからスナップショットを取得する（TypeScript）:\n\n```ts\nconst res = await fetch(`${process.env.BEACON_URL}/eth/v1/beacon/deposit_snapshot`);\nconst { data } = await res.json();\n\nconsole.log(data.deposit_count);            // number of deposits covered\nconsole.log(data.finalized.length);         // at most 32 hashes\nconsole.log(data.execution_block_hash);\n```\n\nスナップショットの検証（仕様のリファレンス実装を基にしたもの）:\n\n```python\ndef calculate_root(snap) -\u003e Hash32:\n    size, index = snap.deposit_count, len(snap.finalized)\n    root = zerohashes[0]\n    for level in range(DEPOSIT_CONTRACT_DEPTH):\n        if size \u0026 1:\n            index -= 1\n            root = sha256(snap.finalized[index] + root)\n        else:\n            root = sha256(root + zerohashes[level])\n        size \u003e\u003e= 1\n    return sha256(root + to_le_bytes(snap.deposit_count))  # mix in the count\n\nassert calculate_root(snap) == snap.deposit_root\n```\n\n## 知っておくべきこと\n\n- これはコンセンサスクライアントとノード運用者向けの **Interface** EIP であり、コンセンサスルールやデポジットコントラクトは変更せず、完全に後方互換です。\n- スナップショットは、提供元から渡される信頼データであり、checkpoint-sync のステートとよく似ています。信頼できるノードから取得し、ルートを確認してください。\n- 仕様には、テストベクターと Python のリファレンス実装が含まれています。\n- [EIP-6110](/eip-6110/) は後にデポジットの配送を実行レイヤーに移し、時間とともに、クライアントが従来の `Eth1Data` によるデポジットフローに依存する度合いを減らします。\n"},"ko":{"lang":"ko","tldr":"비콘 체인 예치(deposit) Merkle 트리의 간결한 스냅샷을 정의하고 표준 Beacon API 엔드포인트로 제공하여, 새 합의 클라이언트가 과거의 모든 예치를 재생하지 않고도 트리를 다시 구성할 수 있게 한다.","tags":["consensus","deposits","beacon-api","sync","staking"],"related":[2982,3675,6110],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-4881/","markdown":"## 어떤 문제를 해결하나요?\n\n모든 검증자는 실행 계층의 예치 컨트랙트에 ETH를 보내는 방식으로 참여합니다. 컨트랙트는 모든 예치의 증분 Merkle 트리를 보관하며, 비콘 블록은 새 예치마다 그 트리에 대한 Merkle 증명을 포함해야 합니다.\n\n이 증명을 만들기 위해 대부분의 합의 클라이언트는 컨트랙트가 배포된 이후의 *모든* 예치 로그를 내려받아 저장했습니다. 이 때문에 특히 weak subjectivity(체크포인트) 동기화를 사용하는 새 노드가 느려졌고, 실행 노드가 오래된 로그를 정리(prune)하지도 못했습니다. 그러나 예치가 처리되고 확정(finalized)되고 나면, 그 경로에 있는 해시의 대부분은 다시 필요하지 않습니다.\n\nEIP-4881은 트리에서 여전히 중요한 부분만 담은 작은 스냅샷과 이를 가져오는 엔드포인트를 표준화합니다.\n\n## 어떻게 동작하나요?\n\n클라이언트는 내부적으로 트리를 원하는 방식으로 저장해도 되지만, 전송할 때는 다음을 사용해야 합니다.\n\n```python\nclass DepositTreeSnapshot:\n    finalized: List[Hash32, DEPOSIT_CONTRACT_DEPTH]  # roots of fully finalized subtrees\n    deposit_root: Hash32\n    deposit_count: uint64\n    execution_block_hash: Hash32\n    execution_block_height: uint64\n```\n\n- `finalized`는 트리에서 확정된 부분에 대해 완성된 각 왼쪽 서브트리의 루트 해시만 담습니다. 깊이 32인 트리에서는 예치 수와 상관없이 최대 32개의 해시입니다.\n- `deposit_root`, `deposit_count`, `execution_block_hash`는 해당 시점의 비콘 체인 `Eth1Data`와 일치합니다. `execution_block_height`도 포함되어 있어서, 동기화 중인 클라이언트가 아직 동기화되지 않았을 수도 있는 실행 엔진에 물어볼 필요가 없습니다.\n- 수신자는 `finalized`와 `deposit_count`로 루트를 다시 계산해 `deposit_root`와 비교함으로써 스냅샷을 저렴하게 검증할 수 있습니다.\n- 스냅샷 이후의 새 예치는 그 위에 추가되며, 거기서부터 증명을 생성할 수 있습니다.\n\n합의 클라이언트는 Beacon Node API 엔드포인트 `/eth/v1/beacon/deposit_snapshot`에서 스냅샷을 제공합니다. 예치가 확정 조건을 통과하면 클라이언트는 그 아래의 해시를 정리해도 됩니다.\n\n## 샘플 코드\n\n비콘 노드에서 스냅샷 가져오기(TypeScript):\n\n```ts\nconst res = await fetch(`${process.env.BEACON_URL}/eth/v1/beacon/deposit_snapshot`);\nconst { data } = await res.json();\n\nconsole.log(data.deposit_count);            // number of deposits covered\nconsole.log(data.finalized.length);         // at most 32 hashes\nconsole.log(data.execution_block_hash);\n```\n\n스냅샷 검증(스펙의 참조 구현을 바탕으로 함):\n\n```python\ndef calculate_root(snap) -\u003e Hash32:\n    size, index = snap.deposit_count, len(snap.finalized)\n    root = zerohashes[0]\n    for level in range(DEPOSIT_CONTRACT_DEPTH):\n        if size \u0026 1:\n            index -= 1\n            root = sha256(snap.finalized[index] + root)\n        else:\n            root = sha256(root + zerohashes[level])\n        size \u003e\u003e= 1\n    return sha256(root + to_le_bytes(snap.deposit_count))  # mix in the count\n\nassert calculate_root(snap) == snap.deposit_root\n```\n\n## 알아둘 점\n\n- 이는 합의 클라이언트와 노드 운영자를 위한 **Interface** EIP이며, 합의 규칙이나 예치 컨트랙트를 바꾸지 않고 완전히 하위 호환됩니다.\n- 스냅샷은 제공하는 쪽이 주는 신뢰 데이터로, 체크포인트 동기화 상태와 비슷합니다. 신뢰하는 노드에서 가져오고 루트를 확인하세요.\n- 스펙에는 테스트 벡터와 Python 참조 구현이 포함되어 있습니다.\n- [EIP-6110](/eip-6110/)은 이후 예치 전달을 실행 계층으로 옮겼고, 이로써 시간이 지날수록 클라이언트가 기존 `Eth1Data` 예치 흐름에 의존하는 정도가 줄어듭니다.\n"},"zh":{"lang":"zh","tldr":"定义信标链存款 Merkle 树的紧凑快照，并通过标准 Beacon API 端点提供，使新的共识客户端无需重放每一笔历史存款即可重建该树。","tags":["consensus","deposits","beacon-api","sync","staking"],"related":[2982,3675,6110],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-4881/","markdown":"## 它解决什么问题？\n\n每个验证者都是通过向执行层上的存款合约发送 ETH 来加入的。合约维护着所有存款的增量 Merkle 树，信标区块必须为每笔新存款附上针对该树的 Merkle 证明。\n\n为了构建这些证明，大多数共识客户端会下载并存储自合约上线以来的*每一条*存款日志。这拖慢了新节点，尤其是使用弱主观性（检查点）同步的节点，也使执行节点永远无法修剪旧日志。然而，一旦某笔存款已被处理并最终确定，其路径上的大部分哈希就再也不需要了。\n\nEIP-4881 对树中仍然重要的那部分内容的小型快照以及获取它的端点进行了标准化。\n\n## 它如何运作\n\n客户端内部可以随意存储该树，但在传输时必须使用：\n\n```python\nclass DepositTreeSnapshot:\n    finalized: List[Hash32, DEPOSIT_CONTRACT_DEPTH]  # roots of fully finalized subtrees\n    deposit_root: Hash32\n    deposit_count: uint64\n    execution_block_hash: Hash32\n    execution_block_height: uint64\n```\n\n- `finalized` 对于树中已最终确定的部分，只保存每棵完整左子树的根哈希。对于深度为 32 的树，无论存款数量多少，最多只有 32 个哈希。\n- `deposit_root`、`deposit_count` 和 `execution_block_hash` 与信标链在该时间点的 `Eth1Data` 一致。同时还包含 `execution_block_height`，这样正在同步的客户端就不必向可能尚未同步的执行引擎查询。\n- 接收方可以根据 `finalized` 和 `deposit_count` 重新计算根，并与 `deposit_root` 比较，以低成本验证快照。\n- 快照之后的新存款会追加在其上，并可由此生成证明。\n\n共识客户端通过 Beacon Node API 端点 `/eth/v1/beacon/deposit_snapshot` 提供快照。一旦存款满足最终确定条件，客户端就可以修剪其下方的哈希。\n\n## 示例代码\n\n从信标节点获取快照（TypeScript）：\n\n```ts\nconst res = await fetch(`${process.env.BEACON_URL}/eth/v1/beacon/deposit_snapshot`);\nconst { data } = await res.json();\n\nconsole.log(data.deposit_count);            // number of deposits covered\nconsole.log(data.finalized.length);         // at most 32 hashes\nconsole.log(data.execution_block_hash);\n```\n\n验证快照，改编自规范的参考实现：\n\n```python\ndef calculate_root(snap) -\u003e Hash32:\n    size, index = snap.deposit_count, len(snap.finalized)\n    root = zerohashes[0]\n    for level in range(DEPOSIT_CONTRACT_DEPTH):\n        if size \u0026 1:\n            index -= 1\n            root = sha256(snap.finalized[index] + root)\n        else:\n            root = sha256(root + zerohashes[level])\n        size \u003e\u003e= 1\n    return sha256(root + to_le_bytes(snap.deposit_count))  # mix in the count\n\nassert calculate_root(snap) == snap.deposit_root\n```\n\n## 需要注意\n\n- 这是一项面向共识客户端和节点运营者的 **Interface** EIP；它不改变共识规则或存款合约，并且完全向后兼容。\n- 快照是由提供者给出的受信数据，类似于检查点同步的状态。请从你信任的节点获取，并检查根。\n- 规范包含测试向量和 Python 参考实现。\n- [EIP-6110](/eip-6110/) 后来把存款的传递移到了执行层，随着时间推移，这降低了客户端对旧的 `Eth1Data` 存款流程的依赖。\n"}}}
