EIPs Explained

EIP-7775 · Stagnant · Core · 2024-09-30

EIP-7775: BURN opcode

Proposes a BURN opcode (0xFC) that destroys a given amount of the current contract's native ETH, giving an explicit way to burn ether instead of sending it to unrecoverable addresses.

What problem does it solve?

The EVM has no way to destroy native ether on purpose. Contracts "burn" ETH by sending it somewhere it can never be recovered, such as the zero address, or by simply holding it with no withdrawal path, as the beacon chain deposit contract does. Indexers and accounting tools cannot tell this apart from an ordinary balance, and "burned" ETH that a bug later makes recoverable is a real risk.

EIP-7775 adds an explicit BURN opcode. The author also points to L2s sending ETH back to L1 and to other EVM chains that may want burning in their economics.

How it works

BURN (opcode 0xFC):

  1. Pops one word from the stack: the amount of wei to burn.
  2. Uses the balance of the current execution address. Under DELEGATECALL or CALLCODE, that is the calling contract's balance.
  3. If the amount is greater than the balance, it fails; an amount of 0 must not fail.
  4. Subtracts the amount from the balance. The ether no longer exists anywhere.
  5. Inside a STATICCALL it must fail, since it changes state.

Gas: 100 base, plus 2800 when a non-zero amount is burned from an existing account with a non-zero balance; otherwise 0 extra.

Sample code

Pseudocode from the spec, simplified:

def op_burn(evm):
    evm.consume_gas(100)
    amount = evm.stack.pop()
    if amount == 0:
        return
    addr = evm.current_address()
    balance = evm.state.get_balance(addr)
    if amount > balance:
        raise InsufficientBalance
    evm.state.sub_balance(addr, amount)
    evm.consume_gas(2800)

If it were adopted, burning 1 ETH from a contract would be a few bytes of raw bytecode (no compiler supports the opcode today):

PUSH8 0x0de0b6b3a7640000   // 1e18 wei
BURN                        // 0xFC: balance -= 1 ETH, ether destroyed

Things to know

  • Status is Stagnant: no activity for months, and it is not scheduled for any network upgrade. 0xFC is not a live opcode on Ethereum.
  • Ethereum already burns ETH at protocol level through the base fee of EIP-1559; this proposal is about contracts burning their own balance.
  • It would not affect ETH already stuck in existing contracts.
  • The spec notes possible misuse via DELEGATECALL (a library could burn the caller's balance) as an open issue, and leaves test cases and a reference implementation as TODO.

#evm #opcode #eth #burn #core

Details

Authors
Dev Bear (@itsdevbear)
Status
Stagnant
Type
Standards Track / Core
Created
2024-09-30

Machine-readable: Markdown · JSON