EIPs Explained

EIP-2938 · Withdrawn · Core · 2020-09-04

EIP-2938: Account Abstraction

An early protocol-level account abstraction design that let a contract, not an ECDSA key, start and pay for a transaction via a new PAYGAS opcode; withdrawn, with the ideas living on in ERC-4337 and EIP-7702.

What problem does it solve?

On Ethereum a transaction is valid only if it carries an ECDSA signature from an externally owned account (EOA), a matching nonce and enough ETH for gas. That rigid rule blocks a lot of useful designs:

  • wallets using other signature schemes (Schnorr, BLS, post-quantum) or multisig/social recovery,
  • privacy tools where the withdrawer has no ETH yet and must not link to their deposit address,
  • paying fees in a token other than ETH,
  • DeFi transactions that should not land on-chain (and pay gas) unless some condition holds.

At the time these needed relayers, which add roughly 21,000 gas of overhead plus a profit margin. EIP-2938 instead lets a contract be the top-level account: it runs its own validation code and then agrees to pay.

How it works

  • New transaction type (via EIP-2718) with payload rlp([nonce, target, data]), no signature, and a base cost of 15,000 gas instead of 21,000.
  • Execution starts from a special entry-point address 0xffff…ffff into target. In that frame CALLER and, throughout the transaction, ORIGIN return this entry point.
  • NONCE (0x48) pushes the contract's nonce so validation code can check it.
  • PAYGAS (0x49) reads a gas price and gas limit from memory, deducts gasPrice * gasLimit from the contract's balance, and marks the fee as paid. It can only be called once, from the top-level frame.

Code before PAYGAS is the verification phase: if it fails, the transaction is invalid, like a bad signature. Code after it is the execution phase: if it reverts, state rolls back only to just after PAYGAS, and the fee is still paid.

To keep mempools safe from DoS, the proposal recommends node rules for the verification phase: the target must start with a standard AA_PREFIX, verification may use at most 90,000 gas, and it may not read environment data (TIMESTAMP, NUMBER, …), balances or other contracts' state. This ensures only a transaction to the same account can invalidate a pending one. The first stage is single-tenant AA (one wallet contract per user); multi-tenant AA for shared apps like mixers or DEXes was sketched as later work.

Sample code

Pseudocode of a single-tenant AA wallet's entry logic:

def on_aa_transaction(calldata):
    # --- verification phase (strict rules: no external reads) ---
    assert msg.sender == AA_ENTRY_POINT        # enforced by AA_PREFIX
    nonce, sig, gas_price, gas_limit, call = decode(calldata)
    assert nonce == NONCE()                    # opcode 0x48
    assert verify(owner_pubkey, hash(nonce, call, gas_price, gas_limit), sig)

    mstore(0, gas_price); mstore(32, gas_limit)
    PAYGAS(version=0, memory_start=0)          # opcode 0x49: fee committed

    # --- execution phase (failure still pays the fee) ---
    execute(call)

Things to know

  • Status: Withdrawn. The stated reason is that it is "very out of date; needs rewrite." It was never scheduled for a hard fork.
  • Its opcode numbers and transaction type 2 were never activated; type 0x02 is now the EIP-1559 transaction.
  • Account abstraction later arrived without consensus changes through ERC-4337 (an alt mempool with an EntryPoint contract, which reuses the verification/execution split and similar validation restrictions), and EOAs gained code delegation through EIP-7702.
  • Replay protection depended on either an indestructible-contract opcode or preserving nonces across SELFDESTRUCT; neither was adopted in this form.

#account-abstraction #transactions #evm #core #wallet

Details

Authors
Vitalik Buterin (@vbuterin), Ansgar Dietrichs (@adietrichs), Matt Garnett (@lightclient), Will Villanueva (@villanuevawill), Sam Wilson (@SamWilsn)
Status
Withdrawn
Type
Standards Track / Core
Created
2020-09-04
Requires

Machine-readable: Markdown · JSON