{"eip":8295,"title":"State Tiering by Periods","description":"Tiered gas pricing for state writes based on renewal age, charging more for write-inactive state.","authors":["Wei Han Ng (@weiihann)","Amirul Ashraf (@asdacap)","Guillaume Ballet (@gballet)","Maria Silva (@misilva73)","Gary Rong (@rjl493456442)","Carlos Perez (@CPerezz)","Jochem Brouwer (@jochem-brouwer)"],"status":"Draft","type":"Standards Track","category":"Core","created":"2026-06-10","requires":[2929,2930,7702,7825,8037,8038,8188],"discussionsTo":"https://ethereum-magicians.org/t/eip-8295-state-tiering-by-periods/28763","repo":"EIPs","label":"EIP-8295","officialUrl":"https://eips.ethereum.org/EIPS/eip-8295","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-8295.md","url":"https://eips.huatuo.xyz/eip-8295/","tldr":{"en":"Charges extra gas to write state that has not been written for a long time, using EIP-8188's last-written block, so long-untouched state carries an ongoing cost without any deletion.","ja":"EIP-8188 の last-written ブロックを使って、長期間書き込まれていない状態への書き込みに追加の gas を課す。長く触れられていない状態は、削除をせずに継続的なコストを負う。","ko":"EIP-8188의 last-written 블록을 사용해, 오랫동안 쓰이지 않은 상태에 쓸 때 추가 gas를 부과한다. 오래 건드리지 않은 상태는 삭제 없이도 지속적인 비용을 진다.","zh":"利用 EIP-8188 的最近写入区块，对写入长期未被写入的状态额外收取 gas，使长期未被触及的状态无需任何删除就要承担持续的成本。"},"tags":["gas","state","state-expiry","repricing","core"],"explainers":{"en":{"lang":"en","tldr":"Charges extra gas to write state that has not been written for a long time, using EIP-8188's last-written block, so long-untouched state carries an ongoing cost without any deletion.","tags":["gas","state","state-expiry","repricing","core"],"related":[8188,8037,8038,2929,7825],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-8295/","markdown":"## What problem does it solve?\n\nToday every write to existing state costs the same, whether the slot was last changed a minute ago or five years ago. In practice they are not the same for a node: recently written state tends to live in the fast \"working set\", while long-untouched state sits on slower database paths with deeper lookups and more write overhead. A flat price overcharges the active set and undercharges reviving old state.\n\nThere is also a fairness issue. Once state is created it lives forever, and node operators pay to store and index it with no ongoing contribution from whoever created it. Clients could track write age locally, but a local heuristic cannot be priced: an attacker could deliberately touch lots of old state to make every node do expensive work.\n\n[EIP-8188](/eip-8188/) adds consensus metadata, `last_written_block`, recording when each account and storage slot was last written. EIP-8295 turns that metadata into a price.\n\n## How it works\n\n- **Periods.** Block numbers are bucketed into coarse periods of `PERIOD_LENGTH` blocks, counted from the fork block. The target duration mentioned in the rationale is about six months; the exact constants are still TBD.\n- **Two tiers.** If `current_period - last_written_period \u003c INACTIVE_MIN_AGE`, an item is **Active**; otherwise it is **Inactive**.\n- **Surcharge, not replacement.** Writing an existing Inactive account adds `INACTIVE_ACCOUNT_WRITE_SURCHARGE`; changing an existing Inactive storage slot adds `INACTIVE_STORAGE_WRITE_SURCHARGE`. Normal gas from [EIP-8038](/eip-8038/) and [EIP-8037](/eip-8037/) still applies. Active writes are not repriced, and **reads are unchanged**.\n- **What gets hit.** `SSTORE` to an existing slot (the slot plus its account, since `storageRoot` changes), value transfers (sender and receiver), nonce bumps, the creator of `CREATE`/`CREATE2`, and the authority in an [EIP-7702](/eip-7702/) authorization.\n- **Creation is exempt.** New accounts, new slots and deployed code are never surcharged; their price comes from EIP-8037. Writing a new slot into a dormant contract still pays the account surcharge.\n- **Once per block.** The tier is checked before the write; the write then refreshes `last_written_block`, so the item becomes Active.\n- The surcharge is ordinary regular gas: non-refundable, still consumed if the frame reverts (and the item stays Inactive), and counted against the [EIP-7825](/eip-7825/) per-transaction cap.\n\nRenewal tiers are separate from [EIP-2929](/eip-2929/) warm/cold. Pre-warming a slot through an access list does not avoid the write surcharge.\n\n## Sample code\n\nTier logic from the spec (constants TBD):\n\n```python\ndef period_of(block_number: int) -\u003e int:\n    return max(0, (block_number - PERIOD_START_BLOCK) // PERIOD_LENGTH)\n\ndef write_surcharge(kind: str, last_written_block: int, block_number: int) -\u003e int:\n    age = period_of(block_number) - period_of(last_written_block)\n    if age \u003c INACTIVE_MIN_AGE:\n        return 0  # Active: no extra cost\n    return (INACTIVE_ACCOUNT_WRITE_SURCHARGE if kind == \"account\"\n            else INACTIVE_STORAGE_WRITE_SURCHARGE)\n\n# SSTORE changing an existing slot of an Inactive contract:\n# normal cost + storage surcharge (slot) + account surcharge (storageRoot cascade)\n```\n\n## Things to know\n\n- **Status: Draft.** `PERIOD_LENGTH`, `INACTIVE_MIN_AGE` and both surcharge values are still TBD, and test cases are not written yet.\n- It needs [EIP-8188](/eip-8188/) (Draft) and must activate at or after the same fork.\n- `eth_estimateGas` implementations must look up each written item's `last_written_block` to estimate correctly. Contracts that rarely write storage may see higher one-off costs after long idle periods.\n- Rewriting state just to keep it Active is intended to cost something; the surcharge size has to balance that against mass speculative refreshes.\n- \"Inactive\" means not *written* recently. A slot read every block can still be Inactive, so clients should not treat the tier as a read-hotness signal.\n"},"ja":{"lang":"ja","tldr":"EIP-8188 の last-written ブロックを使って、長期間書き込まれていない状態への書き込みに追加の gas を課す。長く触れられていない状態は、削除をせずに継続的なコストを負う。","tags":["gas","state","state-expiry","repricing","core"],"related":[8188,8037,8038,2929,7825],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-8295/","markdown":"## 何を解決するのか\n\n現在、既存の状態への書き込みは、スロットが最後に変更されたのが 1 分前でも 5 年前でも、すべて同じコストです。ノードにとっては実際には同じではありません。最近書き込まれた状態は高速な「ワーキングセット」に置かれがちですが、長く触れられていない状態は、より遅いデータベースのパスにあり、探索が深く、書き込みのオーバーヘッドも大きくなります。一律の価格では、アクティブな集合に対して課金が多すぎ、古い状態を復活させることに対しては課金が少なすぎます。\n\n公平性の問題もあります。状態は一度作られると永遠に残り、ノード運営者は、それを作った人からの継続的な負担なしに、保存とインデックス作成のコストを払っています。クライアントは書き込みの経過時間をローカルで追跡できますが、ローカルなヒューリスティックには価格を付けられません。攻撃者が古い状態に大量に意図的に触れて、すべてのノードに高コストな作業をさせることができてしまうからです。\n\n[EIP-8188](/eip-8188/) は、各アカウントとストレージスロットが最後に書き込まれた時期を記録するコンセンサスメタデータ `last_written_block` を追加します。EIP-8295 は、そのメタデータを価格に変えます。\n\n## 仕組み\n\n- **期間。** ブロック番号は、フォークブロックから数えて `PERIOD_LENGTH` ブロックごとの粗い期間に区切られます。根拠の説明にある目標の長さは約 6 か月で、正確な定数はまだ TBD です。\n- **2 つの階層。** `current_period - last_written_period \u003c INACTIVE_MIN_AGE` なら、その項目は **Active** で、そうでなければ **Inactive** です。\n- **置き換えではなく追加料金。** 既存の Inactive なアカウントへの書き込みには `INACTIVE_ACCOUNT_WRITE_SURCHARGE` が加わり、既存の Inactive なストレージスロットの変更には `INACTIVE_STORAGE_WRITE_SURCHARGE` が加わります。[EIP-8038](/eip-8038/) と [EIP-8037](/eip-8037/) の通常の gas は引き続き適用されます。Active な書き込みの価格は変わらず、**読み取りも変わりません**。\n- **対象となるもの。** 既存スロットへの `SSTORE`（`storageRoot` が変わるため、スロットとそのアカウントの両方）、value の送金（送信者と受信者）、nonce の増加、`CREATE`/`CREATE2` の作成者、[EIP-7702](/eip-7702/) の認可における authority。\n- **作成は対象外。** 新しいアカウント、新しいスロット、デプロイされたコードには、追加料金は一切かかりません。それらの価格は EIP-8037 に由来します。休眠中のコントラクトに新しいスロットを書き込む場合でも、アカウントの追加料金は支払います。\n- **ブロックごとに 1 回。** 階層は書き込みの前に確認され、書き込みによって `last_written_block` が更新されるため、その項目は Active になります。\n- 追加料金は通常の regular gas です。返金されず、フレームが revert しても消費され（項目は Inactive のままです）、[EIP-7825](/eip-7825/) のトランザクションごとの上限にもカウントされます。\n\n更新の階層は、[EIP-2929](/eip-2929/) の warm/cold とは別のものです。アクセスリストでスロットを事前にウォームにしても、書き込みの追加料金は避けられません。\n\n## サンプルコード\n\n仕様にある階層のロジック（定数は TBD）:\n\n```python\ndef period_of(block_number: int) -\u003e int:\n    return max(0, (block_number - PERIOD_START_BLOCK) // PERIOD_LENGTH)\n\ndef write_surcharge(kind: str, last_written_block: int, block_number: int) -\u003e int:\n    age = period_of(block_number) - period_of(last_written_block)\n    if age \u003c INACTIVE_MIN_AGE:\n        return 0  # Active: no extra cost\n    return (INACTIVE_ACCOUNT_WRITE_SURCHARGE if kind == \"account\"\n            else INACTIVE_STORAGE_WRITE_SURCHARGE)\n\n# SSTORE changing an existing slot of an Inactive contract:\n# normal cost + storage surcharge (slot) + account surcharge (storageRoot cascade)\n```\n\n## 知っておくべきこと\n\n- **ステータス: Draft。** `PERIOD_LENGTH`、`INACTIVE_MIN_AGE`、両方の追加料金の値はまだ TBD で、テストケースもまだ書かれていません。\n- [EIP-8188](/eip-8188/)（Draft）が必要で、同じフォークかそれ以降に有効化されなければなりません。\n- `eth_estimateGas` の実装は、正しく見積もるために、書き込まれる各項目の `last_written_block` を調べる必要があります。ストレージへの書き込みがまれなコントラクトは、長い休止期間の後に、一度限りのコストが高くなることがあります。\n- 状態を Active に保つためだけに書き直すことには、何らかのコストがかかるよう意図されています。追加料金の大きさは、それと大量の投機的な更新とのバランスを取る必要があります。\n- 「Inactive」は、最近*書き込まれていない*ことを意味します。ブロックごとに読まれるスロットでも Inactive になりえるため、クライアントはこの階層を読み取りの熱さの指標として扱うべきではありません。\n"},"ko":{"lang":"ko","tldr":"EIP-8188의 last-written 블록을 사용해, 오랫동안 쓰이지 않은 상태에 쓸 때 추가 gas를 부과한다. 오래 건드리지 않은 상태는 삭제 없이도 지속적인 비용을 진다.","tags":["gas","state","state-expiry","repricing","core"],"related":[8188,8037,8038,2929,7825],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-8295/","markdown":"## 어떤 문제를 해결하나요?\n\n현재 기존 상태에 쓰는 비용은 슬롯이 마지막으로 바뀐 것이 1분 전이든 5년 전이든 모두 같습니다. 하지만 노드 입장에서는 실제로 같지 않습니다. 최근에 쓰인 상태는 빠른 \"워킹 셋\"에 있는 경향이 있고, 오래 건드리지 않은 상태는 더 느린 데이터베이스 경로에서 더 깊은 조회와 더 큰 쓰기 오버헤드를 동반합니다. 단일 가격은 활성 집합에는 과하게 부과하고 오래된 상태를 되살리는 데는 덜 부과합니다.\n\n공정성 문제도 있습니다. 상태는 한 번 만들어지면 영원히 남고, 노드 운영자는 그것을 만든 사람의 지속적인 기여 없이 저장과 인덱싱 비용을 부담합니다. 클라이언트가 쓰기 경과 시간을 로컬에서 추적할 수는 있지만, 로컬 휴리스틱에는 가격을 매길 수 없습니다. 공격자가 오래된 상태를 대량으로 일부러 건드려 모든 노드가 비싼 작업을 하게 만들 수 있기 때문입니다.\n\n[EIP-8188](/eip-8188/)은 각 계정과 스토리지 슬롯이 마지막으로 쓰인 시점을 기록하는 컨센서스 메타데이터 `last_written_block`을 추가합니다. EIP-8295는 그 메타데이터를 가격으로 바꿉니다.\n\n## 어떻게 동작하나요?\n\n- **기간.** 블록 번호는 포크 블록부터 센 `PERIOD_LENGTH` 블록 단위의 큰 기간으로 묶입니다. 근거 설명에 언급된 목표 기간은 약 6개월이며, 정확한 상수는 아직 TBD입니다.\n- **두 단계.** `current_period - last_written_period \u003c INACTIVE_MIN_AGE`이면 해당 항목은 **Active**이고, 아니면 **Inactive**입니다.\n- **대체가 아닌 추가 요금.** 기존 Inactive 계정에 쓰면 `INACTIVE_ACCOUNT_WRITE_SURCHARGE`가 추가되고, 기존 Inactive 스토리지 슬롯을 바꾸면 `INACTIVE_STORAGE_WRITE_SURCHARGE`가 추가됩니다. [EIP-8038](/eip-8038/)과 [EIP-8037](/eip-8037/)의 일반 gas는 그대로 적용됩니다. Active 쓰기는 가격이 바뀌지 않으며 **읽기도 그대로입니다**.\n- **대상이 되는 것.** 기존 슬롯에 대한 `SSTORE`(`storageRoot`가 바뀌므로 슬롯과 그 계정 모두), value 전송(송신자와 수신자), nonce 증가, `CREATE`/`CREATE2`의 생성자, [EIP-7702](/eip-7702/) 인가의 authority.\n- **생성은 면제.** 새 계정, 새 슬롯, 배포된 코드에는 추가 요금이 붙지 않으며, 그 가격은 EIP-8037에서 나옵니다. 휴면 컨트랙트에 새 슬롯을 쓰면 계정 추가 요금은 여전히 냅니다.\n- **블록당 한 번.** 단계는 쓰기 전에 확인되고, 쓰기가 `last_written_block`을 갱신하므로 그 항목은 Active가 됩니다.\n- 추가 요금은 일반 regular gas입니다. 환불되지 않고, 프레임이 revert되어도 소비되며(항목은 Inactive로 남음), [EIP-7825](/eip-7825/)의 트랜잭션당 상한에도 포함됩니다.\n\n갱신 단계는 [EIP-2929](/eip-2929/)의 warm/cold와는 별개입니다. 액세스 리스트로 슬롯을 미리 warm하게 만들어도 쓰기 추가 요금은 피할 수 없습니다.\n\n## 샘플 코드\n\n사양에 있는 단계 로직(상수는 TBD):\n\n```python\ndef period_of(block_number: int) -\u003e int:\n    return max(0, (block_number - PERIOD_START_BLOCK) // PERIOD_LENGTH)\n\ndef write_surcharge(kind: str, last_written_block: int, block_number: int) -\u003e int:\n    age = period_of(block_number) - period_of(last_written_block)\n    if age \u003c INACTIVE_MIN_AGE:\n        return 0  # Active: no extra cost\n    return (INACTIVE_ACCOUNT_WRITE_SURCHARGE if kind == \"account\"\n            else INACTIVE_STORAGE_WRITE_SURCHARGE)\n\n# SSTORE changing an existing slot of an Inactive contract:\n# normal cost + storage surcharge (slot) + account surcharge (storageRoot cascade)\n```\n\n## 알아둘 점\n\n- **상태: Draft.** `PERIOD_LENGTH`, `INACTIVE_MIN_AGE`, 두 추가 요금 값은 아직 TBD이고 테스트 케이스도 아직 작성되지 않았습니다.\n- [EIP-8188](/eip-8188/)(Draft)이 필요하며 같은 포크 또는 그 이후에 활성화되어야 합니다.\n- `eth_estimateGas` 구현은 정확히 추정하려면 쓰이는 각 항목의 `last_written_block`을 조회해야 합니다. 스토리지에 거의 쓰지 않는 컨트랙트는 오랜 휴지기 뒤에 일회성 비용이 더 높아질 수 있습니다.\n- 상태를 Active로 유지하려고 다시 쓰는 것에는 어느 정도 비용이 들도록 의도되었습니다. 추가 요금의 크기는 그것과 대량의 투기적 갱신 사이에서 균형을 맞춰야 합니다.\n- \"Inactive\"는 최근 *쓰이지* 않았다는 뜻입니다. 블록마다 읽히는 슬롯도 Inactive일 수 있으므로, 클라이언트는 이 단계를 읽기 핫니스 신호로 취급해서는 안 됩니다.\n"},"zh":{"lang":"zh","tldr":"利用 EIP-8188 的最近写入区块，对写入长期未被写入的状态额外收取 gas，使长期未被触及的状态无需任何删除就要承担持续的成本。","tags":["gas","state","state-expiry","repricing","core"],"related":[8188,8037,8038,2929,7825],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-8295/","markdown":"## 它解决什么问题？\n\n如今，对已有状态的每次写入成本都相同，无论该存储槽上次被修改是在一分钟前还是五年前。但对节点来说，它们其实并不相同：最近写入的状态往往位于快速的\"工作集\"中，而长期未被触及的状态则在更慢的数据库路径上，查找更深、写入开销更大。统一定价会对活跃集合收费过高，而对唤醒旧状态收费过低。\n\n还有公平性问题。状态一旦创建就永远存在，节点运营者为存储和索引它付出成本，而创建者并没有持续的贡献。客户端可以在本地跟踪写入的年龄，但本地启发式无法定价：攻击者可以故意触碰大量旧状态，迫使每个节点做昂贵的工作。\n\n[EIP-8188](/eip-8188/) 增加了共识元数据 `last_written_block`，记录每个账户和存储槽最后一次被写入的时间。EIP-8295 把这份元数据变成价格。\n\n## 它如何运作\n\n- **周期。** 区块号被划分为粗粒度的周期，每个周期 `PERIOD_LENGTH` 个区块，从分叉区块开始计数。设计理由中提到的目标时长约为六个月；确切的常量仍待确定。\n- **两个层级。** 如果 `current_period - last_written_period \u003c INACTIVE_MIN_AGE`，则该项为 **Active**；否则为 **Inactive**。\n- **附加费，而非替换。** 写入已有的 Inactive 账户会增加 `INACTIVE_ACCOUNT_WRITE_SURCHARGE`；修改已有的 Inactive 存储槽会增加 `INACTIVE_STORAGE_WRITE_SURCHARGE`。[EIP-8038](/eip-8038/) 和 [EIP-8037](/eip-8037/) 的常规 gas 仍然适用。Active 的写入不重新定价，**读取也不变**。\n- **哪些操作会被收费。** 对已有存储槽的 `SSTORE`（因 `storageRoot` 变化，包括该存储槽及其账户）、价值转账（发送方和接收方）、nonce 递增、`CREATE`/`CREATE2` 的创建者，以及 [EIP-7702](/eip-7702/) 授权中的 authority。\n- **创建免征。** 新账户、新存储槽和已部署的代码从不收取附加费；它们的价格来自 EIP-8037。向休眠合约写入新存储槽时，仍需支付账户附加费。\n- **每个区块一次。** 在写入之前检查层级；写入随后会刷新 `last_written_block`，因此该项变为 Active。\n- 附加费是普通的常规 gas：不可退还，即使 frame 回滚也仍会被消耗（该项仍保持 Inactive），并计入 [EIP-7825](/eip-7825/) 的单笔交易上限。\n\n续期层级与 [EIP-2929](/eip-2929/) 的 warm/cold 是分开的。通过访问列表预热某个存储槽，并不能避免写入附加费。\n\n## 示例代码\n\n规范中的层级逻辑（常量待定）：\n\n```python\ndef period_of(block_number: int) -\u003e int:\n    return max(0, (block_number - PERIOD_START_BLOCK) // PERIOD_LENGTH)\n\ndef write_surcharge(kind: str, last_written_block: int, block_number: int) -\u003e int:\n    age = period_of(block_number) - period_of(last_written_block)\n    if age \u003c INACTIVE_MIN_AGE:\n        return 0  # Active: no extra cost\n    return (INACTIVE_ACCOUNT_WRITE_SURCHARGE if kind == \"account\"\n            else INACTIVE_STORAGE_WRITE_SURCHARGE)\n\n# SSTORE changing an existing slot of an Inactive contract:\n# normal cost + storage surcharge (slot) + account surcharge (storageRoot cascade)\n```\n\n## 需要注意\n\n- **状态：Draft。** `PERIOD_LENGTH`、`INACTIVE_MIN_AGE` 以及两个附加费的数值仍待确定，测试用例也尚未编写。\n- 它需要 [EIP-8188](/eip-8188/)（Draft），并且必须在同一次分叉或之后激活。\n- `eth_estimateGas` 的实现必须查找每个被写入项的 `last_written_block` 才能正确估算。很少写入存储的合约在长期闲置之后，可能会遇到更高的一次性成本。\n- 仅仅为了保持 Active 而重写状态，本就是要付出一定代价的；附加费的大小必须在此与大规模的投机性刷新之间取得平衡。\n- \"Inactive\"的意思是最近没有被*写入*。每个区块都被读取的存储槽仍可能是 Inactive，因此客户端不应把该层级当作读取热度的信号。\n"}}}
