What is account abstraction? How ERC-4337 smart accounts work

Covalent TeamUpdated 13 min read

Account abstraction makes a wallet a smart contract. How ERC-4337 works: UserOperations, bundlers, the EntryPoint, account factories, paymasters and EIP-7702.

Account abstraction lets a wallet be a smart contract that sets its own rules for who can spend from it and how gas is paid, instead of an account that one private key controls completely. On Ethereum and other EVM chains it mostly means ERC-4337, which adds smart accounts without changing the protocol. This guide explains what problem it solves, how a UserOperation travels through a bundler and the EntryPoint contract, where a smart account's address comes from, what paymasters do, and how EIP-7702 fits in.

What is account abstraction?

Ethereum has two kinds of account. An externally owned account (EOA) is controlled by a private key and is the only kind that can start a transaction. A contract account is controlled by its code but can only act when something calls it. The Ethereum accounts guide covers both in detail.

Ethereum's two account types: an externally owned account controlled by a private key, and a contract account controlled by its code.
The two kinds of Ethereum account

Account abstraction removes that split from the user's point of view: the user's account is a contract (a smart account), and what makes an action valid is whatever its code says, not one fixed signature scheme. The account can check a passkey, require two signers out of three, allow a limited session key, or let someone else pay its gas.

Why EOAs need it

An EOA has fixed rules that every wallet built on it inherits:

  • One key controls everything. Lose the private key or seed phrase and the account is gone; leak it and everything in it can be taken. There's no recovery, no second signer and no spending limit.
  • Every action needs ETH for gas. A new user who receives tokens can't move them until they also get the chain's native token, usually from an exchange.
  • One call per transaction. Approving a token and then swapping it is two transactions, two signatures and two fees.
  • One signature scheme. Transactions must be signed with secp256k1 ECDSA, so a phone's passkey (WebAuthn, P-256) can't sign one directly.

What account abstraction makes possible

Because the account is code, the rules above become choices:

  • Batching. Several calls in one operation, such as approve and a swap, that succeed or fail together.
  • Sponsored gas. A paymaster can pay an operation's gas, so an app can cover its users' fees, or let them pay in an ERC-20 token instead of ETH.
  • Custom signature schemes. The account can verify passkeys (WebAuthn), multisig thresholds or other key types, which also allows social recovery and key rotation without moving funds.
  • Security policies. Spending limits, allowlists, time locks and session keys that can only call certain contracts for a limited time.

How ERC-4337 works

ERC-4337 does all of this with contracts and off-chain infrastructure, without a hard fork. The ERC is Final, its first EntryPoint went live on Ethereum mainnet in 2023, and each EntryPoint version is deployed at the same address on every chain that has it. An operation passes through five components:

  1. UserOperation. Instead of a transaction, the account's owner signs a UserOperation: a structure describing what the smart account should do (its callData), how much gas it may use, what it pays per gas and, optionally, which paymaster pays. The signature's format is up to the account.
  2. Bundler. UserOperations go to a separate mempool. A bundler is a node that picks them up, simulates each one to check that it will validate and pay, and packs a set of them into one ordinary transaction calling the EntryPoint's handleOps. The bundler pays that transaction's gas from its own EOA and is reimbursed by the operations it includes.
  3. EntryPoint. A singleton contract, one per ERC-4337 version. handleOps runs two loops. In the verification loop it deploys the account if needed, calls the account's validateUserOp (and the paymaster's validatePaymasterUserOp), and checks that the account or paymaster has deposited enough to pay. In the execution loop it calls the account with each operation's callData, then refunds unused gas and pays the collected fees to the bundler.
  4. Smart account. The contract that holds the funds. It validates the UserOperation by its own rules (it must only trust calls from the EntryPoint) and then executes the call, often through an execute or executeBatch function.
  5. Paymaster and aggregator (optional). A paymaster agrees to pay the operation's gas. An aggregator validates one aggregated signature for many UserOperations at once, so a bundle of BLS-signed operations, for example, needs a single signature check.
