{"eip":6049,"title":"Deprecate SELFDESTRUCT","description":"Deprecate SELFDESTRUCT by discouraging its use and warning about a potential future behavior change.","authors":["William Entriken (@fulldecent)"],"status":"Final","type":"Meta","created":"2022-11-27","discussionsTo":"https://ethereum-magicians.org/t/deprecate-selfdestruct/11907","repo":"EIPs","label":"EIP-6049","officialUrl":"https://eips.ethereum.org/EIPS/eip-6049","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-6049.md","url":"https://eips.huatuo.xyz/eip-6049/","tldr":{"en":"A Meta EIP that formally deprecated the SELFDESTRUCT opcode and warned developers that its behaviour would change, which EIP-6780 later did in the Cancun upgrade.","ja":"SELFDESTRUCT オペコードを正式に非推奨とし、その挙動が変わることを開発者に警告した Meta EIP。後に EIP-6780 が Cancun アップグレードで実際に変更した。","ko":"SELFDESTRUCT opcode를 공식적으로 폐기(deprecated)하고 그 동작이 바뀔 것이라고 개발자에게 경고한 Meta EIP. 이후 EIP-6780이 Cancun 업그레이드에서 실제로 변경했다.","zh":"一份 Meta EIP，正式弃用 SELFDESTRUCT 操作码，并警告开发者其行为将会改变；EIP-6780 后来在 Cancun 升级中实现了这一改变。"},"tags":["selfdestruct","opcode","deprecation","meta","evm"],"explainers":{"en":{"lang":"en","tldr":"A Meta EIP that formally deprecated the SELFDESTRUCT opcode and warned developers that its behaviour would change, which EIP-6780 later did in the Cancun upgrade.","tags":["selfdestruct","opcode","deprecation","meta","evm"],"related":[6780,4758,3529],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-6049/","markdown":"## What problem does it solve?\n\n`SELFDESTRUCT` deletes a contract's code and storage and sends its ETH to a beneficiary. Core developers had long wanted to change or remove it. It complicates client design and stateless-Ethereum plans, and it lets a contract be destroyed and redeployed with different code at the same address (via `CREATE2`). But many contracts relied on it, and every year without a warning made any eventual change more disruptive.\n\nEIP-6049 changes nothing in the protocol. It is the official notice: **do not use `SELFDESTRUCT`; a breaking change is coming.** Developers got a clear signal before the actual change landed.\n\n## How it works\n\n- Documentation of the opcode (including non-normative text in the Yellow Paper) is updated to mark it deprecated and to warn of a future breaking change.\n- No client changes: the opcode kept working exactly as before when this EIP was accepted.\n- Compiler tooling followed suit. Solidity emits a deprecation warning for `selfdestruct` starting with 0.8.18.\n\nWhat happened next: [EIP-6780](/eip-6780/), activated in the Cancun upgrade (March 2024), restricted `SELFDESTRUCT`. It now only deletes the account if called in the **same transaction** the contract was created. Otherwise it just sends the contract's ETH to the beneficiary and leaves code and storage in place.\n\n## Sample code\n\nPatterns that relied on `SELFDESTRUCT`, and what to do instead:\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract Legacy {\n    address immutable owner = msg.sender;\n\n    // DEPRECATED: after EIP-6780 this no longer deletes code or storage\n    // (unless called in the creating transaction). It only moves the ETH.\n    function kill() external {\n        require(msg.sender == owner);\n        selfdestruct(payable(owner)); // compiler warning since 0.8.18\n    }\n}\n\ncontract Modern {\n    address immutable owner = msg.sender;\n    bool public disabled;\n\n    // Prefer an explicit \"off switch\" plus a normal withdrawal.\n    function disable() external {\n        require(msg.sender == owner);\n        disabled = true;\n        (bool ok, ) = owner.call{value: address(this).balance}(\"\");\n        require(ok);\n    }\n\n    modifier whenEnabled() { require(!disabled, \"disabled\"); _; }\n}\n```\n\n## Things to know\n\n- Status: **Final**. Type: Meta. It is a documentation and process change only.\n- Do not design upgrade schemes around \"selfdestruct then redeploy with `CREATE2`\" (metamorphic contracts). Since Cancun this no longer works outside the creation transaction.\n- Sending ETH via `SELFDESTRUCT` still bypasses the recipient's `receive`/`fallback`. Contracts should never assume their balance only changes through their own functions.\n- Earlier proposals to neuter the opcode include [EIP-4758](/eip-4758/) (Stagnant). [EIP-3529](/eip-3529/) had already removed the gas refund for `SELFDESTRUCT` in the London upgrade.\n"},"ja":{"lang":"ja","tldr":"SELFDESTRUCT オペコードを正式に非推奨とし、その挙動が変わることを開発者に警告した Meta EIP。後に EIP-6780 が Cancun アップグレードで実際に変更した。","tags":["selfdestruct","opcode","deprecation","meta","evm"],"related":[6780,4758,3529],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-6049/","markdown":"## 何を解決するのか\n\n`SELFDESTRUCT` はコントラクトのコードとストレージを削除し、その ETH を受取先に送ります。コア開発者は長い間これを変更または削除したいと考えていました。クライアントの設計やステートレス Ethereum の計画を複雑にし、（`CREATE2` を通じて）コントラクトを破棄して、同じアドレスに異なるコードで再デプロイできてしまうからです。しかし多くのコントラクトがこれに依存しており、警告なしに年月が過ぎるほど、将来の変更の影響は大きくなっていきます。\n\nEIP-6049 はプロトコルに何も変更を加えません。これは公式の通知です。**`SELFDESTRUCT` を使わないでください。破壊的変更が来ます。** 開発者は、実際の変更が入る前に明確なシグナルを受け取りました。\n\n## 仕組み\n\n- このオペコードのドキュメント（Yellow Paper の規範的でない記述を含む）が更新され、非推奨であることと将来の破壊的変更が警告されます。\n- クライアントの変更はありません。この EIP が受理された時点では、オペコードはそれまでとまったく同じように動作し続けました。\n- コンパイラのツールもそれに続きました。Solidity は 0.8.18 以降、`selfdestruct` に対して非推奨の警告を出します。\n\nその後どうなったか: Cancun アップグレード（2024 年 3 月）で有効化された [EIP-6780](/eip-6780/) が `SELFDESTRUCT` を制限しました。現在は、コントラクトが作成されたのと**同じトランザクション**内で呼ばれた場合にのみアカウントを削除します。それ以外では、コントラクトの ETH を受取先に送るだけで、コードとストレージはそのまま残ります。\n\n## サンプルコード\n\n`SELFDESTRUCT` に依存していたパターンと、代わりにすべきこと:\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract Legacy {\n    address immutable owner = msg.sender;\n\n    // DEPRECATED: after EIP-6780 this no longer deletes code or storage\n    // (unless called in the creating transaction). It only moves the ETH.\n    function kill() external {\n        require(msg.sender == owner);\n        selfdestruct(payable(owner)); // compiler warning since 0.8.18\n    }\n}\n\ncontract Modern {\n    address immutable owner = msg.sender;\n    bool public disabled;\n\n    // Prefer an explicit \"off switch\" plus a normal withdrawal.\n    function disable() external {\n        require(msg.sender == owner);\n        disabled = true;\n        (bool ok, ) = owner.call{value: address(this).balance}(\"\");\n        require(ok);\n    }\n\n    modifier whenEnabled() { require(!disabled, \"disabled\"); _; }\n}\n```\n\n## 知っておくべきこと\n\n- ステータス: **Final**。タイプ: Meta。ドキュメントとプロセスの変更のみです。\n- 「selfdestruct してから `CREATE2` で再デプロイする」（メタモルフィックコントラクト）ことを前提にアップグレード方式を設計しないでください。Cancun 以降、作成トランザクション以外ではこれは機能しません。\n- `SELFDESTRUCT` による ETH の送金は、受取側の `receive`/`fallback` を今も迂回します。コントラクトは、自分の残高が自身の関数を通じてのみ変化すると決して想定してはいけません。\n- このオペコードを無力化する以前の提案には [EIP-4758](/eip-4758/)（Stagnant）があります。[EIP-3529](/eip-3529/) は London アップグレードで、すでに `SELFDESTRUCT` のガス払い戻しを削除していました。\n"},"ko":{"lang":"ko","tldr":"SELFDESTRUCT opcode를 공식적으로 폐기(deprecated)하고 그 동작이 바뀔 것이라고 개발자에게 경고한 Meta EIP. 이후 EIP-6780이 Cancun 업그레이드에서 실제로 변경했다.","tags":["selfdestruct","opcode","deprecation","meta","evm"],"related":[6780,4758,3529],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-6049/","markdown":"## 어떤 문제를 해결하나요?\n\n`SELFDESTRUCT`는 컨트랙트의 코드와 스토리지를 삭제하고 그 ETH를 수혜자에게 보냅니다. 코어 개발자들은 오래전부터 이를 바꾸거나 제거하고 싶어 했습니다. 클라이언트 설계와 스테이트리스 이더리움 계획을 복잡하게 하고, (`CREATE2`를 통해) 컨트랙트를 파괴한 뒤 같은 주소에 다른 코드로 다시 배포할 수 있게 하기 때문입니다. 하지만 많은 컨트랙트가 이에 의존했고, 경고 없이 해가 지날수록 결국의 변경은 더 큰 혼란을 일으키게 됩니다.\n\nEIP-6049는 프로토콜에서 아무것도 바꾸지 않습니다. 공식 공지입니다. **`SELFDESTRUCT`를 쓰지 마세요. 호환성을 깨는 변경이 옵니다.** 개발자들은 실제 변경이 적용되기 전에 분명한 신호를 받았습니다.\n\n## 어떻게 동작하나요?\n\n- 이 opcode의 문서(Yellow Paper의 비규범적 텍스트 포함)를 갱신해 폐기되었음을 표시하고 향후 호환성을 깨는 변경을 경고합니다.\n- 클라이언트 변경은 없습니다. 이 EIP가 수락되었을 때 opcode는 이전과 똑같이 계속 동작했습니다.\n- 컴파일러 도구도 뒤따랐습니다. Solidity는 0.8.18부터 `selfdestruct`에 대해 폐기 경고를 냅니다.\n\n그 후에 일어난 일: Cancun 업그레이드(2024년 3월)에서 활성화된 [EIP-6780](/eip-6780/)이 `SELFDESTRUCT`를 제한했습니다. 이제는 컨트랙트가 생성된 **같은 트랜잭션**에서 호출될 때만 계정을 삭제합니다. 그렇지 않으면 컨트랙트의 ETH를 수혜자에게 보낼 뿐 코드와 스토리지는 그대로 둡니다.\n\n## 샘플 코드\n\n`SELFDESTRUCT`에 의존하던 패턴과 대신 해야 할 일:\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract Legacy {\n    address immutable owner = msg.sender;\n\n    // DEPRECATED: after EIP-6780 this no longer deletes code or storage\n    // (unless called in the creating transaction). It only moves the ETH.\n    function kill() external {\n        require(msg.sender == owner);\n        selfdestruct(payable(owner)); // compiler warning since 0.8.18\n    }\n}\n\ncontract Modern {\n    address immutable owner = msg.sender;\n    bool public disabled;\n\n    // Prefer an explicit \"off switch\" plus a normal withdrawal.\n    function disable() external {\n        require(msg.sender == owner);\n        disabled = true;\n        (bool ok, ) = owner.call{value: address(this).balance}(\"\");\n        require(ok);\n    }\n\n    modifier whenEnabled() { require(!disabled, \"disabled\"); _; }\n}\n```\n\n## 알아둘 점\n\n- 상태: **Final**. 유형: Meta. 문서와 프로세스의 변경일 뿐입니다.\n- \"selfdestruct 후 `CREATE2`로 재배포\"(메타모픽 컨트랙트)를 전제로 업그레이드 방식을 설계하지 마세요. Cancun 이후 생성 트랜잭션 밖에서는 더 이상 동작하지 않습니다.\n- `SELFDESTRUCT`로 ETH를 보내면 여전히 수신자의 `receive`/`fallback`을 우회합니다. 컨트랙트는 자신의 잔액이 자기 함수를 통해서만 바뀐다고 절대 가정해서는 안 됩니다.\n- 이 opcode를 무력화하려던 이전 제안으로는 [EIP-4758](/eip-4758/)(Stagnant)이 있습니다. [EIP-3529](/eip-3529/)는 London 업그레이드에서 이미 `SELFDESTRUCT`의 가스 환급을 제거했습니다.\n"},"zh":{"lang":"zh","tldr":"一份 Meta EIP，正式弃用 SELFDESTRUCT 操作码，并警告开发者其行为将会改变；EIP-6780 后来在 Cancun 升级中实现了这一改变。","tags":["selfdestruct","opcode","deprecation","meta","evm"],"related":[6780,4758,3529],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-6049/","markdown":"## 它解决什么问题？\n\n`SELFDESTRUCT` 会删除合约的代码和存储，并把它的 ETH 发送给受益人。核心开发者早就希望修改或移除它。它使客户端设计和无状态以太坊的规划变得复杂，还让合约可以被销毁后（通过 `CREATE2`）在同一地址以不同代码重新部署。但许多合约依赖它，每多一年没有警告，最终的任何改动造成的破坏就越大。\n\nEIP-6049 不改变协议中的任何内容。它是一份正式通知：**不要使用 `SELFDESTRUCT`；破坏性变更即将到来。** 在实际变更落地之前，开发者得到了明确的信号。\n\n## 它如何运作\n\n- 更新该操作码的文档（包括 Yellow Paper 中的非规范性文字），标明其已被弃用，并警告未来会有破坏性变更。\n- 客户端没有变化：该 EIP 被接受时，操作码的工作方式与之前完全相同。\n- 编译器工具链随之跟进。从 0.8.18 起，Solidity 会对 `selfdestruct` 发出弃用警告。\n\n后来发生的事：在 Cancun 升级（2024 年 3 月）中激活的 [EIP-6780](/eip-6780/) 限制了 `SELFDESTRUCT`。它现在只有在合约被创建的**同一笔交易**中被调用时才会删除账户。否则，它只会把合约的 ETH 发送给受益人，代码和存储原样保留。\n\n## 示例代码\n\n依赖 `SELFDESTRUCT` 的模式，以及应改用的做法：\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract Legacy {\n    address immutable owner = msg.sender;\n\n    // DEPRECATED: after EIP-6780 this no longer deletes code or storage\n    // (unless called in the creating transaction). It only moves the ETH.\n    function kill() external {\n        require(msg.sender == owner);\n        selfdestruct(payable(owner)); // compiler warning since 0.8.18\n    }\n}\n\ncontract Modern {\n    address immutable owner = msg.sender;\n    bool public disabled;\n\n    // Prefer an explicit \"off switch\" plus a normal withdrawal.\n    function disable() external {\n        require(msg.sender == owner);\n        disabled = true;\n        (bool ok, ) = owner.call{value: address(this).balance}(\"\");\n        require(ok);\n    }\n\n    modifier whenEnabled() { require(!disabled, \"disabled\"); _; }\n}\n```\n\n## 需要注意\n\n- 状态：**Final**。类型：Meta。它只是文档和流程上的变更。\n- 不要围绕\"selfdestruct 然后用 `CREATE2` 重新部署\"（变形合约）来设计升级方案。自 Cancun 起，在创建交易之外这已不再有效。\n- 通过 `SELFDESTRUCT` 发送 ETH 仍然会绕过接收方的 `receive`/`fallback`。合约永远不应假设自己的余额只会通过自己的函数发生变化。\n- 之前削弱该操作码的提案包括 [EIP-4758](/eip-4758/)（Stagnant）。[EIP-3529](/eip-3529/) 在 London 升级中已经移除了 `SELFDESTRUCT` 的 gas 退款。\n"}}}
