EIP-5003 Planting code on an EOA with AUTHUSURP (Insert Code into EOAs with AUTHUSURP)
No call decision · Account abstraction · EIP status Withdrawn · created 2022-03-26
Proposes a method for deploying code, via the AUTHUSURP opcode, to an address authorized under EIP-3074, fully revoking the authority of the EOA's original signing key and converting it into a contract account.
Why it is needed
EOAs (externally owned accounts) do not support features like key rotation, batching multiple operations together, or fee sponsorship (sponsored transactions), and there is no way to recover if a private key is leaked. Moving to a new mnemonic also requires sending a separate transaction for each asset, which is costly, and in some cases owner permissions hardcoded into contracts cannot be moved at all. With EIP-3074, an EOA can delegate authority to a smart contract, but the original signing key's authority remains in place, so the leak risk persists. By deploying code to an authorized address via a new opcode, AUTHUSURP, and applying it together with EIP-3607, this EIP sought to permanently neutralize the original signing key's authority, opening a path for existing EOA users to move to contract-account-level security as well.
What changes
Today
- EOAs do not support features such as key rotation, batching, or fee sponsorship.
- If a private key is leaked, there is no way to fully safely move the assets away.
- Even after delegating authority via EIP-3074, the original signing key's authority remains intact.
After EIP-5003
- Deploying code to an authorized address via AUTHUSURP turns that address into a contract account.
- Combined with EIP-3607, this revokes the original ECDSA signing key's ability to send transactions.
- An EOA can be fully converted into a contract account in a single procedure.
Who is affected
- EOA users: Users who previously had no way to recover from a leaked private key could gain a path to neutralize that key by converting to a contract account.
- Wallet & app developers: Combined with EIP-3074, this could enable the design of a migration feature that turns an EOA into a smart contract wallet.
- Client teams: Alongside implementing the new opcode, modifications such as changes to the ecrecover precompile, to prevent abuse of permit signatures, also had to be considered together.
In depth
The AUTHUSURP opcode (0xf8)
Takes two values, offset and length, from the stack and returns a single address. Its behavior is nearly identical to CREATE (0xf0), but if the authorized variable defined in EIP-3074 is not set, execution is treated as invalid and consumes all remaining gas. The init code executes in the place of the authorized address, and the code it returns is deployed directly to that address.
Gas cost branching
If the account pointed to by authorized is an empty account (balance 0, nonce 0, no code), static_gas stays at 32,000, the same as CREATE. Otherwise, i.e., for an ordinary EOA that has already sent a transaction, static_gas becomes 7,000.
Why the nonce check is skipped
AUTHUSURP does not check the nonce of the authorized account. This is because it must also work on an existing EOA that has already sent multiple transactions, i.e., one whose nonce is not zero. Instead, it was defined that if the init code returns empty code (length 0), that execution frame is reverted and AUTHUSURP returns 0; otherwise, AUTHUSURP could keep being used again and again on the same address afterward.
Re-checking code existence to prevent reentrancy
After executing the init code, right before deploying the code, if that account's code is already non-empty, the execution frame is reverted and 0 is returned. This is a safeguard against calling AUTHUSURP again on the same address from within the init code itself. Other deployment opcodes prevent this problem by incrementing and checking the nonce, but since AUTHUSURP does not use a nonce check, this additional check is necessary.
Combination with EIP-3607 is the key
AUTHUSURP itself only deploys code; preventing further transactions from being sent from that address via an ECDSA signature is the role of EIP-3607. Only when the two are applied together is the original signing key's transaction-sending authority effectively revoked, and this is an entirely new kind of behavior that changes the authority structure of an already-active account, unlike CREATE2, which places code at a previously empty address.
Off-chain signatures (such as permit) risk remaining valid
Contracts that use ECDSA signatures for purposes other than transactions, such as a token's permit function, have no way of knowing that an account has been usurped and is no longer controlled by its private key holder. In other words, the original private key still retains access to signature-based functions like permit, and the original text states explicitly that this can only be mitigated by modifying the ecrecover precompile.
Status: Withdrawn, superseded by EIP-7702
This proposal has status Withdrawn, with the withdrawal-reason stating it was superseded by EIP-7702. In other words, AUTHUSURP and its approach of injecting code into EOAs was never actually implemented, and EIP-7702, which later addressed the same goal (an account abstraction path that puts code on EOAs) via a different mechanism, took over that role. It also required EIP-3074 and EIP-3607 as prerequisites.