UserOperations flow from senders into the UserOperation mempool, a bundler packs them into one bundle transaction to the EntryPoint contract, which validates and executes each one on the smart account, with a paymaster optionally paying gas.
How a UserOperation reaches a smart account under ERC-4337

If an operation's execution reverts, only that operation's calls are undone: the EntryPoint still charges its gas, records success = false in its UserOperationEvent, and carries on with the rest of the bundle. A failed validation, by contrast, makes the whole handleOps call revert with a FailedOp error, which is why bundlers simulate every operation before including it and drop any that wouldn't validate.

What's in a UserOperation

EntryPoint v0.6 takes a UserOperation with these fields:

Field What it holds
sender The smart account sending the operation.
nonce Anti-replay value, managed by the EntryPoint (a 192-bit key plus a 64-bit sequence).
initCode Factory address followed by the call that deploys the account; empty once it exists.
callData The call the account makes, such as execute or executeBatch with its arguments.
callGasLimit Gas for the execution call.
verificationGasLimit Gas for validation (and deployment, when initCode is set).
preVerificationGas Extra gas paid to the bundler for overhead the EntryPoint can't measure, such as calldata.
maxFeePerGas Maximum fee per gas, as in EIP-1559.
maxPriorityFeePerGas Maximum priority fee per gas, as in EIP-1559.
paymasterAndData Paymaster address followed by data for it; empty if the account pays its own gas.
signature Whatever the account needs to authorize the operation; the EntryPoint never interprets it.

From v0.7, the bundler RPC takes the same information with the packed fields split out (factory and factoryData instead of initCode, and paymaster, paymasterVerificationGasLimit, paymasterPostOpGasLimit and paymasterData instead of paymasterAndData), and the EntryPoint receives it as a smaller PackedUserOperation. This is the v0.7 struct from the reference implementation:

struct PackedUserOperation {    address sender;    uint256 nonce;    bytes initCode;              // factory address + factoryData, or empty    bytes callData;    bytes32 accountGasLimits;    // verificationGasLimit (16 bytes) + callGasLimit (16 bytes)    uint256 preVerificationGas;    bytes32 gasFees;             // maxPriorityFeePerGas (16 bytes) + maxFeePerGas (16 bytes)    bytes paymasterAndData;      // paymaster + paymasterVerificationGasLimit + paymasterPostOpGasLimit + paymasterData    bytes signature;}

The account signs the userOpHash, a hash of every field except signature, together with the EntryPoint address and the chain ID, so an operation can't be replayed on another chain or EntryPoint. From v0.8 that hash is an EIP-712 typed-data hash.

Apps talk to a bundler over JSON-RPC, with methods defined in ERC-7769:

