---
eip: 4758
label: EIP-4758
title: Deactivate SELFDESTRUCT
status: Stagnant
type: Standards Track
category: Core
created: 2022-02-03
official: https://eips.ethereum.org/EIPS/eip-4758
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-4758.md
canonical: https://eips.huatuo.xyz/eip-4758/
lang: en
tldr: "Proposed turning SELFDESTRUCT into SENDALL, which only sends the contract's ETH to the target and never deletes code or storage, to prepare Ethereum for Verkle trees and statelessness."
tags: [evm, selfdestruct, opcodes, statelessness, core]
---

# EIP-4758: Deactivate SELFDESTRUCT

> Deactivate SELFDESTRUCT by changing it to SENDALL, which does recover all funds to the caller but does not delete any code or storage.

**TL;DR:** Proposed turning SELFDESTRUCT into SENDALL, which only sends the contract's ETH to the target and never deletes code or storage, to prepare Ethereum for Verkle trees and statelessness.

## What problem does it solve?

`SELFDESTRUCT` wipes an account: its code, all of its storage, and its nonce. That is a large, unbounded state change. With Verkle trees, the data of one account is spread over many keys that are not obviously linked to the account root, so deleting "everything belonging to this account" becomes impractical.

The spec argues there are no strong reasons left to use `SELFDESTRUCT`, and that disabling it is a requirement for statelessness.

## How it works

At a hard fork:

- The `SELFDESTRUCT` opcode (`0xff`) is renamed **`SENDALL`**.
- It now only moves all of the account's ETH to the target address, immediately.
- It **no longer** deletes code or storage and does not change the nonce.
- All gas refunds related to `SELFDESTRUCT` are removed.

Contracts that only used `SELFDESTRUCT` to sweep their ETH keep working. What breaks:

- **Metamorphic / redeploy patterns**: destroying a contract and re-creating different code at the same address with `CREATE2`. After this change the old code never goes away, so redeployment fails. The spec says upgradeability should use delegate-call proxies instead.
- **"Destroy to lock" patterns**, where a contract self-destructs at the end of an operation so nobody else can use it.
- Using `SELFDESTRUCT` to burn non-ETH tokens held by the contract (the authors knew of no such use).

## Sample code

Code that only uses `selfdestruct` to sweep funds behaves the same under SENDALL, except the contract stays alive afterwards:

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

contract Piggy {
    address public immutable owner = msg.sender;
    receive() external payable {}

    function smash() external {
        require(msg.sender == owner, "not owner");
        // Before: ETH sent to owner AND code/storage deleted.
        // Under EIP-4758 (SENDALL): ETH sent to owner, contract keeps its code.
        selfdestruct(payable(owner));
    }
}
```

A safer pattern that works under any rule set:

```solidity
function withdrawAll() external {
    require(msg.sender == owner, "not owner");
    (bool ok, ) = owner.call{value: address(this).balance}("");
    require(ok, "send failed");
}
```

## Things to know

- Status: **Stagnant**. Ethereum took a softer route: [EIP-6049](/eip-6049/) formally deprecated `SELFDESTRUCT`, and [EIP-6780](/eip-6780/) (Cancun) restricts it so code and storage are only deleted when the contract was created in the same transaction. Otherwise it just sends the ETH, which is close to SENDALL.
- Like SENDALL, `SELFDESTRUCT` still sends ETH without calling the recipient, so a contract can receive ETH without its `receive` function running. Do not rely on `address(this).balance` for accounting.
- Solidity compilers emit a deprecation warning for `selfdestruct`; avoid it in new code.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-4758
