Account Abstraction
An externally owned account holds a key and nothing else. It has no code, so every action it can take is one transaction, signed once, by one key. Every feature a wallet advertises — a key that expires, gas paid by somebody else, five calls as one, a cap on what a stolen key can spend, guardians who can replace the key — needs code to enforce, and an EOA has nowhere to put it. Two routes gave accounts a program: ERC-4337 builds the program beside the account model, and EIP-7702 changes the account model itself.
Authorised Targets Only
The Account That Cannot Be Programmed
An EOA is the account a private key controls. It carries a nonce, a balance and an empty code slot. When it sends a transaction it can transfer value, call a contract or deploy one, authorised only by a signature over that exact transaction. Nothing about the authorisation persists: the rule is never stored, so a second action needs a second signature.
That is enough for payments and not enough for what wallets advertise. A session key is a rule that a second key may act for a bounded time and scope; sponsored gas is a rule that a third party pays; batching is a rule that several calls all happen or none do; recovery is a rule that a quorum can replace the signer; a spending limit is a rule enforced by the account, not the interface. A wallet can implement them in software, but whoever holds the raw key talks to the chain directly.
Until Pectra the only way to enforce a rule on-chain was to stop being an EOA: deploy a contract account, move the assets, and accept a new address with new approvals and a recovery plan. The two designs below disagree about where the code goes, and that disagreement is the security story. ERC-4337 leaves the EOA alone and adds a parallel path around it; EIP-7702 gives the EOA a code pointer, so the account keeps its address and gains behaviour in place.
ERC-4337: An Account Layer Beside the Protocol
ERC-4337 is a standard rather than a fork. It defines a new object, the
UserOperation, that
is never a transaction: nothing about it touches the transaction envelope or consensus. A separate pool of user
operations is served by bundlers, and a bundler wraps one or more in an ordinary transaction addressed to a
singleton contract, the
EntryPoint.
The operation carries the sender (a contract account), a nonce, a factory for the account's first deployment, the calldata to execute, gas limits, fee fields, an optional paymaster and a signature. That signature covers a hash of the whole structure, so a bundler cannot alter the calldata or the limits without invalidating it. A bundler chooses only whether and when to include the operation — the ordering power any transaction sender has — and it pays gas up front, refunded from the EntryPoint's deposit.
The EntryPoint is the contract both bundler and account must trust. For each operation it calls the account's validation function, which checks the signature against whatever owner logic the account implements and returns a time window in which the operation is valid. If a paymaster is attached, it calls the paymaster's validation function and charges it. It then enforces the prefund, advances the nonce and executes. So the EntryPoint proves that this account accepts this operation and can pay for it, not that the operation is a good idea: application rules live in the account's execution code and the paymaster's policy, and a paymaster that validates everything is a gas faucet.
Being an add-on has costs: the account must be a contract, so its address is counterfactual until first use, and the field layout has changed between EntryPoint releases, so mixing versions builds invalid operations (the current version number is not stated here).
EIP-7702: Code by Delegation
EIP-7702 takes the other route. Pectra added a transaction type that carries an authorisation list, and each authorisation is a tuple signed by an EOA: a chain id, a delegate address, a nonce and a signature. Processing one sets the authority's code (the fork's activation date is not stated here). The signature is domain-separated, so it cannot be replayed as another kind of signed message.
What lands in the code slot is not a program. It is a 23-byte designator: the three bytes
0xef0100 followed by
the 20-byte address of the delegate. The 0xef
prefix is the one EIP-3541 reserved so it could never begin valid bytecode, so an account holding a designator is
delegated rather than deployed.
Everything else about the account stays: the address, key and nonce are unchanged, and the storage belongs to it.
When a call arrives the designator is resolved and the delegate's code runs with
address(this)
set to the account, reading and writing the account's storage and spending its balance. That is
delegatecall
semantics, with msg.sender
being whoever called the account. A delegated account is a contract to the EVM and an EOA to everything that signs:
one key, one address, no migration.
Two details matter for review. The authorisation can be submitted by anybody — the authority need not send a transaction or hold gas, because a relayer includes the tuple and pays — so a signed authorisation that leaks is usable by whoever holds it. And the delegate runs for every call to the account, not only the ones the owner initiates, which is why a delegate with no receive or fallback cuts the account off from plain ETH.
| Aspect | ERC-4337 | EIP-7702 |
|---|---|---|
| Where the code lives | A separate contract account; the EOA is not involved | A designator in the EOA's own code slot |
| Address and assets | New address; assets must be moved into it | Same address; assets stay where they are |
| Who pays gas | A bundler or paymaster, refunded from the EntryPoint | The account, or a relayer submitting the authorisation |
| Main risk | A permissive paymaster or a bug in bespoke account code | Storage collisions, initialisation races, durable authorisations |
What Delegation Changes
The designator does not create a storage namespace for the delegate. The delegate reads and writes the account's slots, and those slots are shared by every delegate the account has ever pointed at. A delegate that assumes slot 0 holds its owner reads whatever the previous delegate left there, so re-delegation is a storage-layout migration even when nobody planned one. There is also no constructor: a freshly delegated EOA starts with all-zero storage, and nothing on-chain distinguishes "not set up yet" from "set up by someone else".
Signature replay has two forms. An authorisation carries a chain id, so one signed for one chain is invalid on another; one signed with a chain id of zero is valid on every chain that accepts it, turning a single signature into a delegation on each. Within a chain the tuple is bound to the account's nonce, but a tuple that never landed stays usable until the nonce moves past it, and the submitter need not be the signer. Revocation consumes a nonce, which kills authorisations signed at lower nonces — not one signed at the same nonce, which competes with the revocation.
Revocation is narrower than it reads. Pointing the designator at
0x0000…0000 clears
it and re-delegating replaces it, but neither undoes what the delegate already did: storage it wrote stays, assets
it moved stay moved, approvals it granted stay granted. Revocation also needs gas and a reachable signer, and a
delegate that spent the balance removed the first.
The last change is the one that shows up in phishing reports. A transfer authorises a movement of specific value; a
7702 authorisation authorises code: run this contract as me, from now on, for every call. A signature read as a login
can be a permanent change to what the account does, which makes the wallet's rendering the delivery mechanism.
Assumptions elsewhere break too:
tx.origin is no
longer guaranteed code-free and
msg.sender == tx.origin
no longer implies a top-level frame.
Reviewing a Delegate
The designator is the part an inspection can prove. Read the account's code: a 23-byte value beginning
0xef0100 means
delegated, and the remaining 20 bytes are the delegate. Empty code means not delegated, and a designator pointing at
the zero address or at an address holding no code is a finding by itself, because every call to the account will
then fail or fall through.
# 23 bytes starting 0xef0100 means delegated; the tail is the delegate.
cast code $ACCOUNT --rpc-url $RPC
# 0xef0100aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
# Storage and balance belong to the account, not to the delegate.
cast storage $ACCOUNT 0 --rpc-url $RPC
Beyond that, the delegate's source answers the questions
delegatecall has
always raised, sharpened by the account's storage being a shared, uninitialised namespace:
- Does the delegate initialise, and can the initialisation happen in the same transaction as the delegation?
- Which slots does it read or write, and could a previous delegate have written them first?
- Does it branch on tx.origin, msg.sender == tx.origin, extcodesize, or address(this).code.length?
- Does it have a sweep, upgrade or rescue path, and what does that path trust?
None of these is answered by the delegate having been audited standalone: correct code that owns its storage can be wrong when it borrows an account's.
Anyone Can Be First
Three things stay outside what the designator and the source can establish. Whether this delegate is the one the owner intended, because a correct delegate chosen by a phished owner is still a compromise. Whether the account was initialised atomically, which lives in the transaction that set the designator rather than in the current state. And whether the delegate has been reviewed at all, which is a question about that address and its history.
Those three are why the code slot belongs in the same inventory as the account's approvals, and why the remediation is a delegation to the zero address followed by a review of what the delegate did while it was live.
Related Topics
Access Control
The tx.origin rule that delegation breaks, with the phishing path that makes it exploitable.
Wallet Security
What a user is asked to approve, and how a delegation authorisation differs from a transfer.
Solidity Security
The delegatecall pair this page extends: code that runs against storage it does not own.