Smart features for the account you already have
EIP-7702 lets an ordinary account, an EOA, point at contract code and run it as its own. It came to Ethereum with the Pectra upgrade in 2025, so an existing address can batch payments or have its gas sponsored.
One signature sets it up, and one signature on the wrong page can give your account away.
By the end of this lesson
Note
I can tell a safe EIP-7702 delegation from a dangerous one.
Key words
| Word | What it means | Example |
|---|---|---|
| Delegation | an EOA pointing at code that runs as the EOA | |
| Authorisation | the signed permission that sets a delegation | |
| Delegate | the contract an EOA points at | |
| Designator | the code an EOA is given | 0xef0100 then an address |
| Phishing | tricking somebody into signing something harmful |
The cells students fill in are left blank in this preview.
How a delegation is set
The EOA signs an authorisation: a chain id, the delegate's address and its own nonce. A new kind of transaction, type 4, carries a list of them, and anybody may send it.
Once it lands, the EOA's code becomes 0xef0100 followed by the delegate's address. Calls to the EOA now run the delegate's code with the EOA's own address and balance, until the EOA delegates somewhere else.
Delegate, batch two payments, then undo it
docker exec chain ./steps/delegate.shShown here, not run. Press Start lab to type it into your own lab’s terminal.
Worked example: what the lab printed
| Moment | Sam's code |
|---|---|
| Before | 0x |
| After the delegation | 0xef0100 followed by BatchDelegate's address |
| Mallory calls executeBatch | refused: only the account itself |
| After delegating to the zero address | 0x |
The cells students fill in are left blank in this preview.
A careful delegate checks who is calling
Read the two delegates. BatchDelegate's executeBatch starts with one line: the caller must be the account itself. So only Sam, sending to his own address, can move his money.
OpenDelegate's execute has no such line. Once an account delegates to it, anybody can call it and move that account's money.
Find the caller check in the delegates
docker exec chain grep -n "function\|msg.sender" src/Delegates.solShown here, not run. Press Start lab to type it into your own lab’s terminal.
Signing the wrong delegation
A fake page offers a reward and asks Sam to sign. What he signs is a delegation to OpenDelegate. Mallory sends it herself, paying the gas, and then calls execute on Sam's account.
In the lab Sam went from 5 ETH to 1 ETH in two transactions. He never sent anything, and his key never left him.
Watch a signed delegation empty an account
docker exec chain ./steps/phishing.shShown here, not run. Press Start lab to type it into your own lab’s terminal.
A common mistake
Warning
Many people think signing is harmless when no money is sent. A delegation is a signature that hands the account's code to somebody else. Sign one only for code you trust, shown by your own wallet.
What a wallet should warn about
Warn on a delegate that is not on a short list of reviewed contracts. Warn on chain id 0, which makes one signature valid on every chain.
Remember that the EOA's key still controls everything, delegation or not. Storage stays behind when you switch delegates, and a delegate with an initialise function can be set up by somebody else first.
Try it: read a delegation from code
code = "0xef01005fc8d32690cc91d4c39d9d3abcbd16989f875707"
prefix = code[:8]
rest = code[8:]
print("prefix:", prefix)
print("delegate: 0x" + rest)
print("hex digits after the prefix:", len(rest))
# Change code to "0x" and run it again. What should a wallet say?