EIP-7702: Native Code Delegation for EOAs
Smart-Account Evolution at a Glance
Date | What it introduced | What devs gained |
---|---|---|
EOA (2015) | Single secp256k1 key, nonce, ETH gas | Simple, but no batching, no paymasters, no custom logic |
EIP-4337 (2021) | UserOperation, EntryPoint, bundlers, paymasters | Batching, pay for gas in tokens, plug-in validation — but required deploying a new contract |
ERC-7579 (2023) | Standard module slots (validator, executor, hook…) | Drop-in extensions: session keys, spending caps, guardians |
EIP-7702 (2024) | SetCodeTransaction (type 0x04 ) — permanent delegate pointer | Turn any existing EOA into a 4337 wallet with one tx |
Key idea: 7702 is the missing bridge — it lets legacy EOAs join today’s 4337/7579 ecosystem without moving funds or changing address.
Overview
EIP‑7702 lets a plain Externally Owned Account behave like a programmable wallet—without changing its address or moving funds. A new transaction type, SetCodeTransaction
(0x04
), writes a delegation indicator (0xef0100 || delegate_address
) into the account’s code slot. From that moment, every external or internal call to the account transparently executes the code at delegate_address
in the EOA’s own storage and balance context. The owner can later update or remove the delegation with another SetCodeTransaction
.
This permanent, opt‑in pointer unlocks powerful patterns:
- Atomic call batching – one signature can approve, swap, and stake in a single transaction.
- Gas sponsorship – anyone can call the account and pay the fee; the delegate code verifies the user’s intent.
- On‑chain policy logic – spending caps, time locks, per‑app sub‑keys, or alternative auth (e.g. WebAuthn) can be enforced inside the delegate contract.
At the same time, 7702 keeps the core EOA model intact. Transactions are still signed with the original secp256k1 key; the global nonce
rules and ETH‑denominated gas costs remain unchanged; and the protocol itself knows nothing about sub‑keys, paymasters, or account abstraction. Those features live entirely in the delegate contract, which can be swapped or cleared at any time by the account owner.
Key Concepts
Native Delegation with SetCodeTransaction
EIP-7702 defines a new transaction type (0x04
) called SetCodeTransaction
. This transaction installs a special bytecode in the EOA:
0xef0100 || delegate_address
This instructs the EVM to delegate execution to delegate_address
whenever the EOA receives a call. Importantly, the EOA continues to exist as a regular account with its own key, nonce, and ETH balance.
Transaction Format
SetCodeTransaction (0x04) = rlp([
chain_id,
nonce,
max_priority_fee_per_gas,
max_fee_per_gas,
gas_limit,
destination,
value,
data,
access_list,
authorization_list, // NEW
y_parity,
r,
s
])
Authorization List
To prevent unauthorized code delegation, the authorization_list
requires off-chain approval from the account’s owner:
authorization_list = [[
chain_id,
delegate_address,
nonce,
y_parity,
r,
s
], ...]
This structure ensures only code explicitly approved by the user (via ECDSA signature) can be delegated to.
---------------------- | ------------------------------------------------------------------------------------ |
| Atomic call batching | Approve → swap → stake in one transaction. |
| Gas sponsorship | Any relayer can pay the fee; delegate code checks the user’s signed intent. |
| On‑chain policy logic | Spending caps, time locks, app‑specific sub‑keys, WebAuthn verification, etc. |
| Reversibility | Owner can clear or update the pointer at any time with another SetCodeTransaction
. |
⚠️ 7702 itself does not add session keys, passkeys, or token‑gas payments; those live in the delegate contract.
Using EIP-7702 with Smart-Account Workflows
EIP-7702 is the bridge between a plain EOA and the 4337 smart-account world. One signed message + one transaction turn an address you already own into a fully programmable wallet—while keeping the same key, balance, ENS, and history.
What 7702 adds on top of 4337
4337 alone | 4337 + 7702 |
---|---|
Requires deploying a contract (factory call, CREATE2 gas, new address) | Re-uses the existing EOA address—no factory, no asset moves |
Batching, sponsorship, modules only after deployment | Available immediately after a single “upgrade” tx |
Hard to migrate legacy users | Seamless one-click upgrade for any EOA |
Using EIP-7702 with Smart-Account Workflows
EIP-7702 is the bridge between a plain EOA and the 4337 smart-account world. One signed message + one transaction turn an address you already own into a fully programmable wallet—while keeping the same key, balance, ENS, and history.
What 7702 adds on top of 4337
4337 alone | 4337 + 7702 |
---|---|
Requires deploying a contract (factory call, CREATE2 gas, new address) | Re-uses the existing EOA address—no factory, no asset moves |
Batching, sponsorship, modules only after deployment | Available immediately after a single “upgrade” tx |
Hard to migrate legacy users | Seamless one-click upgrade for any EOA |
Conceptual upgrade flow
-
Select wallet logic
Pick any contract that already implements 4337 validation (e.g. Kernel, Simple7702Account, or your own module bundle). Call it delegate. -
User signs one authorization hash
authHash = keccak256(chainId ‖ delegate ‖ nonce)
signature = sign(authHash, EOA_private_key)This proves the EOA owner allows that delegate.
-
Install the delegate code — choose one of two ways
Path What gets broadcast Who pays L1 gas A. Direct / Relayed A single SetCodeTransaction (0x04)
that containsauthorization_list = [authTuple]
and writes0xef0100‖delegate
into the code slot.Sender (self-fund) or any relayer that signs & pays the tx. B. Bundled (4337) A UserOperation
with extra fieldeip7702Auth = authTuple
. The bundler turns it intoSetCodeTransaction + handleOps
inside one L1 tx.A paymaster inside the UserOp can cover the fee, giving a true “gasless” upgrade. -
Done — the address is now a smart-account
From the next block every call first executes the delegate in the EOA’s own storage/balance context, so all 4337 features—batched actions, paymasters, session keys, 7579 modules—work exactly as if the wallet had been factory-deployed. -
Optional: Clear or swap the delegate
Developer takeaway
- No new primitives to learn — keep building with the same 4337 abstractions; 7702 is just a pre-upgrade step.
- No address migration pain — users keep the identifiers and approvals they already use.
- Reversible — the owner can clear or swap the delegate with another
SetCodeTransaction
at any time.
EIP-7702 turns create a smart wallet
into upgrade the key you already have
— giving every existing account the modern UX of batching, gas sponsorship, and modular extensions without touching their funds.
Demo
Play Chess with WebAuth session to avoid signing a transaction every move:
References
Standards & Specifications
- EIP-7702: Native Code Delegation - Standard for delegating execution to other smart contracts.
- EIP-4337: Account Abstraction - User operation standard for smart accounts without protocol changes.
- ERC-7579: Modular Smart Accounts - Standard for smart accounts with modular functionality.
Official Documentation & Resources
- EIP-7702 Documentation - Official documentation for the Native Code Delegation standard.
- EIP-4337 Documentation - Official resources for the Account Abstraction standard.
- ERC-7579 Documentation - Official site for the Modular Smart Accounts standard.
- ERC-7579 Architecture by Safe - Detailed explanation of the 7579 architecture by the Safe team.
- EntryPoint v0.8.0 - Detailed documentation for the EntryPoint contract with native 7702 support.
Development Tools & SDKs
- viem - TypeScript library for interacting with Ethereum.
- permissionless.js - TypeScript utilities built on viem for ERC-4337 account abstraction.
- Module SDK - SDK for developing modules compatible with ERC-7579.
- Smart Sessions SDK - Tools for implementing session-based authentication.
- ModuleKit - Comprehensive toolkit for module developers by Rhinestone.
- ERC-7579 Compatible SDK - Official tooling for building with the ERC-7579 standard.
Reference Implementations
- ERC-4337 Reference Implementation - Official reference implementation for Account Abstraction.
- ERC-7579 Reference Implementation - Reference code for implementing the Modular Smart Accounts standard.
- Smart Sessions Contracts - Implementation of session-based authentication contracts.
Testing & Deployment
- Prool - Toolkit for setting up testing infrastructure.
- Kernel Deployments Status - Current deployment status for Kernel implementations.
- Module Deployment Guide - Documentation on how to deploy modules.
Registries & Metrics
- ERC-7579 Module Registry - Official registry of compatible modules.
- Account Abstraction Stats - Analytics and metrics for account abstraction usage.
- Module Ideas Repository - Collection of ideas for ERC-7579 modules.
Educational Content
Video Resources
- Account Abstraction Video Series - Comprehensive video tutorials on account abstraction.
- EIP-7702 Talk by Authors - Explanation of EIP-7702 by its core contributors.
- Smart Sessions Explained - Detailed walkthrough of session-based authentication models.
Articles & Guides
- What Are Smart Sessions? - Explanation of session keys and their implementation.
- Safe Modular Smart Account Architecture Explained - Comprehensive breakdown of modular account design.