A UserOperation is the core object in the ERC-4337 (Account Abstraction) standard, representing a user's request for action from a blockchain network. Unlike a traditional transaction, which originates from an Externally Owned Account (EOA), a UserOperation is a structured packet of data that is submitted to a dedicated mempool by a Bundler. This packet contains all the necessary information for a Smart Contract Wallet (or Account) to validate and execute the intended operation, decoupling transaction initiation from the constraints of EOAs.
UserOperation
What is a UserOperation?
A standardized data structure that represents a user's intent for transaction execution on an Ethereum Virtual Machine (EVM) compatible blockchain, enabling account abstraction.
The structure of a UserOperation includes critical fields such as sender (the smart contract account address), nonce, initCode (for account deployment), callData (the execution instructions), callGasLimit, verificationGasLimit, preVerificationGas, maxFeePerGas, maxPriorityFeePerGas, paymasterAndData, and signature. This design allows for complex transaction logic, including gas sponsorship by paymasters, signature aggregation, and session keys, which are not possible with native EOAs. The signature field is particularly flexible, allowing for any validation logic defined by the smart account.
In the execution flow, a Bundler collects UserOperations, packages them into a single bundle transaction, and submits this bundle to the EntryPoint contract on-chain. The EntryPoint is a singleton contract that orchestrates the process: it validates each UserOperation (including signature and fee payment), executes the callData on the sender's smart account, and compensates the Bundler. This architecture enables key user experience improvements like gasless transactions, batch transactions, and social recovery, moving the complexity of key management and transaction formatting off-chain.
The introduction of UserOperations fundamentally shifts the transaction paradigm. It establishes a higher-level, intent-centric interface where users express what they want to achieve, while the infrastructure of Bundlers, Paymasters, and smart accounts determines how it is executed and paid for. This is a cornerstone of the account abstraction vision, aiming to make blockchain interactions as seamless as web2 experiences without compromising security or decentralization.
Key Features
A UserOperation is the fundamental data structure in ERC-4337 that represents a user's intent for a smart contract wallet, enabling account abstraction without core protocol changes.
Standardized Data Structure
A UserOperation is a standardized JSON-like object defined by ERC-4337 that packages all data required to execute a user's intent. Key fields include:
- sender: The smart contract account address.
- nonce: Prevents replay attacks.
- initCode: For deploying the account if it doesn't exist.
- callData: The calldata to execute on the sender.
- signature: Cryptographic signature for validation.
- paymasterAndData: Optional field for gas sponsorship. This structure allows Bundlers to uniformly process operations from any compliant wallet.
Decoupled Signature & Execution
A core innovation is the separation of signature verification from transaction execution. The UserOperation's signature field can implement any custom logic (e.g., multisig, social recovery, session keys) defined by the smart account. The EntryPoint contract validates this signature before executing the callData. This enables features impossible with EOAs, such as:
- Batched transactions with a single signature.
- Gasless (sponsored) transactions via a paymaster.
- Transaction scheduling and expiry.
Gas Abstraction & Paymasters
The paymasterAndData field enables gas abstraction, allowing a third-party Paymaster contract to sponsor transaction fees. This permits:
- Gasless UX: Users submit UserOperations without holding native tokens.
- Payment in ERC-20s: Fees can be paid in stablecoins or other tokens.
- Sponsored Sessions: Apps can pay for user interactions during a session. The Paymaster validates the UserOperation and deposits funds to the EntryPoint, which refunds it after execution. This is a key driver for improved user onboarding.
Account Deployment (InitCode)
The initCode field handles counterfactual address generation and just-in-time account deployment. A user can generate a deterministic smart account address (using CREATE2) and receive funds before the contract is deployed on-chain. The initCode contains the factory address and calldata to create the account. When a Bundler processes a UserOperation for an undeployed account, it:
- Uses the
initCodeto deploy the contract. - Proceeds with the UserOperation execution. This enables seamless first transactions without separate deployment steps.
Bundler Network & Mempool
UserOperations are broadcast to a peer-to-peer mempool distinct from the traditional transaction mempool. Specialized nodes called Bundlers listen to this mempool, validate UserOperations, bundle them into a single transaction, and submit them to an EntryPoint contract on-chain. Bundlers:
- Perform simulation (via
eth_call) to ensure operations are valid and pay fees. - Compete to include UserOperations based on gas fees.
- Act as the relay layer between users and the blockchain, similar to block builders in PBS.
EntryPoint Contract
The EntryPoint is a singleton, audited smart contract that acts as the central orchestrator and security checkpoint. Its primary functions are:
- Validation: Calls the smart account's
validateUserOpfunction to check signatures and pay prefunds. - Execution: If validation passes, it executes the UserOperation's
callDataagainst the sender account. - Post-Op: Handles gas accounting and refunds to the Bundler and Paymaster. All UserOperation logic must pass through the EntryPoint, which enforces consistency and security for the entire system.
How It Works: The UserOperation Flow
A technical breakdown of the lifecycle of a UserOperation, the core transaction object in ERC-4337 account abstraction, from creation to on-chain execution.
A UserOperation is a pseudo-transaction object that represents a user's intent, which is submitted to a dedicated mempool by a Bundler. Unlike a standard Ethereum transaction, a UserOperation does not specify a gas price or a nonce directly from an Externally Owned Account (EOA). Instead, it contains fields for the target smart contract account, the calldata for execution, signatures for verification, and parameters for gas payment and sponsorship. This structure decouples the transaction's intent from its funding and validation mechanisms, enabling features like gas abstraction and social recovery.
The flow begins when a user's wallet application constructs a UserOperation and sends it to a network of Bundlers. A Bundler, which is a specialized node, collects these operations, validates their signatures and paymaster sponsorship, and then packages them into a single bundle transaction. This bundle is a standard Ethereum transaction sent to a global EntryPoint smart contract. The Bundler pays the gas for this bundle upfront and is reimbursed by the EntryPoint using funds deposited by the user's account or its designated Paymaster.
Upon receiving the bundle, the EntryPoint contract orchestrates the execution for each UserOperation in a structured sequence. It first calls a validation function on the user's smart contract account to verify the signature and ensure the account can pay for gas. If validated, it executes the account's logic as specified in the calldata. Finally, it handles gas compensation, transferring ETH from the account or its Paymaster to reimburse the Bundler. This trust-minimized flow ensures atomic execution: either all operations in a bundle succeed, or the entire bundle is reverted, protecting Bundlers from financial loss.
Key to this flow is the role of the Paymaster, a contract that can sponsor transaction fees. A Paymaster can implement policies for gas abstraction, allowing users to pay with ERC-20 tokens or enabling applications to subsidize their users' costs. During validation, the EntryPoint also verifies the Paymaster's stake and signature, ensuring it has agreed to sponsor the operation. This creates a flexible economic layer where gas payment logic is programmable and separate from the core account logic.
For developers, understanding this flow is critical for building robust account abstraction applications. It highlights the importance of implementing secure validation and execution functions in smart contract accounts, correctly estimating gas limits for verificationGasLimit and callGasLimit, and designing Paymaster contracts that manage their stake and sponsorship rules effectively. The entire system is designed to be permissionless and composable, fostering a competitive ecosystem of Bundlers, Paymasters, and wallet implementations.
Core Components of a UserOperation
A UserOperation is a pseudo-transaction object defined by ERC-4337 that represents a user's intent for an account abstraction wallet. It contains all the necessary data for a Bundler to construct and submit a valid transaction to the network on the user's behalf.
Sender
The smart contract account address that initiates and pays for the operation. This is the Account Abstraction wallet itself (e.g., a Safe, Argent, or custom ERC-4337-compatible contract), not an Externally Owned Account (EOA). The entire UserOperation is executed from the context of this contract.
Nonce & Signature
The nonce prevents replay attacks and can be sequential or parallel (for dependent transactions). The signature is a cryptographic proof, typically an ECDSA secp256k1 signature from the account's owner, but the account contract can implement any validation logic (e.g., multisig, passkey). The contract's validateUserOp function verifies this signature.
CallData & Target
The core execution payload. The target is the destination contract address for the call. The callData is the encoded function call (selector + arguments) to execute on that target. A single UserOperation can contain multiple calls bundled into one callData payload for atomic execution.
Paymaster & Fees
Optional fields for gas sponsorship. The paymaster is a contract that can pay for the UserOperation's gas fees, enabling gasless transactions for users. maxFeePerGas and maxPriorityFeePerGas set the user's maximum acceptable gas prices, following EIP-1559. The actual fees are deducted from the sender's deposit in the EntryPoint or the paymaster's stake.
Pre-Funding & EntryPoint
Before execution, the sender or paymaster must pre-fund the EntryPoint contract, the system-level singleton that orchestrates all UserOperations. The EntryPoint validates, executes, and aggregates operations, ensuring atomicity (all succeed or all fail) and handling gas reimbursement. It's the only contract that needs to be trusted by the network.
InitCode & Factory
Used for counterfactual deployment. initCode contains the data needed to deploy the sender's smart contract account if it doesn't yet exist on-chain. It includes the factory contract address and calldata to call that factory. This enables first transactions from wallets that have never been deployed, with the deployment cost bundled into the operation.
UserOperation vs. Traditional EOA Transaction
A technical breakdown of the core differences between the Account Abstraction transaction object and standard externally-owned-account (EOA) transactions.
| Feature | UserOperation (ERC-4337) | Traditional EOA Transaction |
|---|---|---|
Transaction Initiator | Smart Contract Account | Externally-Owned Account (EOA) |
Transaction Object | UserOperation struct | RLP-encoded transaction |
Signature Validation | Custom logic via | Fixed ECDSA (secp256k1) |
Gas Payment | Flexible (can be sponsored by a Paymaster) | Paid by EOA signer only |
Atomic Batch Execution | Multiple actions in a single op | Single call/transfer per tx |
Transaction MemPool | Alternative mempool (not Ethereum's) | Public Ethereum mempool |
Fee Mechanism | Gas abstraction via Paymaster | Native ETH or chain's base token |
Nonce Management | Supports parallel nonces (key, space) | Single sequential nonce |
Ecosystem Usage & Protocols
A UserOperation is the fundamental data structure in ERC-4337 that represents a user's intent for a smart contract wallet (account abstraction). It is not a transaction itself, but a package of data processed by a separate network of actors.
Core Structure
A UserOperation is a standardized JSON-like object containing the user's intent. Key fields include:
- sender: The smart contract account address.
- nonce: Prevents replay attacks.
- initCode: For deploying a new account if it doesn't exist.
- callData: The encoded function call(s) to execute.
- paymasterAndData: Optional field for gas sponsorship.
- signature: Cryptographic signature for validation.
- preVerificationGas, verificationGasLimit, callGasLimit, maxFeePerGas, maxPriorityFeePerGas: Parameters for gas management.
Bundler Role
A Bundler is a network participant (often a node operator) that collects UserOperations from a mempool, validates them, packages them into a single blockchain transaction, and submits it on-chain. They are analogous to block builders in traditional Ethereum. Bundlers earn fees for this service and are critical for the system's decentralization and censorship resistance.
EntryPoint Contract
The EntryPoint is a singleton, audited smart contract that acts as the on-chain verification and execution hub. The Bundler's transaction calls handleOps() on the EntryPoint, which:
- Validates each UserOperation's signature and pays the gas.
- Deploys the sender account if needed (via
initCode). - Executes the user's intended calls (via
callData). - Compensates the Bundler. All ERC-4337 compliant accounts must interact with this single contract, ensuring security and standardization.
Paymaster (Gas Abstraction)
A Paymaster is a smart contract that can sponsor transaction fees for users, enabling key use cases:
- Gasless Transactions: The Paymaster pays all fees, improving UX.
- Pay in ERC-20 Tokens: Users pay for gas in USDC or another token; the Paymaster converts it to ETH.
- Sponsored Sessions: Apps can subsidize costs for their users. The Paymaster logic is executed and verified by the EntryPoint, and its address is specified in the
paymasterAndDatafield of the UserOperation.
Account Validation & Execution
Smart contract accounts (wallets) in ERC-4337 must implement two core functions:
- validateUserOp: Verifies the UserOperation's signature and pays the upfront gas to the EntryPoint. This is where custom security logic (multi-sig, social recovery) resides.
- execute: Performs the actual calls specified in the
callData. This separation allows for complex validation without burdening the execution step. The EntryPoint orchestrates this two-phase process.
Alternative Mempool
UserOperations are broadcast to a dedicated alt mempool, separate from the standard Ethereum transaction mempool. This specialized P2P network is used by Bundlers to receive, validate, and propagate UserOperations. It uses different gossip rules and validation logic tailored for account abstraction, ensuring only properly formed UserOperations are considered for bundling.
Security & Trust Considerations
A UserOperation is the core data structure representing a user's intent in ERC-4337 account abstraction. This section details the critical security mechanisms and trust assumptions involved in its lifecycle.
Bundler Validation & Simulation
Before including a UserOperation in a bundle, a Bundler must simulate its execution using eth_call to a special validation function. This simulation ensures the operation will pay its required fees and is not malicious. The bundler's reputation depends on not submitting failing operations, creating a strong economic incentive for correct validation. Failed simulations are discarded, protecting the network from spam and invalid state changes.
Paymaster Sponsorship Risks
A Paymaster is a contract that can sponsor transaction fees for a UserOperation. This introduces specific trust vectors:
- Deposit Security: Users must trust the paymaster's solvency and honesty, as it holds deposited funds.
- Selective Censorship: A paymaster can refuse to sponsor certain operations.
- Validation Logic: Malicious validation code in a paymaster could cause a UserOperation to fail after being accepted by a bundler, wasting gas. Users should audit or use reputable paymaster services.
Signature Aggregation & Verification
UserOperations use signature abstraction, allowing smart contract accounts to define their own verification logic. This flexibility requires careful implementation:
- Account-Specific Logic: The
validateUserOpfunction must be secure against replay attacks and correctly validate the user's signature or authority. - Signature Aggregators: For gas efficiency, multiple signatures can be aggregated off-chain. This requires trust in the aggregator to correctly construct the aggregated signature and for the on-chain verifier to validate it cryptographically.
EntryPoint as a Central Trust Component
The EntryPoint is a singleton, audited contract that orchestrates UserOperation execution. It is a critical trust assumption for the entire ERC-4337 system:
- Centralized Failure Point: A bug in the EntryPoint could affect all account abstraction transactions.
- Upgradability: Some EntryPoint implementations may be upgradeable, introducing governance trust.
- Inviolable Rules: It enforces core security rules, such as ensuring the
validateUserOpfunction is called before execution and that paymaster deposits are managed correctly. All participants must trust its code.
Frontrunning and Mempool Privacy
UserOperations exist in a public mempool before being bundled, similar to traditional transactions. This exposes them to known risks:
- Frontrunning: A malicious actor can see a profitable UserOperation (e.g., an arbitrage opportunity) and submit their own with a higher fee to get it processed first.
- Sandwich Attacks: Particularly relevant for operations involving DEX swaps.
- Solution Patterns: To mitigate this, accounts can use private RPCs, commit-reveal schemes, or pre-confirmation services from bundlers to gain execution certainty.
Smart Account Implementation Risks
The security of a UserOperation ultimately depends on the smart account (e.g., a Safe, Argent, or custom contract) that executes it. Key risks reside here:
- Upgrade Mechanisms: Malicious or compromised account upgrades can drain funds.
- Social Recovery: While enhancing usability, recovery guardians become high-value attack targets.
- Module Security: Plug-in modules that extend account functionality (e.g., session keys) must be rigorously audited. A vulnerability in any module can compromise the entire account.
Common Misconceptions
Clarifying frequent misunderstandings about the core data structure of ERC-4337 account abstraction.
No, a UserOperation is not a native blockchain transaction; it is a pseudo-transaction object defined by the ERC-4337 standard that is submitted to a separate mempool for bundlers to package into an actual on-chain transaction. A standard transaction is signed by an Externally Owned Account (EOA) and executed directly by the Ethereum Virtual Machine (EVM). In contrast, a UserOperation is a request signed by a smart contract wallet that instructs a bundler to create and submit a transaction that will execute the desired logic through a global EntryPoint contract. This abstraction layer separates the user's intent from the mechanics of transaction execution and gas payment.
Etymology & History
The term 'UserOperation' emerged from the ERC-4337 standard as a formalized data structure to represent a user's intent within an account abstraction framework, replacing the traditional transaction model.
The concept of a UserOperation was formally introduced with ERC-4337: Account Abstraction via Entry Point Contract specification in 2021. It was created to solve a core limitation of Externally Owned Accounts (EOAs): the rigid coupling of transaction initiation, payment, and signature validation. The term itself is a compound of 'User,' denoting the entity expressing intent, and 'Operation,' indicating a requested action on the blockchain. This new primitive decouples the user's request from the mechanics of its execution and payment, a fundamental shift from the tx object in legacy systems.
The historical development of UserOperations is intrinsically linked to the long-standing pursuit of account abstraction on Ethereum. Prior proposals, like EIP-2938, sought to modify the consensus-layer protocol, which proved difficult to implement. ERC-4337's breakthrough was achieving similar functionality entirely through smart contracts, without requiring a hard fork. The UserOperation became the central packet of data in this new, higher-level system, flowing through a dedicated mempool and being validated and executed by a new network component called the EntryPoint.
The standardization of the UserOperation structure created a unified language for bundlers (block builders) and paymasters (fee sponsors) to interact with. Its fields—such as sender, nonce, initCode, callData, callGasLimit, and signature—precisely define the who, what, and how of a user's request. This allowed for new transaction paradigms, including gasless transactions, session keys, and social recovery, which were impractical or impossible under the original EOA model. The term has since become foundational vocabulary in the smart account ecosystem.
Frequently Asked Questions
Common questions about UserOperations, the fundamental transaction object for ERC-4337 account abstraction.
A UserOperation is a pseudo-transaction object defined by the ERC-4337 standard that represents a user's intent to execute actions from a smart contract wallet, which is then bundled and submitted to the blockchain by a separate actor called a Bundler. Unlike a traditional transaction sent directly from an Externally Owned Account (EOA), a UserOperation is a structured data packet containing fields like the sender's smart account address, the target contract, calldata, signatures, and parameters for paying transaction fees. This abstraction separates the user's intent from the mechanics of gas payment and block inclusion, enabling features like sponsored transactions, session keys, and batch operations.
Get In Touch
today.
Our experts will offer a free quote and a 30min call to discuss your project.