UserOperation
A UserOperation is an ERC-4337 data structure representing a user's transaction intent, processed by bundlers instead of miners.
Key Takeaways
- A UserOperation is a pseudo-transaction object defined by ERC-4337 that encodes a user's intent to interact with the blockchain through a smart contract wallet, replacing the need for externally owned accounts (EOAs).
- UserOperations are not sent to the standard transaction mempool: they go to a separate, alternative mempool where specialized nodes called bundlers collect, simulate, and batch them into a single on-chain transaction via the EntryPoint contract.
- The UserOperation struct carries all the data needed for execution and fee payment, including support for paymasters that can sponsor gas fees, enabling gasless transactions for end users.
What Is a UserOperation?
A UserOperation (often abbreviated UserOp) is a data structure introduced by ERC-4337 that represents what a user wants to do on-chain. It is the core building block of account abstraction on Ethereum and EVM-compatible chains. Instead of signing a traditional transaction with an EOA private key and broadcasting it to validators, a user constructs a UserOperation that describes the desired action and submits it to a dedicated mempool.
The motivation behind UserOperations is to decouple transaction authorization from Ethereum's protocol-level signature scheme. Regular transactions require an EOA with ETH to pay gas, a specific signature format (ECDSA over secp256k1), and a sequential nonce. A UserOperation removes these constraints by moving validation logic into the smart contract wallet itself. This means wallets can support arbitrary signature schemes, multi-factor authentication, session keys, and spending policies: all without changes to the Ethereum protocol.
ERC-4337 was authored by Vitalik Buterin, Yoav Weiss, Dror Tirosh, Shahaf Nacson, Alex Forshtat, Kristof Gazso, and Tjaden Hess. The standard became widely adopted following the deployment of the EntryPoint v0.6 contract on Ethereum mainnet in March 2023, with EntryPoint v0.7 following in 2024 to introduce gas optimizations and improved paymaster support.
How It Works
A UserOperation goes through a multi-stage lifecycle from creation to on-chain execution. Each stage involves different actors and validation steps.
The UserOperation Struct
The original v0.6 UserOperation struct contains the following fields:
struct UserOperation {
address sender; // The smart wallet address
uint256 nonce; // Anti-replay parameter
bytes initCode; // Factory address + init data (for first-time deployment)
bytes callData; // Encoded function call to execute on the wallet
uint256 callGasLimit; // Gas allocated for the main execution call
uint256 verificationGasLimit; // Gas allocated for the validation step
uint256 preVerificationGas; // Gas to compensate bundler for calldata and overhead
uint256 maxFeePerGas; // Maximum total fee per gas (EIP-1559)
uint256 maxPriorityFeePerGas; // Maximum priority fee per gas (EIP-1559)
bytes paymasterAndData; // Paymaster address + paymaster-specific data
bytes signature; // Authorization data verified by the wallet
}The sender field identifies the smart wallet that will execute the operation. The nonce prevents replay attacks, similar to an EOA transaction nonce but managed by the EntryPoint contract with support for parallel nonce channels. The initCode field is only populated when deploying a new wallet: it contains the factory contract address and initialization data, allowing account creation and first transaction to happen in a single UserOperation.
The callData field holds the actual operation the user wants to perform, encoded as a function call on the wallet contract. This can be a single transfer, a batch of calls, or any arbitrary contract interaction. The three gas fields (callGasLimit, verificationGasLimit, preVerificationGas) separate gas accounting between validation and execution phases, giving bundlers precise control over resource allocation.
The paymasterAndData field enables gas sponsorship. When populated, it points to a paymaster contract that agrees to cover the gas fees on behalf of the user. This is what makes gasless transactions possible: the user submits a UserOperation without holding any ETH, and the paymaster pays.
Packed Format (EntryPoint v0.7)
EntryPoint v0.7 introduced a PackedUserOperation struct that reduces calldata costs by combining related gas fields into single bytes32 slots:
struct PackedUserOperation {
address sender;
uint256 nonce;
bytes initCode;
bytes callData;
bytes32 accountGasLimits; // verificationGasLimit (16 bytes) | callGasLimit (16 bytes)
uint256 preVerificationGas;
bytes32 gasFees; // maxPriorityFeePerGas (16 bytes) | maxFeePerGas (16 bytes)
bytes paymasterAndData; // paymaster address + gas limits + paymaster data
bytes signature;
}The packed format saves gas by reducing the number of calldata words submitted on-chain. The accountGasLimits field concatenates verificationGasLimit and callGasLimit as two 128-bit values in a single 256-bit slot. Similarly, gasFees packs both EIP-1559 fee parameters together. The v0.7 release also added dedicated paymaster gas limit fields within paymasterAndData, fixing a vulnerability where paymasters previously had to share the account's verification gas budget.
Lifecycle: From Creation to Execution
The full lifecycle of a UserOperation involves four actors: the user (or their wallet software), the bundler, the EntryPoint contract, and the smart wallet contract.
- The user's wallet software constructs a UserOperation with the desired action encoded in
callDataand signs it - The signed UserOperation is submitted to a bundler via the
eth_sendUserOperationRPC method - The bundler simulates the UserOperation off-chain, tracing its validation step to enforce ERC-7562 opcode and storage access restrictions
- If simulation passes, the bundler adds the UserOperation to its local mempool and may propagate it to other bundlers via a peer-to-peer network
- The bundler selects profitable UserOperations and calls
handleOps()on the EntryPoint contract, bundling multiple UserOps into a single on-chain transaction - The EntryPoint runs a verification loop for each UserOperation: deploying the wallet if
initCodeis present, callingvalidateUserOp()on the wallet, validating the paymaster (if any), and checking fee deposits - After all validations pass, the EntryPoint runs the execution loop: calling the wallet with
callData, running paymaster post-operation hooks, and collecting gas fees
The separation of validation and execution is a critical design choice. The validation phase runs under strict rules: it cannot access most opcodes (like TIMESTAMP or BLOCKHASH), and storage access is limited to the account's own associated storage. These restrictions ensure that a UserOperation that passes simulation will also pass on-chain validation, protecting bundlers from wasting gas on operations that would revert.
How UserOps Differ from Regular Transactions
Traditional Ethereum transactions and UserOperations serve the same purpose (executing on-chain actions) but differ fundamentally in how they are authorized, routed, and processed:
| Property | Regular Transaction | UserOperation |
|---|---|---|
| Sender | Externally owned account (EOA) | Smart contract wallet |
| Signature scheme | ECDSA (secp256k1) only | Any scheme the wallet supports |
| Gas payment | Sender must hold ETH | Paymaster can sponsor fees |
| Mempool | Standard transaction pool | Separate UserOperation mempool |
| Inclusion | Validators pick from mempool | Bundlers batch into handleOps call |
| Nonce | Sequential, single channel | Supports parallel nonce channels |
| Batching | One action per transaction | Multiple calls in single UserOp |
Use Cases
UserOperations unlock capabilities that are impossible with traditional EOA transactions:
- Gasless onboarding: new users can interact with dApps without first acquiring ETH, because a paymaster covers gas fees. This dramatically reduces friction for onboarding non-crypto-native users.
- Batch transactions: a single UserOperation can encode multiple contract calls (approve + swap, or multiple token transfers), reducing the number of confirmations a user needs to sign.
- Session keys: wallets can authorize temporary keys with limited permissions (spend caps, time limits, allowed contracts), enabling seamless gaming or DeFi interactions without repeated approvals.
- Social recovery and guardians: because validation logic lives in the smart wallet, wallets can implement recovery mechanisms where trusted contacts can authorize key rotation without seed phrases.
- Automated policies: enterprises and DAOs can enforce spending limits, multi-signature requirements, or time-locked operations directly within the wallet's validation logic.
For a deeper look at how account abstraction powers modern wallet experiences, see the research article on Ethereum account abstraction via ERC-4337.
Why It Matters
UserOperations represent a paradigm shift in how users interact with blockchains. By moving transaction authorization from the protocol layer into smart contract logic, ERC-4337 makes wallets programmable. This programmability is what enables the gasless, seedless, and policy-driven wallet experiences that make crypto accessible to mainstream users.
The concept also demonstrates a broader trend in blockchain design: separating user intent from execution infrastructure. Rather than users needing to understand gas, nonces, and RPC endpoints, they express what they want to do and let specialized infrastructure (bundlers, paymasters, smart wallets) handle the rest. This same philosophy of abstracting complexity from end users drives projects across the ecosystem, including Bitcoin Layer 2 solutions like Spark, which aim to simplify self-custodial payments without requiring users to manage channels or UTXOs directly.
Risks and Considerations
Bundler Centralization
The bundler role introduces a new intermediary between users and the blockchain. If bundler infrastructure becomes concentrated among a few operators, it could create censorship risks or extract value through MEV. The ERC-4337 specification allows anyone to run a bundler, but the economics of running one profitably may favor larger operators.
Gas Overhead
UserOperations are inherently more expensive than regular transactions because they involve additional on-chain verification steps: the EntryPoint contract logic, the wallet's validateUserOp call, and optional paymaster validation. A simple ETH transfer costs roughly 21,000 gas as a regular transaction but significantly more as a UserOperation. This overhead decreases as a percentage for complex operations but remains a consideration for simple transfers.
Simulation-Execution Gap
Bundlers rely on off-chain simulation to predict whether a UserOperation will succeed on-chain. If conditions change between simulation and block inclusion (due to state changes, MEV, or reorganizations), bundlers may waste gas on operations that revert. The strict validation rules in ERC-7562 mitigate this risk but do not eliminate it entirely.
Smart Wallet Bugs
Because validation logic is implemented in smart contract code, wallet implementations become a critical attack surface. Bugs in the validateUserOp function could allow unauthorized operations or lock users out of their funds. Rigorous auditing and formal verification of wallet contracts is essential.
Migration Complexity
The transition from EntryPoint v0.6 to v0.7 required wallet implementations to support the new PackedUserOperation struct. Because wallet contracts typically hardcode the EntryPoint address, upgrading requires deploying new wallet implementations or using proxy patterns. This fragmentation between EntryPoint versions adds complexity for wallet developers and bundler operators who must support both formats during transition periods.
This glossary entry is for informational purposes only and does not constitute financial or investment advice. Always do your own research before using any protocol or technology.