{"eip":4747,"title":"Simplify EIP-161","description":"Simplify EIP-161 and retroactively deprecate unused aspects of it","authors":["Peter Davies (@petertdavies)"],"status":"Stagnant","type":"Standards Track","category":"Core","created":"2022-02-02","requires":[161],"discussionsTo":"https://ethereum-magicians.org/t/eip-4747-simplify-eip-161/8246","repo":"EIPs","label":"EIP-4747","officialUrl":"https://eips.ethereum.org/EIPS/eip-4747","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-4747.md","url":"https://eips.huatuo.xyz/eip-4747/","tldr":{"en":"Proposed retroactively rewriting EIP-161's empty-account cleanup rules into a much shorter version, dropping edge cases that never occurred on mainnet once all empty accounts had been removed.","ja":"EIP-161 の空アカウント整理ルールを遡及的に大幅に短い版へ書き換え、すべての空アカウントが削除された後はメインネットで一度も起きなかったエッジケースを取り除く提案。","ko":"EIP-161의 빈 계정 정리 규칙을 소급해서 훨씬 짧은 버전으로 다시 쓰고, 모든 빈 계정이 제거된 뒤로 메인넷에서 한 번도 일어나지 않은 엣지 케이스를 없애자는 제안.","zh":"提议将 EIP-161 的空账户清理规则追溯性地改写为篇幅短得多的版本，去掉在所有空账户被清除后主网上从未出现过的边缘情况。"},"tags":["state","accounts","core","cleanup","clients"],"explainers":{"en":{"lang":"en","tldr":"Proposed retroactively rewriting EIP-161's empty-account cleanup rules into a much shorter version, dropping edge cases that never occurred on mainnet once all empty accounts had been removed.","tags":["state","accounts","core","cleanup","clients"],"related":[161,158,6780],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-4747/","markdown":"## What problem does it solve?\n\nThe 2016 DoS attacks left millions of \"empty\" accounts in the state: zero nonce, zero balance, no code. [EIP-161](/eip-161/) (Spurious Dragon) stopped new ones from being created and deleted old ones whenever they were \"touched\" by one of eleven \"potentially state-changing operations\".\n\nThose rules are intricate, under-documented and hard to test, and every new client has to implement them to sync from genesis. The EIP points out that the last empty accounts on mainnet were cleared in block 14,049,881, so many of the edge cases can never happen again and, in fact, never happened at all.\n\nEIP-4747 rewrites EIP-161 so that client teams only implement what mainnet actually needs.\n\n## How it works\n\nIt retroactively replaces EIP-161 from its activation (block 2,675,000) with three rules:\n\n1. **New accounts start with nonce 1** before running initcode.\n2. **Empty accounts are treated as non-existent** during EVM execution; anything that would create an empty account leaves it non-existent instead.\n3. **An empty account is deleted** only if it:\n   - receives a zero-value `CALL`,\n   - is the recipient of a zero-value transaction, or\n   - is the beneficiary of a zero-value `SELFDESTRUCT`.\n\nIf that call, transaction or self-destruct is reverted, the deletion is reverted too (the spec lists one historical exception involving the `RIPEMD160` precompile). Deletion may happen immediately or at the end of the transaction.\n\nThe other eight triggers in EIP-161 are dropped because they were impossible, could not apply to an empty account, or would make it non-empty anyway. Interactions with `STATICCALL`, which no EIP ever specified, are explicitly left undefined.\n\nThe spec also lists the only post-Byzantium state-clearing events on mainnet, so clients that want to can simply hardcode them.\n\n## Sample code\n\nThe simplified clearing rule as client pseudocode:\n\n```python\ndef is_empty(acct) -\u003e bool:\n    return acct.nonce == 0 and acct.balance == 0 and acct.code == b\"\"\n\ndef maybe_clear(state, addr, value: int, kind: str):\n    \"\"\"kind in {'call', 'tx', 'selfdestruct_beneficiary'}.\"\"\"\n    acct = state.get(addr)\n    if acct is not None and is_empty(acct) and value == 0:\n        state.mark_for_deletion(addr)  # undone if the frame/tx reverts\n\n# Any other operation touching an empty account: no special handling needed.\n```\n\n## Things to know\n\n- Status: **Stagnant**. Clients still follow the original EIP-161 behaviour as tested; this proposal was not adopted as a replacement.\n- It is meant to be equivalent to EIP-161 on mainnet only. The spec notes that Ropsten and Ethereum Classic were not checked for edge cases.\n- Its correctness rests on three facts the authors state as assumptions: no empty account is ever touched and reinstated in the same transaction, the listed transactions are the only post-Byzantium clearings, and all empty accounts are gone.\n- Related cleanups: [EIP-158](/eip-158/) (the original state-clearing proposal) and [EIP-6780](/eip-6780/), which later restricted `SELFDESTRUCT`.\n"},"ja":{"lang":"ja","tldr":"EIP-161 の空アカウント整理ルールを遡及的に大幅に短い版へ書き換え、すべての空アカウントが削除された後はメインネットで一度も起きなかったエッジケースを取り除く提案。","tags":["state","accounts","core","cleanup","clients"],"related":[161,158,6780],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-4747/","markdown":"## 何を解決するのか\n\n2016 年の DoS 攻撃により、ステートには「空」のアカウント（nonce がゼロ、残高がゼロ、コードなし）が何百万個も残されました。[EIP-161](/eip-161/)（Spurious Dragon）は新たな空アカウントの作成を止め、既存のものは、11 種類の「状態を変更しうる操作」のいずれかで「touch」されたときに削除するようにしました。\n\nこれらのルールは複雑で、ドキュメントが不十分で、テストも難しく、新しいクライアントはジェネシスから同期するためにすべてを実装する必要があります。この EIP は、メインネットの最後の空アカウントがブロック 14,049,881 で削除されたため、多くのエッジケースはもう起こりえず、実際には一度も起きなかったと指摘しています。\n\nEIP-4747 は EIP-161 を書き換え、クライアントチームがメインネットで実際に必要なものだけを実装すればよいようにします。\n\n## 仕組み\n\n有効化時点（ブロック 2,675,000）から遡って EIP-161 を次の 3 つのルールに置き換えます。\n\n1. **新しいアカウントは nonce 1 で始まります**（initcode を実行する前）。\n2. **空アカウントは EVM の実行中は存在しないものとして扱われます**。空アカウントを作成することになる操作は、代わりにそれを存在しないままにします。\n3. **空アカウントが削除されるのは**、次の場合に限られます。\n   - ゼロ value の `CALL` を受け取ったとき\n   - ゼロ value のトランザクションの宛先であるとき\n   - ゼロ value の `SELFDESTRUCT` の受取先であるとき\n\nその呼び出し、トランザクション、または self-destruct が revert された場合、削除も revert されます（仕様には `RIPEMD160` プリコンパイルに関わる歴史的な例外が 1 つ挙げられています）。削除はその場で行っても、トランザクションの終了時に行ってもかまいません。\n\nEIP-161 の他の 8 つのトリガーは、不可能だった、空アカウントには適用できなかった、あるいはどのみち空でなくなるため、削除されています。どの EIP でも規定されたことのない `STATICCALL` との相互作用は、明示的に未定義とされています。\n\n仕様には、Byzantium 以降にメインネットで起きた状態クリアのイベントも唯一のものとして列挙されているため、希望するクライアントはそれらを単にハードコードできます。\n\n## サンプルコード\n\n簡略化されたクリアルールをクライアントの擬似コードで示します。\n\n```python\ndef is_empty(acct) -\u003e bool:\n    return acct.nonce == 0 and acct.balance == 0 and acct.code == b\"\"\n\ndef maybe_clear(state, addr, value: int, kind: str):\n    \"\"\"kind in {'call', 'tx', 'selfdestruct_beneficiary'}.\"\"\"\n    acct = state.get(addr)\n    if acct is not None and is_empty(acct) and value == 0:\n        state.mark_for_deletion(addr)  # undone if the frame/tx reverts\n\n# Any other operation touching an empty account: no special handling needed.\n```\n\n## 知っておくべきこと\n\n- ステータス: **Stagnant**。クライアントは今もテストされている元の EIP-161 の挙動に従っており、この提案は置き換えとして採用されませんでした。\n- メインネットでのみ EIP-161 と等価であることを意図しています。仕様には、Ropsten と Ethereum Classic ではエッジケースを確認していないと記されています。\n- その正しさは、著者が前提として述べている 3 つの事実に依存します。空アカウントが同じトランザクション内で touch されて復活することはないこと、列挙されたトランザクションが Byzantium 以降の唯一のクリアであること、そしてすべての空アカウントがなくなっていることです。\n- 関連する整理: [EIP-158](/eip-158/)（元の状態クリア提案）と、後に `SELFDESTRUCT` を制限した [EIP-6780](/eip-6780/)。\n"},"ko":{"lang":"ko","tldr":"EIP-161의 빈 계정 정리 규칙을 소급해서 훨씬 짧은 버전으로 다시 쓰고, 모든 빈 계정이 제거된 뒤로 메인넷에서 한 번도 일어나지 않은 엣지 케이스를 없애자는 제안.","tags":["state","accounts","core","cleanup","clients"],"related":[161,158,6780],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-4747/","markdown":"## 어떤 문제를 해결하나요?\n\n2016년 DoS 공격으로 상태에는 nonce 0, 잔액 0, 코드 없음인 \"빈\" 계정이 수백만 개 남았습니다. [EIP-161](/eip-161/)(Spurious Dragon)은 새 빈 계정이 생기는 것을 막고, 기존 계정은 열한 가지 \"상태를 바꿀 수 있는 연산\" 중 하나로 \"touch\"될 때 삭제하도록 했습니다.\n\n이 규칙들은 복잡하고, 문서화가 부족하고, 테스트하기 어려우며, 새 클라이언트는 제네시스부터 동기화하려면 모두 구현해야 합니다. 이 EIP는 메인넷의 마지막 빈 계정이 블록 14,049,881에서 정리되었으므로 많은 엣지 케이스가 다시는 일어날 수 없고, 사실 한 번도 일어난 적이 없다고 지적합니다.\n\nEIP-4747은 EIP-161을 다시 써서 클라이언트 팀이 메인넷에 실제로 필요한 것만 구현하도록 합니다.\n\n## 어떻게 동작하나요?\n\n활성화 시점(블록 2,675,000)부터 소급해서 EIP-161을 세 가지 규칙으로 대체합니다.\n\n1. **새 계정은 nonce 1로 시작합니다.** initcode를 실행하기 전에 적용됩니다.\n2. **빈 계정은 EVM 실행 중 존재하지 않는 것으로 취급합니다.** 빈 계정을 만들게 될 연산은 대신 그 계정을 존재하지 않는 상태로 둡니다.\n3. **빈 계정은 다음 경우에만 삭제됩니다.**\n   - 값이 0인 `CALL`을 받을 때,\n   - 값이 0인 트랜잭션의 수신자일 때, 또는\n   - 값이 0인 `SELFDESTRUCT`의 수혜자일 때.\n\n해당 호출, 트랜잭션 또는 self-destruct가 revert되면 삭제도 revert됩니다(스펙은 `RIPEMD160` 프리컴파일과 관련된 역사적 예외 하나를 명시합니다). 삭제는 즉시 일어나도 되고 트랜잭션 끝에 일어나도 됩니다.\n\nEIP-161의 나머지 여덟 가지 트리거는 불가능했거나, 빈 계정에는 적용될 수 없거나, 어차피 계정을 비어 있지 않게 만들기 때문에 제거됩니다. 어떤 EIP에서도 규정된 적 없는 `STATICCALL`과의 상호작용은 명시적으로 정의하지 않은 채로 둡니다.\n\n스펙은 Byzantium 이후 메인넷에서 일어난 유일한 상태 정리 이벤트도 나열하므로, 원하는 클라이언트는 이를 그냥 하드코딩할 수 있습니다.\n\n## 샘플 코드\n\n클라이언트 의사 코드로 나타낸 단순화된 정리 규칙:\n\n```python\ndef is_empty(acct) -\u003e bool:\n    return acct.nonce == 0 and acct.balance == 0 and acct.code == b\"\"\n\ndef maybe_clear(state, addr, value: int, kind: str):\n    \"\"\"kind in {'call', 'tx', 'selfdestruct_beneficiary'}.\"\"\"\n    acct = state.get(addr)\n    if acct is not None and is_empty(acct) and value == 0:\n        state.mark_for_deletion(addr)  # undone if the frame/tx reverts\n\n# Any other operation touching an empty account: no special handling needed.\n```\n\n## 알아둘 점\n\n- 상태: **Stagnant**. 클라이언트는 여전히 테스트된 원래의 EIP-161 동작을 따르며, 이 제안은 대체안으로 채택되지 않았습니다.\n- 메인넷에서만 EIP-161과 동등하도록 의도되었습니다. 스펙은 Ropsten과 Ethereum Classic의 엣지 케이스는 확인하지 않았다고 밝힙니다.\n- 정확성은 저자들이 가정으로 명시한 세 가지 사실에 기반합니다. 같은 트랜잭션에서 빈 계정이 touch된 뒤 되살아나는 일이 없고, 나열된 트랜잭션이 Byzantium 이후 유일한 정리이며, 모든 빈 계정이 사라졌다는 것입니다.\n- 관련된 정리: [EIP-158](/eip-158/)(원래의 상태 정리 제안)과 이후 `SELFDESTRUCT`를 제한한 [EIP-6780](/eip-6780/).\n"},"zh":{"lang":"zh","tldr":"提议将 EIP-161 的空账户清理规则追溯性地改写为篇幅短得多的版本，去掉在所有空账户被清除后主网上从未出现过的边缘情况。","tags":["state","accounts","core","cleanup","clients"],"related":[161,158,6780],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-4747/","markdown":"## 它解决什么问题？\n\n2016 年的 DoS 攻击在状态中留下了数百万个\"空\"账户：nonce 为零、余额为零、没有代码。[EIP-161](/eip-161/)（Spurious Dragon）阻止了新空账户的产生，并在旧账户被十一种\"可能改变状态的操作\"之一\"触及\"（touch）时将其删除。\n\n这些规则复杂、文档不足且难以测试，而每个新客户端都必须实现它们才能从创世区块开始同步。该 EIP 指出，主网上最后一批空账户在区块 14,049,881 被清除，因此许多边缘情况再也不可能发生，事实上从未发生过。\n\nEIP-4747 改写了 EIP-161，使客户端团队只需实现主网真正需要的部分。\n\n## 它如何运作\n\n它从 EIP-161 的激活区块（2,675,000）起，追溯性地将其替换为三条规则：\n\n1. **新账户的 nonce 从 1 开始**，在运行 initcode 之前。\n2. **在 EVM 执行期间，空账户被视为不存在**；任何会创建空账户的操作都会让它保持不存在。\n3. **空账户只有在以下情况才会被删除**：\n   - 收到价值为零的 `CALL`，\n   - 是价值为零的交易的接收方，或\n   - 是价值为零的 `SELFDESTRUCT` 的受益人。\n\n如果该调用、交易或 self-destruct 被回滚，删除也会被回滚（规范列出了一个涉及 `RIPEMD160` 预编译的历史例外）。删除可以立即发生，也可以在交易结束时发生。\n\nEIP-161 中其余八个触发条件被去掉，因为它们不可能发生、不可能作用于空账户，或者本来就会使账户变为非空。与 `STATICCALL` 的交互从未被任何 EIP 规定，这里明确保持未定义。\n\n规范还列出了 Byzantium 之后主网上仅有的状态清除事件，因此愿意的客户端可以直接将它们硬编码。\n\n## 示例代码\n\n以客户端伪代码表示的简化清除规则：\n\n```python\ndef is_empty(acct) -\u003e bool:\n    return acct.nonce == 0 and acct.balance == 0 and acct.code == b\"\"\n\ndef maybe_clear(state, addr, value: int, kind: str):\n    \"\"\"kind in {'call', 'tx', 'selfdestruct_beneficiary'}.\"\"\"\n    acct = state.get(addr)\n    if acct is not None and is_empty(acct) and value == 0:\n        state.mark_for_deletion(addr)  # undone if the frame/tx reverts\n\n# Any other operation touching an empty account: no special handling needed.\n```\n\n## 需要注意\n\n- 状态：**Stagnant**。客户端仍遵循经过测试的原始 EIP-161 行为；该提案没有被采纳为替代方案。\n- 它只打算在主网上与 EIP-161 等价。规范指出，没有检查 Ropsten 和 Ethereum Classic 上的边缘情况。\n- 其正确性取决于作者声明为假设的三个事实：没有空账户会在同一笔交易中被触及并恢复，所列交易是 Byzantium 之后仅有的清除，以及所有空账户都已不复存在。\n- 相关的清理：[EIP-158](/eip-158/)（最初的状态清除提案）和后来限制了 `SELFDESTRUCT` 的 [EIP-6780](/eip-6780/)。\n"}}}
