{"eip":3403,"title":"Partial removal of refunds","description":"Remove gas refunds for SELFDESTRUCT, and restrict gas refunds for SSTORE to one specific case.","authors":["Vitalik Buterin (@vbuterin)","Martin Swende (@holiman)"],"status":"Stagnant","type":"Standards Track","category":"Core","created":"2021-03-16","discussionsTo":"https://ethereum-magicians.org/t/eip-3298-removal-of-refunds/5430","repo":"EIPs","label":"EIP-3403","officialUrl":"https://eips.ethereum.org/EIPS/eip-3403","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-3403.md","url":"https://eips.huatuo.xyz/eip-3403/","tldr":{"en":"Proposed removing the SELFDESTRUCT refund and all SSTORE refunds except the 0→nonzero→0 case, killing gas tokens while keeping reentrancy locks cheap.","ja":"SELFDESTRUCT のリファンドと、0→非ゼロ→0 のケース以外のすべての SSTORE リファンドを廃止し、ガストークンを無効化しつつ、リエントランシーロックを安価に保つことを提案した。","ko":"SELFDESTRUCT 환급과 0→0이 아닌 값→0 경우를 제외한 모든 SSTORE 환급을 없애, 가스 토큰을 무력화하면서도 재진입 락은 저렴하게 유지하자고 제안했다.","zh":"提议取消 SELFDESTRUCT 退款，以及除 0→非零→0 情形以外的所有 SSTORE 退款，既让 gas 代币失效，又保持重入锁的廉价。"},"tags":["gas","refunds","sstore","selfdestruct","core"],"explainers":{"en":{"lang":"en","tldr":"Proposed removing the SELFDESTRUCT refund and all SSTORE refunds except the 0→nonzero→0 case, killing gas tokens while keeping reentrancy locks cheap.","tags":["gas","refunds","sstore","selfdestruct","core"],"related":[3298,3529,2929,2200,1283],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-3403/","markdown":"## What problem does it solve?\n\nEthereum used to refund gas when a transaction cleared storage (`SSTORE` to zero) or destroyed a contract (`SELFDESTRUCT`). The idea was to reward \"state hygiene\", but in practice it mostly caused harm:\n\n- **GasToken**: people filled storage when gas was cheap and cleared it when gas was expensive to collect refunds, bloating state and wasting block space.\n- **Block size variance**: refunds (capped at 50 % of gas used) let a block do almost twice its nominal gas limit of real work.\n\n[EIP-3298](/eip-3298/) proposed removing refunds entirely, but that would make common patterns such as reentrancy locks much more expensive. EIP-3403 is the compromise by Vitalik Buterin and Martin Swende.\n\n## How it works\n\nFrom the fork block:\n\n1. **No refund for `SELFDESTRUCT`.**\n2. **No refund for `SSTORE`**, except one case: if a slot's *original* value (at the start of the transaction) is 0, its *current* value is non-zero, and the *new* value is 0, refund `SSTORE_REFUND_GAS = 19000`.\n\nTerms *original*, *current* and *new* are as in net gas metering ([EIP-1283](/eip-1283/) / [EIP-2200](/eip-2200/)).\n\nWhy that exception is safe: the 19,000 refunded is only possible because the same transaction already paid about 20,000 to flip that slot from zero to non-zero. Nothing is left in state, so nobody can store up refunds for later. Gas tokens stop working, but these stay cheap:\n\n- **Reentrancy locks** using the 0 → 1 → 0 pattern.\n- **Approve-and-spend** flows where an allowance goes from 0 to a value and back to 0 within one transaction.\n\nFrom the spec's comparison (warm slot, after [EIP-2929](/eip-2929/)): a 0-1-0 mutex costs about 212 gas under Berlin rules, 20,112 with no refunds at all, and 1,112 under EIP-3403.\n\n## Sample code\n\nThe pattern EIP-3403 was designed to keep cheap, a 0-1-0 reentrancy guard:\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ncontract Guarded {\n    uint256 private locked; // 0 = unlocked, original value at tx start\n\n    modifier nonReentrant() {\n        require(locked == 0, \"reentrant\");\n        locked = 1;          // 0 -\u003e 1 : pays the zero-to-nonzero SSTORE cost\n        _;\n        locked = 0;          // 1 -\u003e 0 : original == new == 0 != current =\u003e refund kept\n    }\n\n    function withdraw() external nonReentrant {\n        // ...\n    }\n}\n```\n\n## Things to know\n\n- Status is **Stagnant**. It was not the version adopted.\n- The London upgrade shipped [EIP-3529](/eip-3529/) instead: it removed the `SELFDESTRUCT` refund, reduced the `SSTORE` clearing refund, and lowered the overall refund cap from 1/2 to 1/5 of gas used. Gas tokens became unprofitable there too.\n- Under EIP-3403 the \"1-2-1\" mutex style (non-zero to non-zero) would get no refund, so 0-1-0 would have been the cheaper pattern. Today, transient storage (`TSTORE`/`TLOAD`) is the cheapest way to build a reentrancy lock.\n- Refunds are applied only after execution, so removing them never makes code run out of gas mid-call; it only changes final cost.\n"},"ja":{"lang":"ja","tldr":"SELFDESTRUCT のリファンドと、0→非ゼロ→0 のケース以外のすべての SSTORE リファンドを廃止し、ガストークンを無効化しつつ、リエントランシーロックを安価に保つことを提案した。","tags":["gas","refunds","sstore","selfdestruct","core"],"related":[3298,3529,2929,2200,1283],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-3403/","markdown":"## 何を解決するのか\n\nEthereum は以前、トランザクションがストレージを消去（`SSTORE` でゼロにする）したり、コントラクトを破棄（`SELFDESTRUCT`）したりすると、ガスを払い戻していました。「ステートの衛生」に報いるという考え方でしたが、実際にはほとんど害をもたらしました。\n\n- **GasToken**: ガスが安いときにストレージを埋め、ガスが高いときにそれを消去してリファンドを回収することで、ステートが肥大化し、ブロック空間が浪費されました。\n- **ブロックサイズのばらつき**: リファンド（使用ガスの 50 % が上限）によって、ブロックは名目上のガスリミットのほぼ 2 倍の実作業を行えました。\n\n[EIP-3298](/eip-3298/) はリファンドの完全な廃止を提案しましたが、そうするとリエントランシーロックのような一般的なパターンがはるかに高くつきます。EIP-3403 は、Vitalik Buterin と Martin Swende による妥協案です。\n\n## 仕組み\n\nフォークブロックから:\n\n1. **`SELFDESTRUCT` のリファンドはなくなります。**\n2. **`SSTORE` のリファンドはなくなります**。ただし 1 つのケースを除きます。スロットの*元の*値（トランザクション開始時）が 0 で、*現在の*値が非ゼロ、*新しい*値が 0 の場合、`SSTORE_REFUND_GAS = 19000` を払い戻します。\n\n*元の*、*現在の*、*新しい*という用語は、ネットガスメータリング（[EIP-1283](/eip-1283/) / [EIP-2200](/eip-2200/)）と同じ意味です。\n\nこの例外が安全な理由: 払い戻される 19,000 は、同じトランザクションがすでにそのスロットをゼロから非ゼロに切り替えるために約 20,000 を支払っているからこそ可能です。ステートには何も残らないため、誰も後のためにリファンドを溜め込むことはできません。ガストークンは機能しなくなりますが、次のものは安いままです。\n\n- 0 → 1 → 0 のパターンを使う**リエントランシーロック**。\n- allowance が 0 から値になり、1 つのトランザクション内で 0 に戻る、**approve して使う**フロー。\n\n仕様の比較から（ウォームなスロット、[EIP-2929](/eip-2929/) 以降）: 0-1-0 のミューテックスは、Berlin のルールでは約 212 ガス、リファンドが完全になければ 20,112、EIP-3403 では 1,112 です。\n\n## サンプルコード\n\nEIP-3403 が安価に保つように設計された、0-1-0 のリエントランシーガードのパターン:\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ncontract Guarded {\n    uint256 private locked; // 0 = unlocked, original value at tx start\n\n    modifier nonReentrant() {\n        require(locked == 0, \"reentrant\");\n        locked = 1;          // 0 -\u003e 1 : pays the zero-to-nonzero SSTORE cost\n        _;\n        locked = 0;          // 1 -\u003e 0 : original == new == 0 != current =\u003e refund kept\n    }\n\n    function withdraw() external nonReentrant {\n        // ...\n    }\n}\n```\n\n## 知っておくべきこと\n\n- ステータスは **Stagnant** です。採用されたバージョンではありませんでした。\n- London アップグレードは代わりに [EIP-3529](/eip-3529/) を出荷しました。`SELFDESTRUCT` のリファンドを廃止し、`SSTORE` の消去リファンドを減らし、リファンドの上限を使用ガスの 1/2 から 1/5 に引き下げました。ガストークンはそこでも採算が合わなくなりました。\n- EIP-3403 の下では、「1-2-1」型のミューテックス（非ゼロから非ゼロ）はリファンドを受けられないため、0-1-0 のほうが安いパターンになっていたはずです。現在は、transient storage（`TSTORE`/`TLOAD`）がリエントランシーロックを作る最も安い方法です。\n- リファンドは実行後にのみ適用されるため、リファンドをなくしても、呼び出しの途中でコードがガス切れになることはありません。変わるのは最終的なコストだけです。\n"},"ko":{"lang":"ko","tldr":"SELFDESTRUCT 환급과 0→0이 아닌 값→0 경우를 제외한 모든 SSTORE 환급을 없애, 가스 토큰을 무력화하면서도 재진입 락은 저렴하게 유지하자고 제안했다.","tags":["gas","refunds","sstore","selfdestruct","core"],"related":[3298,3529,2929,2200,1283],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-3403/","markdown":"## 어떤 문제를 해결하나요?\n\n이더리움은 예전에 트랜잭션이 스토리지를 지우거나(`SSTORE`로 0 설정) 컨트랙트를 파괴(`SELFDESTRUCT`)하면 가스를 환급해 주었습니다. \"스테이트 위생\"에 보상한다는 발상이었지만, 실제로는 대부분 해를 끼쳤습니다.\n\n- **GasToken**: 가스가 쌀 때 스토리지를 채우고 가스가 비쌀 때 지워서 환급을 챙기는 바람에 스테이트가 부풀고 블록 공간이 낭비되었습니다.\n- **블록 크기 변동**: 환급(사용 가스의 50 %가 상한)은 블록이 명목 가스 한도의 거의 두 배에 해당하는 실제 작업을 하게 했습니다.\n\n[EIP-3298](/eip-3298/)은 환급을 완전히 없애자고 제안했지만, 그러면 재진입 락 같은 흔한 패턴이 훨씬 비싸집니다. EIP-3403은 Vitalik Buterin과 Martin Swende의 절충안입니다.\n\n## 어떻게 동작하나요?\n\n포크 블록부터:\n\n1. **`SELFDESTRUCT`에 대한 환급이 없습니다.**\n2. **`SSTORE`에 대한 환급이 없습니다.** 단 한 가지 경우만 예외입니다. 슬롯의 *원래* 값(트랜잭션 시작 시점)이 0이고, *현재* 값이 0이 아니며, *새* 값이 0이면 `SSTORE_REFUND_GAS = 19000`을 환급합니다.\n\n*원래*, *현재*, *새*라는 용어는 순 가스 계량([EIP-1283](/eip-1283/) / [EIP-2200](/eip-2200/))에서와 같습니다.\n\n이 예외가 안전한 이유: 환급되는 19,000은 같은 트랜잭션이 그 슬롯을 0에서 0이 아닌 값으로 바꾸는 데 이미 약 20,000을 지불했기 때문에 가능합니다. 스테이트에는 아무것도 남지 않으므로 아무도 나중을 위해 환급을 쌓아둘 수 없습니다. 가스 토큰은 작동하지 않게 되지만, 다음은 계속 저렴합니다.\n\n- 0 → 1 → 0 패턴을 쓰는 **재진입 락**.\n- allowance가 0에서 어떤 값으로 갔다가 한 트랜잭션 안에서 다시 0이 되는 **승인 후 사용** 흐름.\n\n명세의 비교에서(웜 슬롯, [EIP-2929](/eip-2929/) 이후): 0-1-0 뮤텍스는 Berlin 규칙에서 약 212 가스, 환급이 전혀 없으면 20,112, EIP-3403에서는 1,112입니다.\n\n## 샘플 코드\n\nEIP-3403이 저렴하게 유지하도록 설계된 패턴, 즉 0-1-0 재진입 가드:\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ncontract Guarded {\n    uint256 private locked; // 0 = unlocked, original value at tx start\n\n    modifier nonReentrant() {\n        require(locked == 0, \"reentrant\");\n        locked = 1;          // 0 -\u003e 1 : pays the zero-to-nonzero SSTORE cost\n        _;\n        locked = 0;          // 1 -\u003e 0 : original == new == 0 != current =\u003e refund kept\n    }\n\n    function withdraw() external nonReentrant {\n        // ...\n    }\n}\n```\n\n## 알아둘 점\n\n- 상태는 **Stagnant**입니다. 채택된 버전이 아니었습니다.\n- 런던 업그레이드는 대신 [EIP-3529](/eip-3529/)를 내놓았습니다. `SELFDESTRUCT` 환급을 없애고, `SSTORE` 삭제 환급을 줄였으며, 전체 환급 상한을 사용 가스의 1/2에서 1/5로 낮췄습니다. 가스 토큰은 거기서도 수익성이 없어졌습니다.\n- EIP-3403에서는 \"1-2-1\" 방식의 뮤텍스(0이 아닌 값에서 0이 아닌 값)는 환급을 받지 못하므로 0-1-0이 더 저렴한 패턴이 되었을 것입니다. 오늘날에는 트랜지언트 스토리지(`TSTORE`/`TLOAD`)가 재진입 락을 만드는 가장 저렴한 방법입니다.\n- 환급은 실행이 끝난 뒤에만 적용되므로, 환급을 없앤다고 해서 호출 도중 코드가 가스 부족에 빠지지는 않습니다. 최종 비용만 바뀝니다.\n"},"zh":{"lang":"zh","tldr":"提议取消 SELFDESTRUCT 退款，以及除 0→非零→0 情形以外的所有 SSTORE 退款，既让 gas 代币失效，又保持重入锁的廉价。","tags":["gas","refunds","sstore","selfdestruct","core"],"related":[3298,3529,2929,2200,1283],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-3403/","markdown":"## 它解决什么问题？\n\n以太坊过去在交易清除存储（`SSTORE` 置零）或销毁合约（`SELFDESTRUCT`）时会退还 gas。这个想法是奖励\"状态卫生\"，但实际上主要造成了危害：\n\n- **GasToken**：人们在 gas 便宜时填充存储，在 gas 昂贵时清除以领取退款，导致状态膨胀并浪费区块空间。\n- **区块大小波动**：退款（上限为已用 gas 的 50 %）使一个区块可以完成几乎两倍于其名义 gas 上限的实际工作。\n\n[EIP-3298](/eip-3298/) 提议完全取消退款，但那会让重入锁等常见模式变得昂贵得多。EIP-3403 是 Vitalik Buterin 和 Martin Swende 提出的折中方案。\n\n## 它如何运作\n\n从分叉区块开始：\n\n1. **`SELFDESTRUCT` 不再有退款。**\n2. **`SSTORE` 不再有退款**，只有一种情形例外：如果某个槽位的*原始*值（交易开始时）为 0，其*当前*值非零，而*新*值为 0，则退还 `SSTORE_REFUND_GAS = 19000`。\n\n*原始*、*当前*和*新*这几个术语与净 gas 计量（[EIP-1283](/eip-1283/) / [EIP-2200](/eip-2200/)）中的含义相同。\n\n这个例外为什么安全：之所以能退还这 19,000，是因为同一笔交易已经为把该槽位从零变为非零支付了约 20,000。状态中没有留下任何东西，所以没有人能为以后囤积退款。gas 代币会失效，但以下这些仍然廉价：\n\n- 使用 0 → 1 → 0 模式的**重入锁**。\n- 额度在一笔交易内从 0 变为某个值再回到 0 的**授权并花费**流程。\n\n来自规范的对比（热槽位，[EIP-2929](/eip-2929/) 之后）：一个 0-1-0 互斥锁在柏林规则下约为 212 gas，完全没有退款时为 20,112，在 EIP-3403 下为 1,112。\n\n## 示例代码\n\nEIP-3403 旨在保持廉价的模式，即 0-1-0 重入保护：\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ncontract Guarded {\n    uint256 private locked; // 0 = unlocked, original value at tx start\n\n    modifier nonReentrant() {\n        require(locked == 0, \"reentrant\");\n        locked = 1;          // 0 -\u003e 1 : pays the zero-to-nonzero SSTORE cost\n        _;\n        locked = 0;          // 1 -\u003e 0 : original == new == 0 != current =\u003e refund kept\n    }\n\n    function withdraw() external nonReentrant {\n        // ...\n    }\n}\n```\n\n## 需要注意\n\n- 状态为 **Stagnant**。它不是最终被采纳的版本。\n- 伦敦升级发布的是 [EIP-3529](/eip-3529/)：它取消了 `SELFDESTRUCT` 退款，降低了 `SSTORE` 清除退款，并把总退款上限从已用 gas 的 1/2 降到 1/5。gas 代币在那里同样变得无利可图。\n- 在 EIP-3403 下，\"1-2-1\"风格的互斥锁（非零到非零）得不到退款，所以 0-1-0 会是更便宜的模式。如今，瞬态存储（`TSTORE`/`TLOAD`）是构建重入锁最便宜的方式。\n- 退款只在执行之后才应用，因此取消退款绝不会让代码在调用中途耗尽 gas；它只改变最终成本。\n"}}}
