{"eip":5022,"title":"Increase price of SSTORE from zero to non-zero to 40k gas","description":"Increase the price of the SSTORE opcode from 20000 gas to 40000 gas when the original slot is zero and the resultant slot is non-zero.","authors":["Green (@greenlucid)"],"status":"Stagnant","type":"Standards Track","category":"Core","created":"2022-04-20","discussionsTo":"https://ethereum-magicians.org/t/eip-proposal-increase-cost-of-sstore-from-20k-to-x-when-creating-new-storage/7614","repo":"EIPs","label":"EIP-5022","officialUrl":"https://eips.ethereum.org/EIPS/eip-5022","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-5022.md","url":"https://eips.huatuo.xyz/eip-5022/","tldr":{"en":"Proposed doubling the gas cost of SSTORE when it creates a new storage slot (zero to non-zero) from 20,000 to 40,000, to price state growth more honestly.","ja":"状態の増大をより正直に価格づけするため、新しいストレージスロットを作る SSTORE（ゼロから非ゼロ）のガスコストを 20,000 から 40,000 へ 2 倍にする提案。","ko":"상태 증가를 더 정직하게 가격에 반영하기 위해, 새 스토리지 슬롯을 만드는 SSTORE(0에서 0이 아닌 값)의 가스 비용을 20,000에서 40,000으로 두 배로 올리자는 제안.","zh":"提议将 SSTORE 创建新存储槽（从零变为非零）时的 gas 成本从 20,000 翻倍到 40,000，以更真实地为状态增长定价。"},"tags":["gas","sstore","state-growth","core"],"explainers":{"en":{"lang":"en","tldr":"Proposed doubling the gas cost of SSTORE when it creates a new storage slot (zero to non-zero) from 20,000 to 40,000, to price state growth more honestly.","tags":["gas","sstore","state-growth","core"],"related":[2200,2929,3529],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-5022/","markdown":"## What problem does it solve?\n\nEvery new storage slot permanently grows Ethereum's state, which all full nodes must keep. As state grows, each new slot makes nodes slower and more expensive to run. Yet the price of creating a slot has been fixed at 20,000 gas.\n\nThe author argues this is underpriced: because all resources share one gas limit, users of every other opcode are effectively subsidizing state creation. State growth is also one of the main reasons the gas limit is not raised. Pricing new storage more accurately would make a higher gas limit more feasible.\n\n## How it works\n\nOne change to the gas schedule from a fork block (the spec leaves it `TBD`):\n\n| Case | Before | After |\n| --- | --- | --- |\n| `SSTORE` zero to non-zero (`SSTORE_SET_GAS`) | 20,000 | **40,000** |\n| All other `SSTORE` cases | unchanged | unchanged |\n\nThings deliberately not changed:\n\n- **Non-zero to non-zero** writes: they do not grow state, so they stay the same. A higher creation price also nudges developers to reuse slots.\n- **Refunds for clearing a slot**: left open for more discussion.\n\nThe spec presents this as a short-term patch while longer-term ideas such as state rent or state expiry are researched.\n\n## Sample code\n\nWhere the change would show up in a contract: the first write to a mapping entry creates a slot.\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ncontract Registry {\n    mapping(address =\u003e uint256) public score;\n\n    function set(uint256 v) external {\n        // First write for msg.sender: zero -\u003e non-zero.\n        //   Today: SSTORE_SET_GAS = 20,000 (plus cold-access cost).\n        //   Under EIP-5022: 40,000.\n        // Later writes (non-zero -\u003e non-zero) are unaffected.\n        score[msg.sender] = v;\n    }\n}\n```\n\n## Things to know\n\n- Status is **Stagnant**: the change was not adopted.\n- The spec acknowledges it would severely raise costs for many applications, and contracts with hard-coded gas amounts that create storage would break.\n- The full `SSTORE` cost also depends on net gas metering ([EIP-2200](/eip-2200/)), cold/warm access ([EIP-2929](/eip-2929/)) and refund rules ([EIP-3529](/eip-3529/)); this EIP only touches the slot-creation constant.\n- The spec's security considerations section is empty (`TODO`).\n"},"ja":{"lang":"ja","tldr":"状態の増大をより正直に価格づけするため、新しいストレージスロットを作る SSTORE（ゼロから非ゼロ）のガスコストを 20,000 から 40,000 へ 2 倍にする提案。","tags":["gas","sstore","state-growth","core"],"related":[2200,2929,3529],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-5022/","markdown":"## 何を解決するのか\n\n新しいストレージスロットはどれも Ethereum のステートを恒久的に増やし、すべてのフルノードがそれを保持しなければなりません。ステートが大きくなるほど、新しいスロットごとにノードの動作は遅くなり、運用コストは高くなります。それでもスロット作成の価格は 20,000 ガスに固定されたままです。\n\n著者は、これは安すぎると主張します。すべてのリソースが 1 つのガスリミットを共有しているため、他のあらゆる opcode の利用者が事実上ステート作成を補助していることになります。ステートの増大は、ガスリミットが引き上げられない主な理由の 1 つでもあります。新しいストレージをより正確に価格づけすれば、より高いガスリミットが実現しやすくなります。\n\n## 仕組み\n\nあるフォークブロックから、ガススケジュールに 1 つの変更が加わります（仕様ではこれを `TBD` のままにしています）。\n\n| ケース | 変更前 | 変更後 |\n| --- | --- | --- |\n| `SSTORE` ゼロから非ゼロ（`SSTORE_SET_GAS`） | 20,000 | **40,000** |\n| その他すべての `SSTORE` のケース | 変更なし | 変更なし |\n\n意図的に変更されないもの:\n\n- **非ゼロから非ゼロ**への書き込み: ステートを増やさないため、そのままです。作成価格が高くなることで、開発者にスロットの再利用を促す効果もあります。\n- **スロットをクリアしたときの返金**: さらなる議論のために保留されています。\n\n仕様はこれを短期的なパッチとして提示しており、ステートレントやステート期限切れのような長期的なアイデアは研究が続いています。\n\n## サンプルコード\n\nこの変更がコントラクトのどこに現れるか: マッピングのエントリへの最初の書き込みがスロットを作ります。\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ncontract Registry {\n    mapping(address =\u003e uint256) public score;\n\n    function set(uint256 v) external {\n        // First write for msg.sender: zero -\u003e non-zero.\n        //   Today: SSTORE_SET_GAS = 20,000 (plus cold-access cost).\n        //   Under EIP-5022: 40,000.\n        // Later writes (non-zero -\u003e non-zero) are unaffected.\n        score[msg.sender] = v;\n    }\n}\n```\n\n## 知っておくべきこと\n\n- ステータスは **Stagnant** です。この変更は採用されませんでした。\n- 仕様は、多くのアプリケーションのコストが大幅に上がり、ストレージを作成するコントラクトでガス量をハードコードしているものは動かなくなることを認めています。\n- `SSTORE` の完全なコストは、ネットガスメータリング（[EIP-2200](/eip-2200/)）、cold/warm アクセス（[EIP-2929](/eip-2929/)）、返金ルール（[EIP-3529](/eip-3529/)）にも依存します。この EIP はスロット作成の定数だけを変更します。\n- 仕様のセキュリティ上の考慮事項のセクションは空です（`TODO`）。\n"},"ko":{"lang":"ko","tldr":"상태 증가를 더 정직하게 가격에 반영하기 위해, 새 스토리지 슬롯을 만드는 SSTORE(0에서 0이 아닌 값)의 가스 비용을 20,000에서 40,000으로 두 배로 올리자는 제안.","tags":["gas","sstore","state-growth","core"],"related":[2200,2929,3529],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-5022/","markdown":"## 어떤 문제를 해결하나요?\n\n새 스토리지 슬롯은 모두 이더리움의 상태를 영구적으로 키우며, 모든 풀 노드가 이를 보관해야 합니다. 상태가 커질수록 새 슬롯 하나하나가 노드를 더 느리고 운영 비용이 비싸게 만듭니다. 그럼에도 슬롯 생성 가격은 20,000 가스로 고정되어 있었습니다.\n\n저자는 이것이 저평가되어 있다고 주장합니다. 모든 자원이 하나의 가스 한도를 공유하기 때문에, 다른 모든 opcode의 사용자가 사실상 상태 생성을 보조하고 있다는 것입니다. 상태 증가는 가스 한도를 올리지 못하는 주된 이유 중 하나이기도 합니다. 새 스토리지를 더 정확하게 가격에 반영하면 더 높은 가스 한도가 현실적으로 가능해집니다.\n\n## 어떻게 동작하나요?\n\n특정 포크 블록부터 가스 스케줄이 한 가지 바뀝니다(명세는 이를 `TBD`로 남겨 두었습니다).\n\n| 경우 | 이전 | 이후 |\n| --- | --- | --- |\n| `SSTORE` 0에서 0이 아닌 값 (`SSTORE_SET_GAS`) | 20,000 | **40,000** |\n| 그 외 모든 `SSTORE` 경우 | 변경 없음 | 변경 없음 |\n\n의도적으로 바꾸지 않은 것:\n\n- **0이 아닌 값에서 0이 아닌 값**으로의 쓰기: 상태를 늘리지 않으므로 그대로입니다. 생성 가격이 높아지면 개발자가 슬롯을 재사용하도록 유도하는 효과도 있습니다.\n- **슬롯을 비울 때의 환불**: 추가 논의를 위해 열어 두었습니다.\n\n명세는 이를 단기 패치로 제시하며, 상태 임대료(state rent)나 상태 만료(state expiry) 같은 장기 아이디어는 계속 연구되고 있습니다.\n\n## 샘플 코드\n\n이 변경이 컨트랙트에서 드러나는 곳: 매핑 항목에 처음 쓰면 슬롯이 만들어집니다.\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ncontract Registry {\n    mapping(address =\u003e uint256) public score;\n\n    function set(uint256 v) external {\n        // First write for msg.sender: zero -\u003e non-zero.\n        //   Today: SSTORE_SET_GAS = 20,000 (plus cold-access cost).\n        //   Under EIP-5022: 40,000.\n        // Later writes (non-zero -\u003e non-zero) are unaffected.\n        score[msg.sender] = v;\n    }\n}\n```\n\n## 알아둘 점\n\n- 상태는 **Stagnant**입니다. 이 변경은 채택되지 않았습니다.\n- 명세는 많은 애플리케이션의 비용이 크게 오르고, 가스 양을 하드코딩한 채 스토리지를 생성하는 컨트랙트가 깨질 수 있음을 인정합니다.\n- `SSTORE`의 전체 비용은 순 가스 계량([EIP-2200](/eip-2200/)), 콜드/웜 접근([EIP-2929](/eip-2929/)), 환불 규칙([EIP-3529](/eip-3529/))에도 좌우됩니다. 이 EIP는 슬롯 생성 상수만 건드립니다.\n- 명세의 보안 고려 사항 섹션은 비어 있습니다(`TODO`).\n"},"zh":{"lang":"zh","tldr":"提议将 SSTORE 创建新存储槽（从零变为非零）时的 gas 成本从 20,000 翻倍到 40,000，以更真实地为状态增长定价。","tags":["gas","sstore","state-growth","core"],"related":[2200,2929,3529],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-5022/","markdown":"## 它解决什么问题？\n\n每个新的存储槽都会永久增加以太坊的状态，所有全节点都必须保存它。状态越大，每个新增的槽都会让节点运行得更慢、成本更高。然而创建一个槽的价格一直固定在 20,000 gas。\n\n作者认为这被低估了：由于所有资源共享同一个 gas 上限，其他所有操作码的使用者实际上都在补贴状态的创建。状态增长也是 gas 上限没有被提高的主要原因之一。更准确地为新存储定价，会让提高 gas 上限更可行。\n\n## 它如何运作\n\n从某个分叉区块起对 gas 计价表做一处修改（规范将其留作 `TBD`）：\n\n| 情形 | 之前 | 之后 |\n| --- | --- | --- |\n| `SSTORE` 从零到非零（`SSTORE_SET_GAS`） | 20,000 | **40,000** |\n| 其他所有 `SSTORE` 情形 | 不变 | 不变 |\n\n刻意不改变的部分：\n\n- **非零到非零**的写入：它们不会增加状态，因此保持不变。更高的创建价格也会促使开发者复用存储槽。\n- **清除存储槽的退款**：留待进一步讨论。\n\n规范把它作为短期补丁提出，同时对状态租金或状态过期等长期想法仍在研究中。\n\n## 示例代码\n\n这一变化在合约中会体现在哪里：对 mapping 条目的第一次写入会创建一个存储槽。\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ncontract Registry {\n    mapping(address =\u003e uint256) public score;\n\n    function set(uint256 v) external {\n        // First write for msg.sender: zero -\u003e non-zero.\n        //   Today: SSTORE_SET_GAS = 20,000 (plus cold-access cost).\n        //   Under EIP-5022: 40,000.\n        // Later writes (non-zero -\u003e non-zero) are unaffected.\n        score[msg.sender] = v;\n    }\n}\n```\n\n## 需要注意\n\n- 状态为 **Stagnant**：该修改未被采纳。\n- 规范承认这会大幅提高许多应用的成本，并且硬编码了 gas 数量且会创建存储的合约会失效。\n- `SSTORE` 的完整成本还取决于净 gas 计量（[EIP-2200](/eip-2200/)）、冷/热访问（[EIP-2929](/eip-2929/)）和退款规则（[EIP-3529](/eip-3529/)）；这个 EIP 只改动创建存储槽的常量。\n- 规范的安全考虑部分为空（`TODO`）。\n"}}}
