{"eip":6873,"title":"Preimage retention","description":"Execution clients must retain the preimages of addresses and slots accessed between the fork preceding the verge, and the verge itself.","authors":["Guillaume Ballet (@gballet)"],"status":"Stagnant","type":"Standards Track","category":"Core","created":"2023-04-14","discussionsTo":"https://ethereum-magicians.org/t/eip-6873-preimage-retention-in-the-fork-preceding-the-verge/15830","repo":"EIPs","label":"EIP-6873","officialUrl":"https://eips.ethereum.org/EIPS/eip-6873","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-6873.md","url":"https://eips.huatuo.xyz/eip-6873/","tldr":{"en":"A stagnant proposal requiring every execution client to record the preimages of hashed addresses and storage slots in the fork before the Verkle transition, so each node can convert its own state to the new tree.","ja":"Verkle 移行の前のフォークで、すべての実行クライアントにハッシュ化されたアドレスとストレージスロットのプリイメージの記録を義務づける停滞中の提案。各ノードが自身のステートを新しいツリーへ変換できるようにする。","ko":"Verkle 전환 이전의 포크에서 모든 실행 클라이언트가 해시된 주소와 스토리지 슬롯의 프리이미지를 기록하도록 요구하는 정체된 제안. 각 노드가 자신의 상태를 새 트리로 변환할 수 있게 한다.","zh":"一项已停滞的提案：要求所有执行客户端在 Verkle 过渡之前的分叉中记录已哈希地址和存储槽的原像，使每个节点都能将自己的状态转换到新树。"},"tags":["verkle","state","preimages","execution-client","core"],"explainers":{"en":{"lang":"en","tldr":"A stagnant proposal requiring every execution client to record the preimages of hashed addresses and storage slots in the fork before the Verkle transition, so each node can convert its own state to the new tree.","tags":["verkle","state","preimages","execution-client","core"],"related":[6800,7612,7748],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-6873/","markdown":"## What problem does it solve?\n\nEthereum's current state trie stores accounts and storage slots under **hashed** keys (`keccak256(address)`, `keccak256(slot)`). Most execution clients keep only those hashes, not the original values, called preimages.\n\nMoving to Verkle trees (\"the Verge\") changes how keys are derived, so every key must be recomputed from the original address and slot. A node that only has hashes cannot do that. The spec notes that on mainnet the preimages already took about 70 GB when it was written.\n\nTwo ways to get them were considered:\n\n- re-sync from scratch with preimage recording on. That takes a machine offline for days, which cannot be forced on the whole network at once;\n- download a preimage file. That is practical, but the file is immediately out of date, because new addresses and slots are touched every block, and a 70 GB download takes far longer than a slot.\n\nEIP-6873 closes the gap: download the history up to a point, and have every node record new preimages itself during the period before the switch.\n\n## How it works\n\nLet `T_p` be the timestamp of the fork **before** the Verge and `T_v` the timestamp of the Verge fork.\n\n- Execution clients **must** save the preimage of every address hash and storage-slot hash they produce while executing blocks between `T_p` and `T_v`.\n- They **may** also store preimages outside that window.\n- Given a hash produced in the window, a client **should** be able to show it has the preimage.\n- Clients **should** be able to download preimages for hashes produced before `T_v` from a publicly available datastore.\n\nCombined, a node has every preimage it needs on Verge day without a full resync. This matters if each node does its own state conversion, as in the overlay-tree approach of [EIP-7612](/eip-7612/).\n\n## Sample code\n\nWhat \"retaining a preimage\" means, as pseudocode inside block execution:\n\n```python\ndef hashed_key(preimage_db, raw: bytes, block_ts: int) -\u003e bytes:\n    h = keccak256(raw)                        # address (20 bytes) or slot (32 bytes)\n    if T_P \u003c= block_ts \u003c T_V:                 # mandatory window\n        preimage_db.put(h, raw)\n    return h\n\ndef account_key(db, address, ts):        return hashed_key(db, address, ts)\ndef storage_key(db, slot: bytes, ts):    return hashed_key(db, slot, ts)\n```\n\nClients already offer this as an option. For example, in Geth:\n\n```bash\ngeth --cache.preimages   # record keccak preimages of trie keys\n```\n\n## Things to know\n\n- **Status: Stagnant.** The fork timestamps were never set, and the Verkle migration itself ([EIP-6800](/eip-6800/), [EIP-7612](/eip-7612/)) has not been scheduled. See [EIP-7748](/eip-7748/) for a later state-conversion proposal.\n- The spec says all clients already implement preimage retention at least as an option, so the change is mainly about making it mandatory for a defined window.\n- Expect extra disk usage on every node during the window.\n- Security Considerations are marked \"Needs discussion\".\n"},"ja":{"lang":"ja","tldr":"Verkle 移行の前のフォークで、すべての実行クライアントにハッシュ化されたアドレスとストレージスロットのプリイメージの記録を義務づける停滞中の提案。各ノードが自身のステートを新しいツリーへ変換できるようにする。","tags":["verkle","state","preimages","execution-client","core"],"related":[6800,7612,7748],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-6873/","markdown":"## 何を解決するのか\n\nEthereum の現在のステートトライは、アカウントとストレージスロットを**ハッシュ化された**キー（`keccak256(address)`、`keccak256(slot)`）で保存しています。ほとんどの実行クライアントはそのハッシュしか保持しておらず、元の値、つまりプリイメージは持っていません。\n\nVerkle ツリー（「the Verge」）への移行ではキーの導出方法が変わるため、すべてのキーを元のアドレスとスロットから再計算する必要があります。ハッシュしか持たないノードにはそれができません。仕様には、執筆時点でメインネットのプリイメージがすでに約 70 GB に達していたと記されています。\n\n入手方法として 2 つが検討されました。\n\n- プリイメージ記録を有効にして最初から再同期する。マシンが数日間オフラインになるため、ネットワーク全体に一度に強制することはできません。\n- プリイメージのファイルをダウンロードする。現実的ですが、新しいアドレスとスロットが毎ブロックで触れられるため、ファイルはすぐに古くなります。しかも 70 GB のダウンロードは 1 スロットよりはるかに長くかかります。\n\nEIP-6873 はこの隙間を埋めます。ある時点までの履歴をダウンロードし、切り替え前の期間中は、すべてのノードが自分で新しいプリイメージを記録します。\n\n## 仕組み\n\n`T_p` を Verge の**前**のフォークのタイムスタンプ、`T_v` を Verge フォークのタイムスタンプとします。\n\n- 実行クライアントは、`T_p` から `T_v` の間のブロックを実行する際に生成するすべてのアドレスハッシュとストレージスロットハッシュのプリイメージを保存**しなければなりません**（must）。\n- その期間外でもプリイメージを保存してもかまいません（may）。\n- その期間内に生成されたハッシュについて、クライアントはプリイメージを持っていることを示せる**べきです**（should）。\n- クライアントは、`T_v` より前に生成されたハッシュのプリイメージを、公開されているデータストアからダウンロードできる**べきです**（should）。\n\nこれらを組み合わせると、ノードは完全な再同期なしに、Verge の当日に必要なすべてのプリイメージを持てます。これは、[EIP-7612](/eip-7612/) のオーバーレイツリー方式のように、各ノードが自分でステート変換を行う場合に重要です。\n\n## サンプルコード\n\n「プリイメージを保持する」とはどういうことかを、ブロック実行内の疑似コードで示します。\n\n```python\ndef hashed_key(preimage_db, raw: bytes, block_ts: int) -\u003e bytes:\n    h = keccak256(raw)                        # address (20 bytes) or slot (32 bytes)\n    if T_P \u003c= block_ts \u003c T_V:                 # mandatory window\n        preimage_db.put(h, raw)\n    return h\n\ndef account_key(db, address, ts):        return hashed_key(db, address, ts)\ndef storage_key(db, slot: bytes, ts):    return hashed_key(db, slot, ts)\n```\n\nクライアントはすでにこれをオプションとして提供しています。たとえば Geth では次のとおりです。\n\n```bash\ngeth --cache.preimages   # record keccak preimages of trie keys\n```\n\n## 知っておくべきこと\n\n- **ステータス: Stagnant。** フォークのタイムスタンプは設定されておらず、Verkle 移行そのもの（[EIP-6800](/eip-6800/)、[EIP-7612](/eip-7612/)）もスケジュールされていません。その後のステート変換の提案については [EIP-7748](/eip-7748/) を参照してください。\n- 仕様によれば、すべてのクライアントがすでに少なくともオプションとしてプリイメージの保持を実装しているため、この変更は主に、定められた期間についてそれを必須にするものです。\n- その期間中は、すべてのノードでディスク使用量が増えることを想定してください。\n- Security Considerations は「Needs discussion」とされています。\n"},"ko":{"lang":"ko","tldr":"Verkle 전환 이전의 포크에서 모든 실행 클라이언트가 해시된 주소와 스토리지 슬롯의 프리이미지를 기록하도록 요구하는 정체된 제안. 각 노드가 자신의 상태를 새 트리로 변환할 수 있게 한다.","tags":["verkle","state","preimages","execution-client","core"],"related":[6800,7612,7748],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-6873/","markdown":"## 어떤 문제를 해결하나요?\n\n이더리움의 현재 상태 트라이는 계정과 스토리지 슬롯을 **해시된** 키(`keccak256(address)`, `keccak256(slot)`)로 저장합니다. 대부분의 실행 클라이언트는 그 해시만 보관하고, 원래 값인 프리이미지(preimage)는 보관하지 않습니다.\n\nVerkle 트리(\"the Verge\")로 옮기면 키를 도출하는 방식이 바뀌므로, 모든 키를 원래 주소와 슬롯으로부터 다시 계산해야 합니다. 해시만 가진 노드는 이를 할 수 없습니다. 명세는 작성 당시 메인넷의 프리이미지가 이미 약 70 GB에 달했다고 밝힙니다.\n\n이를 확보하는 방법으로 두 가지가 검토되었습니다.\n\n- 프리이미지 기록을 켠 채로 처음부터 다시 동기화한다. 머신이 며칠간 오프라인이 되므로 전체 네트워크에 한꺼번에 강제할 수 없습니다.\n- 프리이미지 파일을 다운로드한다. 현실적이지만 블록마다 새 주소와 슬롯이 건드려지기 때문에 파일이 곧바로 낡아 버리고, 70 GB를 내려받는 데는 한 슬롯보다 훨씬 오래 걸립니다.\n\nEIP-6873은 이 간극을 메웁니다. 특정 시점까지의 이력은 다운로드하고, 전환 이전 기간 동안에는 모든 노드가 새 프리이미지를 직접 기록합니다.\n\n## 어떻게 동작하나요?\n\n`T_p`를 Verge **직전** 포크의 타임스탬프, `T_v`를 Verge 포크의 타임스탬프라고 하겠습니다.\n\n- 실행 클라이언트는 `T_p`와 `T_v` 사이의 블록을 실행하면서 생성하는 모든 주소 해시와 스토리지 슬롯 해시의 프리이미지를 저장**해야 합니다**(must).\n- 그 구간 밖에서도 프리이미지를 저장**할 수 있습니다**(may).\n- 그 구간에서 생성된 해시에 대해 클라이언트는 프리이미지를 가지고 있음을 보여 줄 수 **있어야 합니다**(should).\n- 클라이언트는 `T_v` 이전에 생성된 해시의 프리이미지를 공개된 데이터 저장소에서 다운로드할 수 **있어야 합니다**(should).\n\n이를 결합하면 노드는 전체 재동기화 없이도 Verge 당일에 필요한 모든 프리이미지를 갖게 됩니다. [EIP-7612](/eip-7612/)의 오버레이 트리 방식처럼 각 노드가 스스로 상태 변환을 수행하는 경우에 중요합니다.\n\n## 샘플 코드\n\n\"프리이미지를 보관한다\"는 것이 무엇인지, 블록 실행 내부의 의사 코드로 보여 줍니다.\n\n```python\ndef hashed_key(preimage_db, raw: bytes, block_ts: int) -\u003e bytes:\n    h = keccak256(raw)                        # address (20 bytes) or slot (32 bytes)\n    if T_P \u003c= block_ts \u003c T_V:                 # mandatory window\n        preimage_db.put(h, raw)\n    return h\n\ndef account_key(db, address, ts):        return hashed_key(db, address, ts)\ndef storage_key(db, slot: bytes, ts):    return hashed_key(db, slot, ts)\n```\n\n클라이언트는 이미 이를 옵션으로 제공합니다. 예를 들어 Geth에서는 다음과 같습니다.\n\n```bash\ngeth --cache.preimages   # record keccak preimages of trie keys\n```\n\n## 알아둘 점\n\n- **상태: Stagnant.** 포크 타임스탬프는 정해진 적이 없고, Verkle 마이그레이션 자체([EIP-6800](/eip-6800/), [EIP-7612](/eip-7612/))도 일정이 잡히지 않았습니다. 이후의 상태 변환 제안은 [EIP-7748](/eip-7748/)을 참고하세요.\n- 명세는 모든 클라이언트가 이미 적어도 옵션으로 프리이미지 보관을 구현하고 있다고 하므로, 이 변경은 주로 정해진 구간 동안 이를 의무로 만드는 것입니다.\n- 그 구간 동안 모든 노드에서 디스크 사용량이 늘어날 것으로 예상하세요.\n- Security Considerations는 \"Needs discussion\"으로 표시되어 있습니다.\n"},"zh":{"lang":"zh","tldr":"一项已停滞的提案：要求所有执行客户端在 Verkle 过渡之前的分叉中记录已哈希地址和存储槽的原像，使每个节点都能将自己的状态转换到新树。","tags":["verkle","state","preimages","execution-client","core"],"related":[6800,7612,7748],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-6873/","markdown":"## 它解决什么问题？\n\n以太坊当前的状态树以**哈希后的**键存储账户和存储槽（`keccak256(address)`、`keccak256(slot)`）。大多数执行客户端只保留这些哈希，而不保留原始值，即原像（preimage）。\n\n迁移到 Verkle 树（\"the Verge\"）会改变键的派生方式，因此每个键都必须由原始地址和槽重新计算。只有哈希的节点无法做到这一点。规范指出，在撰写时主网的原像已经占用约 70 GB。\n\n曾考虑过两种获取方式：\n\n- 开启原像记录后从头重新同步。这会让机器离线数天，无法一次性强制整个网络这样做；\n- 下载原像文件。这是可行的，但文件立即就会过时，因为每个区块都会触及新的地址和槽，而且下载 70 GB 所需的时间远超一个 slot。\n\nEIP-6873 弥合了这一缺口：下载截至某一时间点的历史数据，并让每个节点在切换前的这段时间内自行记录新的原像。\n\n## 它如何运作\n\n设 `T_p` 为 Verge **之前**那次分叉的时间戳，`T_v` 为 Verge 分叉的时间戳。\n\n- 执行客户端**必须**（must）保存在 `T_p` 与 `T_v` 之间执行区块时产生的每个地址哈希和存储槽哈希的原像。\n- 它们**可以**（may）在该窗口之外也存储原像。\n- 对于在该窗口内产生的哈希，客户端**应当**（should）能够证明自己持有其原像。\n- 客户端**应当**（should）能够从公开可用的数据存储下载 `T_v` 之前产生的哈希的原像。\n\n综合起来，节点在 Verge 当天就拥有所需的全部原像，无需完整重新同步。如果每个节点各自进行状态转换，例如 [EIP-7612](/eip-7612/) 的叠加树（overlay tree）方案，这一点就很重要。\n\n## 示例代码\n\n\"保留原像\"的含义，以区块执行过程中的伪代码表示：\n\n```python\ndef hashed_key(preimage_db, raw: bytes, block_ts: int) -\u003e bytes:\n    h = keccak256(raw)                        # address (20 bytes) or slot (32 bytes)\n    if T_P \u003c= block_ts \u003c T_V:                 # mandatory window\n        preimage_db.put(h, raw)\n    return h\n\ndef account_key(db, address, ts):        return hashed_key(db, address, ts)\ndef storage_key(db, slot: bytes, ts):    return hashed_key(db, slot, ts)\n```\n\n客户端已经将此作为选项提供。例如在 Geth 中：\n\n```bash\ngeth --cache.preimages   # record keccak preimages of trie keys\n```\n\n## 需要注意\n\n- **状态：Stagnant。** 分叉时间戳从未设定，Verkle 迁移本身（[EIP-6800](/eip-6800/)、[EIP-7612](/eip-7612/)）也尚未排期。后来提出的状态转换方案见 [EIP-7748](/eip-7748/)。\n- 规范称所有客户端至少已将原像保留作为一个选项来实现，因此这项变更主要是在规定的窗口内将其变为强制要求。\n- 预计在该窗口期间每个节点的磁盘占用都会增加。\n- Security Considerations 标记为 \"Needs discussion\"。\n"}}}
