Understanding Bundlers and Paymasters
What are UserOperations?
UserOperations (UserOps) are the foundation of ERC4337, replacing standard Ethereum transactions for smart accounts. A UserOperation describes everything needed to execute actions from a smart account: the intended operation, validation rules, gas limits, and payment details.
Key aspects of UserOperations:
- They represent one or more actions a smart account wants to take
- They include validation data for signature verification
- They specify how gas will be paid (either by the account or a paymaster)
- They can trigger account deployment if needed
- They enable atomic execution of multiple actions
Why Use Bundlers?
Bundlers are specialized network participants that handle UserOperations. They serve as the bridge between your application's smart account operations and the blockchain.
Core bundler functions:
- Receiving and validating UserOperations
- Maintaining a separate mempool for UserOperations
- Simulating operations before execution
- Combining multiple operations into efficient bundles
- Submitting the final bundles to the blockchain
A bundler ensures your UserOperations are valid, properly formatted, and will execute successfully on-chain. They handle all the complexity of ERC4337 validation rules and provide an efficient way to submit smart account transactions.
Why Use Paymasters?
Paymasters are smart contracts that enable flexible gas payment options. They remove the requirement for users to hold native tokens (like ETH) for gas fees.
Paymaster capabilities:
- Sponsoring transactions (making them gasless for users)
- Accepting ERC20 tokens as gas payment
- Implementing subscription models
- Adding custom rules for transaction sponsorship
How They Work Together
The bundler-paymaster flow follows these steps:
- Your application creates a UserOperation
- If using a paymaster, it verifies and approves the operation
- The bundler receives the operation and validates it
- The bundler simulates the full execution including paymaster interactions
- When ready, the bundler includes your operation in a bundle
- The bundle is submitted to the blockchain
- The paymaster handles gas payment during execution
Benefits for Your Application
Implementing bundlers and paymasters enables:
-
Better User Experience
- No need for users to hold native tokens
- Simplified transaction flow
- Predictable gas costs
-
Enhanced Functionality
- Batch multiple operations
- Implement complex transaction logic
- Flexible gas payment options
-
Risk Management
- Pre-execution validation
- Simulation before submission
- Gas cost estimation
Getting Started
Read our Quickstart Guide to account abstraction.
Bundlers and paymasters are the key infrastructure components that make smart accounts practical and user-friendly. Understanding how they work helps you build better web3 applications with superior user experience.