---
eip: 5003
label: EIP-5003
title: Insert Code into EOAs with AUTHUSURP
status: Withdrawn
type: Standards Track
category: Core
created: 2022-03-26
requires: 3074, 3607
official: https://eips.ethereum.org/EIPS/eip-5003
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-5003.md
canonical: https://eips.huatuo.xyz/eip-5003/
lang: en
tldr: "A withdrawn proposal for an AUTHUSURP opcode that would deploy contract code at an EOA's address, letting users migrate off their original private key for good."
tags: [account-abstraction, eoa, opcodes, core, withdrawn]
---

# EIP-5003: Insert Code into EOAs with AUTHUSURP

> Allow migrating away from ECDSA by deploying code in place of an externally owned account.

**TL;DR:** A withdrawn proposal for an AUTHUSURP opcode that would deploy contract code at an EOA's address, letting users migrate off their original private key for good.

## What problem does it solve?

Most value on Ethereum sits in externally owned accounts (EOAs), which are controlled by a single ECDSA key. EOAs cannot rotate a key, batch actions, use other signature schemes or add social recovery. If the key leaks, the only fix is moving every asset to a new address, one transaction at a time, and some rights (e.g. a hard-coded owner in a contract) cannot be moved at all.

[EIP-3074](/eip-3074/) would have let an EOA delegate authority to an "invoker" contract, but the original key would still have full power. EIP-5003 added the missing step: turn the EOA into a contract account in place, so the old key stops being able to send transactions.

## How it works

It introduces one opcode, `AUTHUSURP` (`0xf8`), which builds on EIP-3074's `AUTH`:

- Stack input: `offset`, `length` of initcode in memory. Output: the address deployed to, or zero on failure.
- It behaves like `CREATE`, except the initcode runs at, and code is deployed to, the address in EIP-3074's `authorized` context variable, i.e. the EOA that signed the `AUTH` message.
- It is invalid if no address is authorized. It skips the nonce check, because the EOA has already sent transactions.
- Base cost is 32,000 gas for an empty account, otherwise 7,000.
- It fails (returns zero) if the initcode returns empty code, or if the account already has code by the time deployment happens. This prevents usurping the same address twice.

Combined with [EIP-3607](/eip-3607/), which rejects transactions from senders that have code, the original key can no longer originate transactions once code is deployed.

## Sample code

Illustrative invoker logic (EIP-3074 + EIP-5003 opcodes never existed in Solidity, so this is pseudocode):

```text
; user signs an EIP-3074 AUTH message committing to this invoker
AUTH(authority = userEOA, commit, signature)   ; sets `authorized = userEOA`

; copy wallet initcode into memory at `ptr`
CODECOPY(ptr, walletInitcodeOffset, walletInitcodeLen)

; deploy the smart-wallet code at userEOA itself
addr = AUTHUSURP(ptr, walletInitcodeLen)
if addr == 0: revert                              ; empty code or already has code
; from now on userEOA is a contract; EIP-3607 blocks txs signed by the old key
```

## Things to know

- Status: **Withdrawn**, superseded by [EIP-7702](/eip-7702/), which lets an EOA set delegated code through a new transaction type and is live on mainnet. Its prerequisite EIP-3074 was also withdrawn.
- The authors flagged that the old key would still work *outside* transactions: anything verifying ECDSA signatures (for example ERC-2612 `permit`) would keep accepting it unless `ecrecover` itself were changed. This is the same class of concern that applies to delegated EOAs today.
- For accounts that start out as contracts, [ERC-4337](/eip-4337/) provides account abstraction without protocol changes.


---

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