  • eth_estimateUserOperationGas returns preVerificationGas, verificationGasLimit and callGasLimit (and the paymaster's verification gas limit when a paymaster is set) for an operation that may still lack its gas fields.
  • eth_sendUserOperation takes the operation and the EntryPoint address, simulates it and, if it's accepted into the mempool, returns its userOpHash.
  • eth_getUserOperationReceipt returns the result once the operation is included: the transaction it landed in, whether it succeeded and the gas it cost. eth_getUserOperationByHash returns the operation itself.
{    "jsonrpc": "2.0",    "id": 1,    "method": "eth_sendUserOperation",    "params": [        {            "sender": "0x…",            "nonce": "0x…",            "factory": "0x…",            "factoryData": "0x…",            "callData": "0x…",            "callGasLimit": "0x…",            "verificationGasLimit": "0x…",            "preVerificationGas": "0x…",            "maxFeePerGas": "0x…",            "maxPriorityFeePerGas": "0x…",            "paymaster": "0x…",            "paymasterVerificationGasLimit": "0x…",            "paymasterPostOpGasLimit": "0x…",            "paymasterData": "0x…",            "signature": "0x…"        },        "0x0000000071727De22E5E9d8BAf0edAc6f37da032"    ]}

factory and factoryData are only sent with an account's first operation, and the four paymaster fields only when a paymaster pays.

Batching shows why the callData field matters. To approve a token and swap it in one step, the app encodes a single call to the account's batch function, such as SimpleAccount's executeBatch, with two inner calls: approve on the token and the swap on the router. The owner signs once, the bundler submits one operation, and if the swap reverts, the approval is undone with it. In practice, account abstraction SDKs build, estimate and sign all of this for you.

Where a smart account's address comes from

The sender of a UserOperation is the smart account, and it has an address before it exists. Accounts are deployed by a factory contract that uses CREATE2, so the address depends only on the factory, a salt and the account's init code, which includes the owner. The eth-infinitism reference SimpleAccountFactory, for example, has getAddress(owner, salt) to compute it and createAccount(owner, salt) to deploy it. The contract address guide explains how CREATE2 derives an address.

This counterfactual address behaves like a new EOA: the wallet can show it and receive funds at it before anything is deployed, and nobody else can deploy a different account there, because the owner is part of what the address commits to. The EntryPoint's getSenderAddress returns it for a given initCode too.

The account is deployed by its own first UserOperation. That operation carries initCode (v0.6) or factory and factoryData (v0.7 and later). In the verification loop the EntryPoint sees the sender has no code, calls the factory through a separate helper contract, SenderCreator (so the factory call never comes from the trusted EntryPoint itself), checks that the factory created exactly the sender address, and emits AccountDeployed(userOpHash, sender, factory, paymaster). Then it validates and executes the operation as usual. If the account already exists, initCode is ignored. ERC-4337 describes this under first-time account creation.

Paymasters

A paymaster is a contract that pays a UserOperation's gas instead of the account. For each operation that names it, the EntryPoint calls two functions on it:

  • validatePaymasterUserOp(userOp, userOpHash, maxCost) in the verification loop. The paymaster decides whether it will pay, and may return a context for later.
  • postOp(mode, context, actualGasCost, …) after execution, only if it returned a non-empty context. Here it learns the actual cost and whether the operation succeeded or reverted, and can, for example, charge the user that amount.

Two kinds are common:

  • Verifying (sponsoring) paymasters pay for operations that an off-chain signer has approved. The sponsor's service checks the operation against its rules, signs it, and the signature goes in paymasterData; the contract only checks that signature. The rules themselves (which apps, contracts, users or spend limits to sponsor) are a sponsorship policy kept off-chain by whoever runs the paymaster.
  • ERC-20 token paymasters pay the gas in ETH and take payment from the user in a token, typically pre-charging the maximum in validation and refunding the difference in postOp.

The EntryPoint doesn't take the gas from the paymaster's own balance but from its deposit in the EntryPoint, which it tops up with depositTo(paymaster) and can read with balanceOf(paymaster). If the deposit can't cover an operation, the operation fails validation, so a sponsoring paymaster has to keep it funded. A paymaster that uses storage during validation must also lock a separate stake with addStake; bundlers check the stake and can throttle or ban paymasters whose operations fail. To watch a paymaster's deposit, spend and refills onchain, see monitor a paymaster in the UserOps guide.

EntryPoint versions

Each EntryPoint version is a different contract, and each smart account is built for one of them. These are the addresses in viem's constants:

EntryPoint Address
v0.6 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789
v0.7 0x0000000071727De22E5E9d8BAf0edAc6f37da032
v0.8 0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108

v0.7 introduced the PackedUserOperation and separate paymaster gas limits. v0.8 added support for EIP-7702 accounts and the EIP-712 userOpHash. A new project should use v0.7 or later; v0.6 is only worth it for accounts already deployed against it.

EIP-7702 vs ERC-4337

EIP-7702, live on Ethereum mainnet since the Pectra upgrade in May 2025, lets an existing EOA delegate to smart contract code: the EOA signs an authorization, and from then on calls to its address run the delegate contract's code. The user keeps their address and history and gains batching and other smart account features.

The two answer different questions. ERC-4337 is the infrastructure that sends operations on an account's behalf: the UserOperation format, the bundler mempool, the EntryPoint and paymasters. EIP-7702 is a way for an EOA to become a smart account without moving to a new address. They're often used together: a delegated EOA can point at an ERC-4337-compatible implementation and send UserOperations, so a paymaster can sponsor its gas. Unlike an ERC-4337 smart account deployed by a factory, a 7702 account still has its original private key, which can sign ordinary transactions or a new delegation, so the key remains a single point of failure.

Native account abstraction on other chains

Some chains build account abstraction into the protocol instead of adding it with contracts. On ZKsync Era, accounts can be contracts that implement an IAccount interface and start transactions themselves, and paymasters are part of the protocol. Starknet has no EOAs at all: every account is a contract that defines its own validation. ERC-4337 exists because Ethereum's protocol still lets only EOAs start transactions.

See account abstraction onchain

Every UserOperation leaves logs on its EntryPoint: a UserOperationEvent with the userOpHash, the sender (smart account), the paymaster, the nonce, whether it succeeded and the gas it cost, plus an AccountDeployed event when the operation deployed the account. The transaction that carries them is sent by the bundler to the EntryPoint, so a smart account's activity shows up in its logs rather than as transactions from its address.

The GoldRush Foundational API returns these logs decoded into named parameters, through log events by contract address for everything an EntryPoint handled, or log events by topic hash filtered on the sender topic for one account. Log events by contract address costs 0.01 per item and log events by topic hash 0.01 per item, in GoldRush credits; the pricing calculator estimates a month of calls. How to fetch UserOps for a wallet address has the working queries, and the account abstraction SDKs guide lists every UserOperation an EntryPoint handled in a block range.

Frequently asked questions

What is account abstraction?

Making a user's account a smart contract that defines its own rules for validating transactions and paying gas, instead of an EOA that one private key controls. On Ethereum it's mostly done with ERC-4337, which adds smart accounts without a protocol change.

How does account abstraction work?

With ERC-4337, the account's owner signs a UserOperation instead of a transaction. A bundler collects UserOperations and submits them in one transaction to the EntryPoint contract, which deploys the account if needed, asks the account (and any paymaster) to validate each operation, and then executes it. A paymaster can pay the gas, and an aggregator can validate many signatures at once.

What is a paymaster in ERC-4337?

A contract that pays a UserOperation's gas instead of the smart account. The EntryPoint calls its validatePaymasterUserOp to ask whether it will pay and, if it asked to, its postOp after execution, and takes the gas from the paymaster's deposit in the EntryPoint. Verifying paymasters sponsor operations an off-chain service has signed; token paymasters let users pay in an ERC-20 token.

What is a UserOperation?

The structure a smart account's owner signs in place of a transaction. It names the sender account, a nonce, the call to make, gas limits and fees, optional factory data to deploy the account and optional paymaster data, plus a signature the account itself checks. Bundlers submit UserOperations to the EntryPoint.

Does account abstraction need a hard fork?

ERC-4337 doesn't: it runs on existing EVM chains through the EntryPoint contract and bundlers. EIP-7702, which lets an EOA delegate to contract code, did need one and went live on Ethereum with the Pectra upgrade in May 2025.

What is the difference between ERC-4337 and EIP-7702?

ERC-4337 is the infrastructure for smart accounts: UserOperations, bundlers, the EntryPoint and paymasters. EIP-7702 is a protocol change that lets an existing EOA run smart account code at its own address. They work together: a 7702-delegated EOA can send UserOperations through ERC-4337 to get sponsored gas.

Next steps

Get new guides by email

New tutorials and best practices for building with blockchain data, sent as they're published.