{"eip":2583,"title":"Penalty for account trie misses","description":"This EIP introduces a gas penalty for opcodes which access the account for trie non-existent accounts.","authors":["Martin Holst Swende (@holiman)"],"status":"Stagnant","type":"Standards Track","category":"Core","created":"2020-02-21","discussionsTo":"https://ethereum-magicians.org/t/eip-2583-penalties-for-trie-misses/4190","repo":"EIPs","label":"EIP-2583","officialUrl":"https://eips.ethereum.org/EIPS/eip-2583","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2583.md","url":"https://eips.huatuo.xyz/eip-2583/","tldr":{"en":"Proposed an extra gas penalty when an opcode looks up an account that does not exist, to blunt DoS attacks that deliberately miss node caches.","ja":"存在しないアカウントを opcode が参照する際に追加のガスペナルティを課し、ノードのキャッシュをわざと外す DoS 攻撃を鈍らせることを提案した。","ko":"opcode가 존재하지 않는 계정을 조회할 때 추가 가스 페널티를 부과해, 노드 캐시를 일부러 빗나가게 하는 DoS 공격을 무디게 하자고 제안했다.","zh":"提议在 opcode 查询不存在的账户时增加额外的 gas 惩罚，以削弱刻意绕过节点缓存的 DoS 攻击。"},"tags":["gas","dos","state","opcodes","core"],"explainers":{"en":{"lang":"en","tldr":"Proposed an extra gas penalty when an opcode looks up an account that does not exist, to blunt DoS attacks that deliberately miss node caches.","tags":["gas","dos","state","opcodes","core"],"related":[2929,1884,150],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-2583/","markdown":"## What problem does it solve?\n\nNodes rely heavily on caches to read state quickly. A cache hit is cheap, but a lookup for an address that is not in the state trie usually misses every cache and goes to disk. An attacker can exploit this by touching a fresh non-existent address every time, maximising disk reads per unit of gas. Caching \"non-existence\" does not help much, because the attacker never repeats an address and the junk entries evict useful ones.\n\nRaising the base price of every state-access opcode (as [EIP-150](/eip-150/) and [EIP-1884](/eip-1884/) did) punishes all contracts for the worst case. EIP-2583 instead keeps normal prices for normal use and charges extra only on the \"miss\" path.\n\n## How it works\n\n- A constant `penalty` (left as TBD, suggested 2000 gas) is charged whenever an opcode that reads the account trie targets an address that **does not exist**.\n- Affected: `BALANCE`, `EXTCODEHASH`, `EXTCODECOPY`, `EXTCODESIZE`, and the call family (`CALL`, `CALLCODE`, `DELEGATECALL`, `STATICCALL`).\n- Not affected: `SELFDESTRUCT` (already costs 5000), `CREATE`/`CREATE2` (target is expected not to exist), `SELFBALANCE`, and base opcode costs in general.\n- For calls, the penalty applies only when **no value** is sent and the destination does not exist (and is not a precompile). Value-transferring calls to new accounts already pay the 25,000 new-account charge.\n\n| Op | value, dest | value, !dest | !value, dest | !value, !dest |\n| --- | --- | --- | --- | --- |\n| CALL / CALLCODE | no change | no change | no change | `penalty` |\n| DELEGATECALL / STATICCALL | N/A | N/A | no change | `penalty` |\n\nThe author estimated that a 10M-gas transaction could cause about 14K trie lookups at the time, and that a 2000-gas penalty would cut that to about 3700. The spec also notes a ceiling: an attacker can route lookups through a relay contract, so a penalty much above about 800 gas may not add protection.\n\n## Sample code\n\nPseudocode for the extra charge on `BALANCE`:\n\n```python\nPENALTY = 2000  # suggested value; TBD in the spec\n\ndef op_balance(evm, address):\n    evm.charge_gas(BALANCE_BASE_COST)\n    if not evm.state.account_exists(address):\n        evm.charge_gas(PENALTY)          # trie miss\n        evm.stack.push(0)\n    else:\n        evm.stack.push(evm.state.get_balance(address))\n```\n\nSolidity code paths that would pay it: the pre-call `EXTCODESIZE` check that Solidity performs on a high-level call to a non-existent `recipient`, and `addr.balance` on an empty address.\n\n## Things to know\n\n- **Status: Stagnant.** It was never adopted. Ethereum addressed the same class of DoS differently with [EIP-2929](/eip-2929/), which made the first access to any address or slot in a transaction expensive (\"cold\") and later accesses cheap (\"warm\").\n- Several parts of the spec were left open: the exact penalty value, whether it applies to plain zero-value transactions, and how it should interact with self-destructed accounts.\n- The backwards compatibility section examines real contracts, such as ERC-223-style `isContract` checks, and concludes most would be unaffected as long as the penalty stays below roughly 3000 gas.\n"},"ja":{"lang":"ja","tldr":"存在しないアカウントを opcode が参照する際に追加のガスペナルティを課し、ノードのキャッシュをわざと外す DoS 攻撃を鈍らせることを提案した。","tags":["gas","dos","state","opcodes","core"],"related":[2929,1884,150],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-2583/","markdown":"## 何を解決するのか\n\nノードは状態を素早く読むためにキャッシュに大きく依存しています。キャッシュヒットは安価ですが、state trie にないアドレスの参照は通常すべてのキャッシュを外れてディスクに到達します。攻撃者は毎回新しい存在しないアドレスに触れることで、ガスあたりのディスク読み取りを最大化できます。「存在しないこと」をキャッシュしてもあまり効果はありません。攻撃者は同じアドレスを繰り返さず、ゴミのエントリが有用なエントリを追い出してしまうからです。\n\nすべての状態アクセス opcode の基本価格を引き上げる方法（[EIP-150](/eip-150/) や [EIP-1884](/eip-1884/) が行ったもの）は、最悪のケースのためにすべてのコントラクトを罰することになります。EIP-2583 は通常の用途では通常の価格を維持し、「ミス」の経路にだけ追加料金を課します。\n\n## 仕組み\n\n- 定数 `penalty`（TBD のままで、2000 gas が提案されている）を、アカウント trie を読む opcode が**存在しない**アドレスを対象にしたときに課します。\n- 対象: `BALANCE`、`EXTCODEHASH`、`EXTCODECOPY`、`EXTCODESIZE`、および call 系（`CALL`、`CALLCODE`、`DELEGATECALL`、`STATICCALL`）。\n- 対象外: `SELFDESTRUCT`（すでに 5000 かかる）、`CREATE`/`CREATE2`（対象は存在しないことが想定されている）、`SELFBALANCE`、および一般的な opcode の基本コスト。\n- call の場合、ペナルティが適用されるのは**value を送らず**、宛先が存在しない（かつプリコンパイルでない）ときだけです。value を送って新規アカウントへ呼び出す場合は、すでに 25,000 の新規アカウント料金を支払っています。\n\n| Op | value あり、宛先あり | value あり、宛先なし | value なし、宛先あり | value なし、宛先なし |\n| --- | --- | --- | --- | --- |\n| CALL / CALLCODE | 変更なし | 変更なし | 変更なし | `penalty` |\n| DELEGATECALL / STATICCALL | N/A | N/A | 変更なし | `penalty` |\n\n作者の見積もりでは、当時 1,000 万 gas のトランザクションで約 1.4 万回の trie 参照を起こせ、2000 gas のペナルティがあればそれが約 3700 回に減ります。仕様には上限についても記されています。攻撃者はリレーコントラクトを経由して参照を行えるため、約 800 gas を大きく超えるペナルティは追加の防御にならない可能性があります。\n\n## サンプルコード\n\n`BALANCE` に対する追加料金の擬似コード:\n\n```python\nPENALTY = 2000  # suggested value; TBD in the spec\n\ndef op_balance(evm, address):\n    evm.charge_gas(BALANCE_BASE_COST)\n    if not evm.state.account_exists(address):\n        evm.charge_gas(PENALTY)          # trie miss\n        evm.stack.push(0)\n    else:\n        evm.stack.push(evm.state.get_balance(address))\n```\n\nこれを支払うことになる Solidity のコードパス: 存在しない `recipient` に対する高レベル呼び出しで Solidity が行う呼び出し前の `EXTCODESIZE` チェックと、空のアドレスに対する `addr.balance`。\n\n## 知っておくべきこと\n\n- **ステータス: Stagnant。** 採用されることはありませんでした。Ethereum は同種の DoS に対して [EIP-2929](/eip-2929/) で別の対処をしました。これはトランザクション内でのあらゆるアドレスやスロットへの最初のアクセスを高価（「cold」）にし、以降のアクセスを安価（「warm」）にしたものです。\n- 仕様の複数の部分が未決定のままでした。ペナルティの正確な値、単純な value ゼロのトランザクションに適用するか、自己破壊されたアカウントとどう相互作用させるか、などです。\n- 後方互換性の節では、ERC-223 形式の `isContract` チェックなど実際のコントラクトを検証し、ペナルティが約 3000 gas 未満である限り、ほとんどは影響を受けないと結論づけています。\n"},"ko":{"lang":"ko","tldr":"opcode가 존재하지 않는 계정을 조회할 때 추가 가스 페널티를 부과해, 노드 캐시를 일부러 빗나가게 하는 DoS 공격을 무디게 하자고 제안했다.","tags":["gas","dos","state","opcodes","core"],"related":[2929,1884,150],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-2583/","markdown":"## 어떤 문제를 해결하나요?\n\n노드는 상태를 빠르게 읽기 위해 캐시에 크게 의존합니다. 캐시 적중은 저렴하지만, 상태 트라이에 없는 주소를 조회하면 보통 모든 캐시를 빗나가 디스크로 갑니다. 공격자는 매번 새로운 존재하지 않는 주소를 건드려 가스당 디스크 읽기를 최대화할 수 있습니다. \"존재하지 않음\"을 캐싱해도 별 도움이 되지 않습니다. 공격자는 주소를 반복하지 않고, 쓸모없는 항목이 유용한 항목을 밀어내기 때문입니다.\n\n모든 상태 접근 opcode의 기본 가격을 올리는 방식([EIP-150](/eip-150/)과 [EIP-1884](/eip-1884/)가 한 것)은 최악의 경우를 이유로 모든 컨트랙트에 불이익을 줍니다. EIP-2583은 일반적인 사용에는 평소 가격을 유지하고 \"미스\" 경로에만 추가 요금을 매깁니다.\n\n## 어떻게 동작하나요?\n\n- 계정 트라이를 읽는 opcode가 **존재하지 않는** 주소를 대상으로 할 때마다 상수 `penalty`(TBD로 남겨 두었으며 2000 gas를 제안)를 부과합니다.\n- 영향받는 것: `BALANCE`, `EXTCODEHASH`, `EXTCODECOPY`, `EXTCODESIZE`, 그리고 call 계열(`CALL`, `CALLCODE`, `DELEGATECALL`, `STATICCALL`).\n- 영향받지 않는 것: `SELFDESTRUCT`(이미 5000), `CREATE`/`CREATE2`(대상이 존재하지 않는 것이 전제), `SELFBALANCE`, 그리고 일반적인 opcode 기본 비용.\n- 호출의 경우, **value를 보내지 않고** 목적지가 존재하지 않을 때(그리고 프리컴파일이 아닐 때)만 페널티가 적용됩니다. 새 계정으로 value를 보내는 호출은 이미 25,000의 신규 계정 요금을 냅니다.\n\n| Op | value 있음, 목적지 있음 | value 있음, 목적지 없음 | value 없음, 목적지 있음 | value 없음, 목적지 없음 |\n| --- | --- | --- | --- | --- |\n| CALL / CALLCODE | 변화 없음 | 변화 없음 | 변화 없음 | `penalty` |\n| DELEGATECALL / STATICCALL | N/A | N/A | 변화 없음 | `penalty` |\n\n저자는 당시 1,000만 gas 트랜잭션이 약 1.4만 번의 트라이 조회를 일으킬 수 있고, 2000 gas 페널티는 이를 약 3700번으로 줄일 것이라고 추정했습니다. 스펙은 상한도 언급합니다. 공격자가 릴레이 컨트랙트를 거쳐 조회할 수 있으므로, 약 800 gas를 훨씬 넘는 페널티는 추가 보호가 되지 않을 수 있습니다.\n\n## 샘플 코드\n\n`BALANCE`에 추가 요금을 부과하는 의사 코드:\n\n```python\nPENALTY = 2000  # suggested value; TBD in the spec\n\ndef op_balance(evm, address):\n    evm.charge_gas(BALANCE_BASE_COST)\n    if not evm.state.account_exists(address):\n        evm.charge_gas(PENALTY)          # trie miss\n        evm.stack.push(0)\n    else:\n        evm.stack.push(evm.state.get_balance(address))\n```\n\n이 요금을 내게 되는 Solidity 코드 경로: 존재하지 않는 `recipient`에 대한 상위 수준 호출에서 Solidity가 수행하는 호출 전 `EXTCODESIZE` 검사, 그리고 빈 주소에 대한 `addr.balance`.\n\n## 알아둘 점\n\n- **상태: Stagnant.** 채택된 적이 없습니다. 이더리움은 같은 종류의 DoS를 [EIP-2929](/eip-2929/)로 다르게 해결했습니다. 트랜잭션에서 어떤 주소나 슬롯에 처음 접근하는 비용은 비싸게(\"cold\"), 이후 접근은 싸게(\"warm\") 만든 것입니다.\n- 스펙의 여러 부분이 열려 있었습니다. 정확한 페널티 값, 단순한 value 0 트랜잭션에도 적용할지, 자기 파괴된 계정과 어떻게 상호작용해야 하는지 등입니다.\n- 하위 호환성 절은 ERC-223 스타일의 `isContract` 검사 같은 실제 컨트랙트를 살펴보고, 페널티가 대략 3000 gas 아래로 유지되는 한 대부분은 영향을 받지 않는다고 결론짓습니다.\n"},"zh":{"lang":"zh","tldr":"提议在 opcode 查询不存在的账户时增加额外的 gas 惩罚，以削弱刻意绕过节点缓存的 DoS 攻击。","tags":["gas","dos","state","opcodes","core"],"related":[2929,1884,150],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-2583/","markdown":"## 它解决什么问题？\n\n节点严重依赖缓存来快速读取状态。缓存命中很便宜，但查询一个不在状态 trie 中的地址通常会错过所有缓存并落到磁盘。攻击者可以利用这一点，每次都访问一个全新的不存在的地址，从而使每单位 gas 对应的磁盘读取最大化。缓存「不存在」的结果帮助不大，因为攻击者从不重复地址，而垃圾条目会把有用的条目挤出缓存。\n\n提高每个状态访问 opcode 的基础价格（如 [EIP-150](/eip-150/) 和 [EIP-1884](/eip-1884/) 所做的）是为最坏情况而惩罚所有合约。EIP-2583 则保持正常用途的价格不变，只对「未命中」路径额外收费。\n\n## 它如何运作\n\n- 当读取账户 trie 的 opcode 访问一个**不存在**的地址时，收取一个常量 `penalty`（留作 TBD，建议 2000 gas）。\n- 受影响的：`BALANCE`、`EXTCODEHASH`、`EXTCODECOPY`、`EXTCODESIZE`，以及 call 系列（`CALL`、`CALLCODE`、`DELEGATECALL`、`STATICCALL`）。\n- 不受影响的：`SELFDESTRUCT`（本来就收 5000）、`CREATE`/`CREATE2`（目标本来就预期不存在）、`SELFBALANCE`，以及一般的 opcode 基础成本。\n- 对于调用，仅当**不发送 value** 且目标不存在（并且不是预编译合约）时才适用该惩罚。向新账户发送 value 的调用已经支付了 25,000 的新账户费用。\n\n| Op | 有 value，目标存在 | 有 value，目标不存在 | 无 value，目标存在 | 无 value，目标不存在 |\n| --- | --- | --- | --- | --- |\n| CALL / CALLCODE | 无变化 | 无变化 | 无变化 | `penalty` |\n| DELEGATECALL / STATICCALL | N/A | N/A | 无变化 | `penalty` |\n\n作者估计，当时一笔 1000 万 gas 的交易可引起约 1.4 万次 trie 查询，而 2000 gas 的惩罚会把它降到约 3700 次。规范还指出了一个上限：攻击者可以通过中继合约来转发查询，因此远高于约 800 gas 的惩罚可能不会带来额外的保护。\n\n## 示例代码\n\n`BALANCE` 额外收费的伪代码：\n\n```python\nPENALTY = 2000  # suggested value; TBD in the spec\n\ndef op_balance(evm, address):\n    evm.charge_gas(BALANCE_BASE_COST)\n    if not evm.state.account_exists(address):\n        evm.charge_gas(PENALTY)          # trie miss\n        evm.stack.push(0)\n    else:\n        evm.stack.push(evm.state.get_balance(address))\n```\n\n会支付这笔费用的 Solidity 代码路径：Solidity 对不存在的 `recipient` 进行高级调用时执行的调用前 `EXTCODESIZE` 检查，以及对空地址执行的 `addr.balance`。\n\n## 需要注意\n\n- **状态：Stagnant。** 它从未被采纳。以太坊用 [EIP-2929](/eip-2929/) 以不同方式应对了同类 DoS，该提案让交易中对任何地址或槽的首次访问变贵（「cold」），之后的访问变便宜（「warm」）。\n- 规范中有若干部分悬而未决：具体的惩罚数值、是否适用于普通的零 value 交易，以及它应如何与已自毁的账户交互。\n- 向后兼容性部分检查了真实合约，例如 ERC-223 风格的 `isContract` 检查，并得出结论：只要惩罚保持在约 3000 gas 以下，大多数合约不受影响。\n"}}}
