{"eip":6046,"title":"Replace SELFDESTRUCT with DEACTIVATE","description":"Change SELFDESTRUCT to not delete storage keys and use a special value in the account nonce to signal deactivation","authors":["Alex Beregszaszi (@axic)"],"status":"Stagnant","type":"Standards Track","category":"Core","created":"2022-11-25","requires":[2681,2929,3529],"discussionsTo":"https://ethereum-magicians.org/t/almost-self-destructing-selfdestruct-deactivate/11886","repo":"EIPs","label":"EIP-6046","officialUrl":"https://eips.ethereum.org/EIPS/eip-6046","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-6046.md","url":"https://eips.huatuo.xyz/eip-6046/","tldr":{"en":"A stagnant proposal to turn SELFDESTRUCT into DEACTIVATE: keep the account and its storage, zero the balance, and mark it with a special nonce, so the opcode no longer has to delete an unbounded amount of state.","ja":"SELFDESTRUCT を DEACTIVATE に置き換える、停滞中の提案。アカウントとそのストレージは残し、残高をゼロにして特別な nonce で印を付けることで、この opcode が無制限の量の状態を削除する必要をなくす。","ko":"SELFDESTRUCT를 DEACTIVATE로 바꾸자는 정체된 제안. 계정과 그 스토리지는 유지하고 잔액을 0으로 만든 뒤 특별한 nonce로 표시하여, 이 opcode가 무제한의 상태를 삭제하지 않아도 되게 한다.","zh":"一个已停滞的提案：把 SELFDESTRUCT 改为 DEACTIVATE，保留账户及其存储，将余额清零并用特殊 nonce 标记，这样该 opcode 就不必再删除数量无上限的状态。"},"tags":["selfdestruct","evm","opcode","state","verkle","core"],"explainers":{"en":{"lang":"en","tldr":"A stagnant proposal to turn SELFDESTRUCT into DEACTIVATE: keep the account and its storage, zero the balance, and mark it with a special nonce, so the opcode no longer has to delete an unbounded amount of state.","tags":["selfdestruct","evm","opcode","state","verkle","core"],"related":[6780,4758,2681,2929,3529],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-6046/","markdown":"## What problem does it solve?\n\n`SELFDESTRUCT` used to delete a contract's code and **all** of its storage for a fixed gas price. The amount of work it caused was unbounded, because a contract can have any number of storage slots. It also clashes with Verkle trees, where each storage slot has its own key and there is no practical way to find and delete every key an account used.\n\nMany proposals simply removed the deletion. EIP-6046 tried a middle path that keeps the \"destroy and later re-deploy at the same address\" pattern working, without having to wipe storage.\n\n## How it works\n\n- The account nonce limit from [EIP-2681](/eip-2681/) is lowered by one, to `2^64-2`, so that `2^64-1` becomes a free marker value (applied from genesis).\n- `SELFDESTRUCT`, renamed **`DEACTIVATE`**, now:\n  - sends the balance to the beneficiary and sets the account's balance to 0;\n  - **does not** delete code or storage; the account stays in place;\n  - sets the nonce to `2^64-1`, marking the account as deactivated.\n- Calling a deactivated account (by transaction or `CALL*`) succeeds immediately and returns empty data. It can still receive plain ETH transfers.\n- `CREATE2` is allowed onto an account whose nonce is `2^64-1`. The new code replaces the old, but **old storage is still there**.\n- No gas refund is given (refunds for it were already removed by [EIP-3529](/eip-3529/)), and [EIP-2929](/eip-2929/) access rules are unchanged.\n\nThe rename signals that \"revival\" no longer gives you a clean slate.\n\n## Sample code\n\nPseudocode for the proposed behaviour:\n\n```python\nDEACTIVATED = 2**64 - 1\n\ndef op_deactivate(evm, beneficiary):\n    acct = evm.state[evm.address]\n    evm.state[beneficiary].balance += acct.balance\n    acct.balance = 0\n    acct.nonce = DEACTIVATED        # code and storage are left untouched\n\ndef execute_call(state, addr, ...):\n    if state[addr].nonce == DEACTIVATED:\n        return Success(output=b\"\")  # value transfers still credited\n\ndef create2_allowed(state, addr):\n    a = state[addr]\n    return a.nonce == DEACTIVATED or (a.nonce == 0 and not a.code)\n```\n\nA contract meant to be revived under this rule would have to treat existing storage as possibly stale:\n\n```solidity\n// On re-deploy, slots written by the previous incarnation may still be set.\nuint256 public generation;\nfunction init() external { generation += 1; /* key new data by generation */ }\n```\n\n## Things to know\n\n- **Status: Stagnant.** It was never scheduled for a network upgrade.\n- Ethereum instead adopted [EIP-6780](/eip-6780/) (Dencun upgrade): `SELFDESTRUCT` only deletes an account if it is called in the same transaction that created the contract; otherwise it just sends the balance. A related earlier idea is [EIP-4758](/eip-4758/).\n- If something like this were adopted, contracts that self-destruct and redeploy would need to cope with leftover storage, which the spec flags as a security concern.\n"},"ja":{"lang":"ja","tldr":"SELFDESTRUCT を DEACTIVATE に置き換える、停滞中の提案。アカウントとそのストレージは残し、残高をゼロにして特別な nonce で印を付けることで、この opcode が無制限の量の状態を削除する必要をなくす。","tags":["selfdestruct","evm","opcode","state","verkle","core"],"related":[6780,4758,2681,2929,3529],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-6046/","markdown":"## 何を解決するのか\n\n`SELFDESTRUCT` はかつて、固定のガス価格でコントラクトのコードと**すべて**のストレージを削除していました。コントラクトは任意の数のストレージスロットを持てるため、これが引き起こす作業量には上限がありませんでした。また、各ストレージスロットが独自のキーを持ち、アカウントが使ったすべてのキーを見つけて削除する現実的な方法がない Verkle ツリーとも相性が悪いものでした。\n\n多くの提案は単に削除をやめました。EIP-6046 は、ストレージを消去することなく、「破棄して後で同じアドレスに再デプロイする」パターンを動かし続ける中間の道を試みました。\n\n## 仕組み\n\n- [EIP-2681](/eip-2681/) のアカウント nonce の上限を 1 つ下げて `2^64-2` にし、`2^64-1` を空きのマーカー値にします（ジェネシスから適用）。\n- `SELFDESTRUCT` は **`DEACTIVATE`** に名前が変わり、次のように動作します。\n  - 残高を受益者に送り、アカウントの残高を 0 にする\n  - コードとストレージは**削除しない**。アカウントはそのまま残る\n  - nonce を `2^64-1` に設定し、アカウントを無効化済みとして印を付ける\n- 無効化されたアカウントの呼び出し（トランザクションまたは `CALL*`）は即座に成功し、空のデータを返します。単純な ETH の送金は引き続き受け取れます。\n- nonce が `2^64-1` のアカウントに対して `CREATE2` が許可されます。新しいコードが古いコードを置き換えますが、**古いストレージは残ったまま**です。\n- ガスのリファンドはありません（そのためのリファンドは [EIP-3529](/eip-3529/) で既に削除されています）。[EIP-2929](/eip-2929/) のアクセスルールは変わりません。\n\n名前の変更は、「復活」してももはや白紙の状態にはならないことを示しています。\n\n## サンプルコード\n\n提案された動作の疑似コード:\n\n```python\nDEACTIVATED = 2**64 - 1\n\ndef op_deactivate(evm, beneficiary):\n    acct = evm.state[evm.address]\n    evm.state[beneficiary].balance += acct.balance\n    acct.balance = 0\n    acct.nonce = DEACTIVATED        # code and storage are left untouched\n\ndef execute_call(state, addr, ...):\n    if state[addr].nonce == DEACTIVATED:\n        return Success(output=b\"\")  # value transfers still credited\n\ndef create2_allowed(state, addr):\n    a = state[addr]\n    return a.nonce == DEACTIVATED or (a.nonce == 0 and not a.code)\n```\n\nこのルールの下で復活させるコントラクトは、既存のストレージが古い可能性があるものとして扱う必要があります。\n\n```solidity\n// On re-deploy, slots written by the previous incarnation may still be set.\nuint256 public generation;\nfunction init() external { generation += 1; /* key new data by generation */ }\n```\n\n## 知っておくべきこと\n\n- **ステータス: Stagnant。** ネットワークアップグレードにスケジュールされたことはありません。\n- Ethereum は代わりに [EIP-6780](/eip-6780/)（Dencun アップグレード）を採用しました。`SELFDESTRUCT` は、コントラクトを作成したのと同じトランザクション内で呼ばれた場合にのみアカウントを削除し、それ以外では残高を送るだけです。関連する先行のアイデアは [EIP-4758](/eip-4758/) です。\n- このようなものが採用された場合、自己破棄して再デプロイするコントラクトは、残ったストレージに対処する必要があります。仕様はこれをセキュリティ上の懸念として挙げています。\n"},"ko":{"lang":"ko","tldr":"SELFDESTRUCT를 DEACTIVATE로 바꾸자는 정체된 제안. 계정과 그 스토리지는 유지하고 잔액을 0으로 만든 뒤 특별한 nonce로 표시하여, 이 opcode가 무제한의 상태를 삭제하지 않아도 되게 한다.","tags":["selfdestruct","evm","opcode","state","verkle","core"],"related":[6780,4758,2681,2929,3529],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-6046/","markdown":"## 어떤 문제를 해결하나요?\n\n`SELFDESTRUCT`는 예전에 고정된 가스 가격으로 컨트랙트의 코드와 **모든** 스토리지를 삭제했습니다. 컨트랙트는 스토리지 슬롯을 얼마든지 가질 수 있으므로, 이로 인한 작업량에는 상한이 없었습니다. 또한 각 스토리지 슬롯이 자기만의 키를 갖고, 계정이 사용한 모든 키를 찾아 삭제할 현실적인 방법이 없는 Verkle 트리와도 충돌합니다.\n\n많은 제안은 단순히 삭제를 없앴습니다. EIP-6046은 스토리지를 지우지 않으면서 \"파괴한 뒤 나중에 같은 주소에 재배포\"하는 패턴이 계속 동작하도록 하는 절충안을 시도했습니다.\n\n## 어떻게 동작하나요?\n\n- [EIP-2681](/eip-2681/)의 계정 nonce 한도를 하나 낮춰 `2^64-2`로 하며, 그래서 `2^64-1`이 비어 있는 표시 값이 됩니다(제네시스부터 적용).\n- `SELFDESTRUCT`는 **`DEACTIVATE`**로 이름이 바뀌며 이제 다음과 같이 동작합니다.\n  - 잔액을 수혜자에게 보내고 계정의 잔액을 0으로 설정\n  - 코드나 스토리지를 삭제하지 **않음**. 계정은 그대로 남음\n  - nonce를 `2^64-1`로 설정하여 계정을 비활성화된 것으로 표시\n- 비활성화된 계정을 호출하면(트랜잭션 또는 `CALL*`) 즉시 성공하고 빈 데이터를 반환합니다. 단순 ETH 전송은 여전히 받을 수 있습니다.\n- nonce가 `2^64-1`인 계정에 `CREATE2`가 허용됩니다. 새 코드가 이전 코드를 대체하지만 **이전 스토리지는 그대로 남아 있습니다**.\n- 가스 환불은 없으며(이에 대한 환불은 이미 [EIP-3529](/eip-3529/)에서 제거됨), [EIP-2929](/eip-2929/)의 접근 규칙은 바뀌지 않습니다.\n\n이름 변경은 \"부활\"이 더 이상 백지 상태를 주지 않음을 알려 줍니다.\n\n## 샘플 코드\n\n제안된 동작의 의사 코드:\n\n```python\nDEACTIVATED = 2**64 - 1\n\ndef op_deactivate(evm, beneficiary):\n    acct = evm.state[evm.address]\n    evm.state[beneficiary].balance += acct.balance\n    acct.balance = 0\n    acct.nonce = DEACTIVATED        # code and storage are left untouched\n\ndef execute_call(state, addr, ...):\n    if state[addr].nonce == DEACTIVATED:\n        return Success(output=b\"\")  # value transfers still credited\n\ndef create2_allowed(state, addr):\n    a = state[addr]\n    return a.nonce == DEACTIVATED or (a.nonce == 0 and not a.code)\n```\n\n이 규칙 아래에서 부활할 컨트랙트는 기존 스토리지가 오래된 것일 수 있다고 간주해야 합니다.\n\n```solidity\n// On re-deploy, slots written by the previous incarnation may still be set.\nuint256 public generation;\nfunction init() external { generation += 1; /* key new data by generation */ }\n```\n\n## 알아둘 점\n\n- **상태: Stagnant.** 네트워크 업그레이드에 예정된 적이 없습니다.\n- 이더리움은 대신 [EIP-6780](/eip-6780/)(Dencun 업그레이드)을 채택했습니다. `SELFDESTRUCT`는 컨트랙트를 생성한 같은 트랜잭션에서 호출될 때만 계정을 삭제하고, 그렇지 않으면 잔액만 보냅니다. 관련된 이전 아이디어는 [EIP-4758](/eip-4758/)입니다.\n- 이와 비슷한 것이 채택된다면, 자기 파괴 후 재배포하는 컨트랙트는 남아 있는 스토리지에 대처해야 하며, 사양은 이를 보안상 우려로 지적합니다.\n"},"zh":{"lang":"zh","tldr":"一个已停滞的提案：把 SELFDESTRUCT 改为 DEACTIVATE，保留账户及其存储，将余额清零并用特殊 nonce 标记，这样该 opcode 就不必再删除数量无上限的状态。","tags":["selfdestruct","evm","opcode","state","verkle","core"],"related":[6780,4758,2681,2929,3529],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-6046/","markdown":"## 它解决什么问题？\n\n`SELFDESTRUCT` 过去会以固定的 gas 价格删除合约的代码和**全部**存储。由于合约可以有任意数量的存储槽，它引起的工作量是无上限的。它还与 Verkle 树冲突：在 Verkle 树中每个存储槽都有自己的键，没有切实可行的办法找出并删除一个账户用过的每个键。\n\n许多提案干脆取消了删除。EIP-6046 尝试了一条折中的路：让\"销毁后再在同一地址重新部署\"的模式继续可用，而不必清除存储。\n\n## 它如何运作\n\n- [EIP-2681](/eip-2681/) 的账户 nonce 上限降低 1，变为 `2^64-2`，从而使 `2^64-1` 成为空闲的标记值（从创世起适用）。\n- `SELFDESTRUCT` 改名为 **`DEACTIVATE`**，现在的行为是：\n  - 把余额发送给受益人，并将账户余额设为 0；\n  - **不会**删除代码或存储，账户保留原位；\n  - 把 nonce 设为 `2^64-1`，将该账户标记为已停用。\n- 调用已停用的账户（通过交易或 `CALL*`）会立即成功并返回空数据。它仍可接收普通的 ETH 转账。\n- 允许在 nonce 为 `2^64-1` 的账户上执行 `CREATE2`。新代码会替换旧代码，但**旧存储仍然保留**。\n- 不提供 gas 退款（相关退款已被 [EIP-3529](/eip-3529/) 移除），[EIP-2929](/eip-2929/) 的访问规则不变。\n\n改名表明\"复活\"不再给你一张白纸。\n\n## 示例代码\n\n所提议行为的伪代码：\n\n```python\nDEACTIVATED = 2**64 - 1\n\ndef op_deactivate(evm, beneficiary):\n    acct = evm.state[evm.address]\n    evm.state[beneficiary].balance += acct.balance\n    acct.balance = 0\n    acct.nonce = DEACTIVATED        # code and storage are left untouched\n\ndef execute_call(state, addr, ...):\n    if state[addr].nonce == DEACTIVATED:\n        return Success(output=b\"\")  # value transfers still credited\n\ndef create2_allowed(state, addr):\n    a = state[addr]\n    return a.nonce == DEACTIVATED or (a.nonce == 0 and not a.code)\n```\n\n按此规则打算被复活的合约，必须把已有存储视为可能已经过期：\n\n```solidity\n// On re-deploy, slots written by the previous incarnation may still be set.\nuint256 public generation;\nfunction init() external { generation += 1; /* key new data by generation */ }\n```\n\n## 需要注意\n\n- **状态：Stagnant。** 它从未被排入网络升级计划。\n- 以太坊转而采用了 [EIP-6780](/eip-6780/)（Dencun 升级）：只有在创建合约的同一笔交易中调用 `SELFDESTRUCT` 时才会删除账户，否则它只会发送余额。一个相关的早期想法是 [EIP-4758](/eip-4758/)。\n- 如果采用类似方案，自毁后重新部署的合约就需要处理遗留的存储，规范将此标记为安全隐患。\n"}}}
