---
eip: 2937
label: EIP-2937
title: SET_INDESTRUCTIBLE opcode
status: Stagnant
type: Standards Track
category: Core
created: 2020-09-04
official: https://eips.ethereum.org/EIPS/eip-2937
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2937.md
canonical: https://eips.huatuo.xyz/eip-2937/
lang: en
tldr: A stagnant proposal for a SET_INDESTRUCTIBLE opcode (0xA8) that lets a contract permanently opt out of SELFDESTRUCT, so libraries can guarantee their code will never disappear.
tags: [core, evm, opcode, selfdestruct, stagnant]
---

# EIP-2937: SET_INDESTRUCTIBLE opcode

> Add a SETINDESTRUCTIBLE (0xA8) opcode that prevents the contract from calling SELFDESTRUCT (0xFF).

**TL;DR:** A stagnant proposal for a SET_INDESTRUCTIBLE opcode (0xA8) that lets a contract permanently opt out of SELFDESTRUCT, so libraries can guarantee their code will never disappear.

## What problem does it solve?

When this was written, any contract containing a reachable `SELFDESTRUCT` (directly, or through a `DELEGATECALL` into code that self-destructs) could wipe its own code. That is a problem for anything that other contracts depend on:

- A shared library called via `DELEGATECALL` could vanish, bricking every contract that uses it.
- Account-abstraction designs want wallets to rely on code that will "exist unmodified forever".

Auditing that no path leads to `SELFDESTRUCT` is error-prone. EIP-2937 offers a simple, verifiable promise instead: put one opcode at the very start of your code and self-destruction becomes impossible. Unlike proposals that disable `SELFDESTRUCT` for everyone, it changes nothing for existing contracts.

## How it works

- A new transaction-wide set `globals.indestructible` is added, starting empty (it works like the existing set of self-destructed accounts).
- New opcode `SET_INDESTRUCTIBLE` at `0xA8`, costing `G_base` (2 gas), adds the current executing account (`callee`) to that set.
- If `SELFDESTRUCT` runs while the current `callee` is in the set, it throws an exception.

The intended pattern is that the **first byte** of the contract's code is `0xA8`, so every execution marks it indestructible before anything else happens.

A global set is used rather than a per-frame flag because a local flag could be bypassed: the contract could `DELEGATECALL` into other code that then self-destructs in the contract's context.

## Sample code

Illustrative bytecode for a contract whose runtime begins with the proposed opcode (`0xA8` is not assigned on mainnet):

```text
A8          SET_INDESTRUCTIBLE   ; mark this account for the rest of the tx
60 00       PUSH1 0x00
35          CALLDATALOAD
...                              ; normal contract logic
33          CALLER
FF          SELFDESTRUCT         ; would now throw instead of deleting the code
```

Pseudocode of the rule:

```python
def op_set_indestructible(ctx):
    ctx.tx.indestructible.add(ctx.callee)

def op_selfdestruct(ctx, beneficiary):
    if ctx.callee in ctx.tx.indestructible:
        raise ExceptionalHalt("indestructible")
    ...  # usual SELFDESTRUCT behaviour
```

## Things to know

- Status: **Stagnant**. It was never adopted.
- Ethereum instead neutralised `SELFDESTRUCT` for everyone: since the Cancun upgrade, [EIP-6780](/eip-6780/) only deletes code when the contract was created in the same transaction. In other cases it just sends the ETH balance. Deprecation was signalled in [EIP-6049](/eip-6049/), and [EIP-4758](/eip-4758/) proposed turning it into `SENDALL`.
- The spec notes that if `SELFDESTRUCT` is removed, this opcode simply becomes a no-op. It also notes a tension with state-rent schemes that would delete old contracts.


---

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