Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
LABS
Guides

Launching a User Operation Bundling Service

This guide provides a technical walkthrough for developers to deploy and operate a bundler service that aggregates and submits UserOperations to the EntryPoint contract.
Chainscore © 2026
introduction
A PRACTICAL GUIDE

Launching a User Operation Bundling Service

A technical walkthrough for developers on how to build and deploy a bundler service for ERC-4337 account abstraction.

A User Operation Bundler is a core off-chain component of the ERC-4337 account abstraction standard. Its primary function is to receive, validate, and submit batches of UserOperations (intents from smart contract wallets) to the Ethereum blockchain. Unlike a standard transaction relayer, a bundler must simulate operations using a Paymaster to ensure they are valid and will pay fees, bundle them into a single transaction, and submit them to a dedicated EntryPoint contract. Running a bundler allows you to earn transaction fees (priority fees) and is essential for a decentralized and robust account abstraction infrastructure.

To launch a service, you first need to choose and run bundler software. The most common implementation is the official ERC-4337 Bundler written in TypeScript by the Ethereum Foundation and Pimlico. You can start it using docker run -p 3000:3000 -e ETHEREUM_RPC_URL=<your_rpc_url> public.ecr.aws/lambdalf/lambdalf-bundler:latest. For production, you'll need to configure several critical environment variables: a reliable Ethereum RPC URL (like Alchemy or Infura), the address of the EntryPoint contract (e.g., 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789), and your own signing key for submitting the bundle transactions. The bundler exposes a JSON-RPC API at port 3000 for receiving UserOperations via the eth_sendUserOperation method.

Key operational considerations include fee management and simulation security. The bundler must handle gas prices dynamically, often setting a minimum priority fee to ensure its bundles are mined profitably. Crucially, it performs a local simulation of each UserOperation using the eth_call RPC to verify it won't revert and will correctly pay fees through its associated Paymaster. This simulation must be strict to prevent DoS attacks; the official bundler uses a custom tracing module to enforce rules on opcode usage and storage access. For high availability, you should run multiple instances behind a load balancer and monitor metrics like submission success rate and simulation failure count.

Integrating with a Paymaster service is often necessary to support sponsored transactions (gasless UX). Your bundler needs to be configured to recognize and interact with Paymaster contracts. During simulation, it will call the Paymaster's validatePaymasterUserOp function. For development, you can use a testnet Paymaster from providers like Pimlico or Stackup. In production, you may run your own Paymaster or whitelist specific contracts. Remember that the bundler ultimately stakes ETH in the EntryPoint and is financially responsible for any incorrectly simulated operations that cause the bundle to revert, making robust simulation logic non-negotiable.

To attract UserOperation traffic, your bundler must be discoverable. You can list it on public bundler registries or partner with wallet SDKs and dApp developers. Your service's reliability and fee competitiveness will be key factors. For advanced deployment, consider using a mev-boost compatible block builder to submit bundles directly to proposers for inclusion, reducing latency. The ecosystem tooling is evolving rapidly; staying updated with the official ERC-4337 GitHub repository and bundler specifications is essential for maintaining a secure and efficient service.

prerequisites
SETUP GUIDE

Prerequisites and Requirements

Before launching your own User Operation bundling service, you need to establish a solid technical foundation. This section outlines the essential software, accounts, and infrastructure you must have in place.

To build a bundler, you need a development environment with Node.js (v18 or later) and a package manager like npm or yarn. You will also need a code editor such as VS Code. The core of your service will interact with the Ethereum Virtual Machine (EVM), so familiarity with smart contracts and the JSON-RPC API is essential. You should have a working knowledge of TypeScript, as most modern bundler implementations, including the official Pimlico Bundler SDK, are built with it.

You must have access to an Ethereum execution client node. You can run your own (e.g., Geth, Nethermind) or use a reliable node provider like Alchemy, Infura, or QuickNode. This node is critical for reading blockchain state, estimating gas, and broadcasting bundled transactions. Additionally, you will need accounts on the networks you intend to support. For a testnet deployment, acquire test ETH from a faucet. For mainnet, you will need real ETH to act as the bundler's deposit and to pay for gas on behalf of users until you are reimbursed.

A bundler's primary function is to handle UserOperation objects. You must understand the ERC-4337 specification and its core components: the EntryPoint contract, AccountFactory, and Paymaster contracts. Your service will need the address of the official EntryPoint contract (e.g., 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789 on Ethereum mainnet). It's highly recommended to study the reference implementations in the eth-infinitism/account-abstraction repository to understand the expected data structures and validation logic.

Your bundler requires a secure signing key to submit transaction bundles. This key controls the bundler's deposit in the EntryPoint and must be protected, typically using environment variables or a secure key management service. You will also need to set up a database (e.g., PostgreSQL, Redis) to persistently queue pending UserOperation objects and track their status. A mempool-like structure is necessary to manage operations before they are included in a bundle.

Finally, plan your deployment infrastructure. A production bundler should run on a reliable cloud server (AWS EC2, Google Cloud) with high uptime. You will need to configure environment variables for your RPC URL, private key, chain ID, and EntryPoint address. Consider using process managers like PM2 or containerization with Docker for robust, scalable deployments. Monitoring tools for logging, metrics, and alerting are also crucial for maintaining service health.

key-concepts
BUILDING A BUNDLER

Core Bundler Concepts

A bundler is the core infrastructure for ERC-4337 accounts. It aggregates, validates, and submits UserOperations to the blockchain, enabling gas sponsorship and transaction batching.

06

Bundler Economics & Risks

Bundling is a business with calculable rewards and risks. Rewards: Earn the difference between the gas you pay and the gas the user pays (including priority fees). Key Risks:

  • Revert Risk: A UserOperation reverts on-chain, causing gas loss. Mitigated by robust local simulation.
  • Staking Requirement: To submit bundles, you may need to stake ETH in the EntryPoint, which can be slashed for malicious behavior.
  • MEV Competition: Bundlers compete to include the most profitable operations in their blocks.
< 1 sec
Simulation Time
99.9%
Uptime Required
client-setup
INFRASTRUCTURE

Step 1: Setting Up a Bundler Client

A bundler client is the core software component that receives, validates, and submits User Operations to the blockchain. This guide covers the initial setup using the official ERC-4337 reference implementation.

The bundler is a critical piece of ERC-4337 infrastructure, acting as a specialized relayer for User Operations. Its primary functions are to receive operations from clients, simulate them against a local state to ensure they will succeed and pay fees, package them into a bundle transaction, and finally submit this bundle to an EntryPoint contract on-chain. For development and initial deployment, the eth-infinitism/bundler reference implementation in TypeScript is the standard starting point. It requires Node.js (v18 or later) and uses a signer wallet to pay for the gas of the bundled transactions on-chain.

To begin, clone the repository and install dependencies. You'll need to configure environment variables, most importantly a private key for your bundler signer and RPC endpoints for the networks you wish to support. The configuration file (config.json) defines network parameters, gas estimation settings, and the EntryPoint contract address (e.g., 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789 for the canonical version). A minimal run command like npm run start will launch the bundler service, which by default exposes a JSON-RPC endpoint (typically on port 3000) for receiving User Operations via the eth_sendUserOperation method.

Before processing live transactions, you must stake your bundler's signer address on the EntryPoint contract. This is a mandatory security deposit that can be slashed if the bundler submits invalid bundles, protecting the network from malicious behavior. The staking process involves a blockchain transaction to the EntryPoint's addStake function, locking a specified amount of ETH for a minimum delay period. Without a stake, the bundler will reject all operations. You can verify your stake status using the EntryPoint's getDepositInfo view function.

For local development, you can run the bundler against a local Hardhat or Anvil node. This allows you to test the entire flow—from a smart contract wallet creating a User Operation to the bundler processing it—without spending real gas. Use the --network flag to point the bundler at your local RPC URL (e.g., http://localhost:8545). Ensure your local node is configured with the correct EntryPoint contract deployed, which is often done automatically by account abstraction development toolkits like @account-abstraction/sdk.

In production, bundler deployment requires robust infrastructure. Key considerations include running multiple instances behind a load balancer for high availability, implementing monitoring for metrics like bundle submission success rate and latency, and securely managing the signer private key (using a hardware security module or cloud KMS). The bundler's profitability depends on capturing priority fees (tips) from the User Operations it bundles, making efficient gas estimation and mempool strategy essential for competitive operation.

mempool-management
BUNDLER OPERATIONS

Step 2: Managing the UserOperation Mempool

A bundler's core function is to collect, validate, and prioritize pending UserOperations from a shared mempool. This step details the logic and components required to build a robust mempool manager.

The UserOperation mempool is a decentralized, peer-to-peer network where pending operations are broadcast. Unlike a traditional blockchain mempool, it contains structured UserOperation objects awaiting inclusion by a bundler. Your service must connect to this network via the eth_sendUserOperation RPC endpoint, listening for incoming operations. Key responsibilities include receiving broadcasts from other bundlers and wallets, performing initial sanity checks on sender, nonce, and signature, and maintaining an in-memory pool of valid candidates. The ERC-4337 specification defines the standard mempool behavior to ensure interoperability.

Before adding an operation to your local pool, you must perform simulation using the eth_call RPC to the EntryPoint's simulateValidation method. This dry-run verifies the operation's validity without submitting an on-chain transaction. It checks the paymaster's willingness to sponsor, the smart contract account's signature, and that the call won't revert given the current state. A failed simulation means the operation is invalid and must be discarded to protect your bundler from wasting gas. Successful simulations also return a prefund amount, indicating the gas you must advance, and help estimate the operation's gas cost for later profitability calculations.

With a pool of validated operations, you need a scheduling and prioritization algorithm. A common strategy is to sort operations by descending maxPriorityFeePerGas (tip) to maximize your bundler's revenue. You must also handle dependencies, as some operations may need a previous transaction from the same account to be mined first (nonce ordering). Advanced bundlers implement logic to identify and bundle operations that interact with the same contracts, enabling gas savings through shared storage access. The goal is to construct a bundle that is both profitable for you and likely to be included in the next block by the target block builder.

Your mempool manager must also handle conflict resolution and replacement. Users can replace a pending UserOperation by submitting a new one with the same sender and nonce but a higher maxPriorityFeePerGas. Your service should detect these replacements, invalidate the older, lower-paying operation, and simulate the new one. Furthermore, you need a pruning mechanism to remove stale operations that have been included on-chain by another bundler or have expired (exceeded their validUntil timestamp). Continuously monitoring the blockchain for these events is essential to keep your local view accurate and efficient.

Finally, robust error handling and logging are critical for operational stability. Your service should gracefully handle RPC errors, malformed data, and fluctuations in network conditions. Implement detailed logging for key events: received operations, simulation results, bundle construction attempts, and on-chain inclusion status. This data is vital for debugging, optimizing your bundler's strategy, and providing transparency. By building a reliable mempool manager, you create the foundation for a bundler that can securely and profitably serve the ERC-4337 ecosystem.

simulation-validation
BUNDLER SERVICE

Step 3: Simulating and Validating Operations

Before broadcasting a bundle to the network, a bundler must simulate the included User Operations to ensure they are valid and will succeed. This step is critical for security and profitability.

The eth_estimateUserOperationGas and eth_simulateUserOperation RPC methods are the primary tools for simulation. These methods execute the User Operation's call data against the current blockchain state, but within a sandboxed environment that prevents any permanent state changes. The bundler uses this simulation to verify the operation's signature, check that the sender's smart contract account has sufficient funds for gas, and ensure the target contract logic will execute without reverting. A failed simulation means the operation is invalid and should be excluded from the bundle to avoid paying for a failed transaction on-chain.

Key validation checks performed during simulation include verifying the paymaster signature (if used), ensuring the account's validateUserOp function passes, and confirming the initCode correctly deploys a new account. The bundler also calculates the precise gas limits required for execution, verification, and paymaster post-operation. Tools like the ERC-4337 Bundler Specification and reference implementations such as @account-abstraction/sdk provide the logic for these checks. Proper simulation prevents bundlers from sponsoring malicious operations or wasting gas on transactions destined to fail.

After successful simulation, the bundler must also perform reputation checks on the involved entities. This involves tracking the frequency of operations from specific senders, factories, and paymasters to mitigate denial-of-service (DoS) attacks. For example, a factory address that consistently deploys accounts which fail validation may be added to a denylist. These checks are defined in the ERC-4337 specification's reputation scoring system and are essential for maintaining network stability.

Finally, the bundler aggregates the validated operations into a single bundle transaction. It signs this bundle with its own Ethereum account and submits it to a mempool for block builders or directly to a preferred block builder via a private channel. The choice of submission method affects latency and potential MEV (Maximal Extractable Value). Using services like the debug_bundler_sendBundleNow RPC endpoint allows for immediate testing and debugging of the entire bundling pipeline before going live.

bundling-submission
BUILDING THE BUNDLER

Step 4: Bundling and Submitting to EntryPoint

This step covers the core logic for bundling UserOperations and submitting them to the EntryPoint contract for execution on-chain.

A bundler's primary function is to collect UserOperation objects from the mempool, package them into a single transaction, and submit it to the EntryPoint smart contract. The EntryPoint is the canonical singleton contract defined by ERC-4337 that validates, executes, and manages payment for all account abstraction operations. Your bundler acts as a specialized transaction relayer, but instead of signing transactions itself, it invokes the handleOps function on the EntryPoint, passing in the array of bundled operations. This design centralizes security and logic, making the bundler a stateless service focused on efficiency and profitability.

Before bundling, your service must perform simulation using eth_call to the EntryPoint's simulateHandleOp function (or the deprecated simulateValidation). This dry-run checks if each operation will pass validation and pay its gas fees, protecting the bundler from losing funds on invalid ops. You must also implement a pricing and selection algorithm. This involves fetching current gas prices, estimating the gas cost for each op, calculating potential profit based on the operation's maxPriorityFeePerGas and maxFeePerGas, and selecting a profitable batch. Advanced bundlers use strategies like Priority Queue management to order operations for maximum efficiency.

The submission process requires constructing and signing a transaction. Your bundler uses its own Externally Owned Account (EOA) to send the transaction that calls EntryPoint.handleOps(). The function signature is handleOps(UserOperation[] calldata ops, address payable beneficiary). The beneficiary is your bundler's address, which receives the gas compensation from each successful operation. You must ensure the bundler's EOA has sufficient native tokens (e.g., ETH on Ethereum) to cover the entire batch's gas cost upfront; the reimbursement occurs atomically within the same handleOps call upon successful execution.

Handling failures and replacements is critical. If a UserOperation fails during simulation or execution, your bundler should filter it out to avoid wasting gas on a reverted batch. You must also monitor the mempool for replacement transactions. If a user submits a new operation with the same nonce but a higher maxPriorityFeePerGas, your bundler should replace the older, lower-paying operation in its pending bundle to maximize fees. Implementing robust error handling for handleOps revert reasons (like FailedOp) is necessary to parse and log failures without crashing the service.

For development and testing, use the official account-abstraction bundler implementation (like @account-abstraction/sdk) or the Stackup or Alchemy bundler APIs. A minimal code snippet for submission in a Node.js environment using ethers.js might look like this:

javascript
const entryPoint = new ethers.Contract(entryPointAddress, entryPointABI, bundlerSigner);
const tx = await entryPoint.handleOps(validUserOps, bundlerAddress, { gasLimit });
const receipt = await tx.wait();
console.log(`Bundle mined in block ${receipt.blockNumber}`);

Always verify your bundler logic on a testnet like Goerli or Sepolia before mainnet deployment.

IMPLEMENTATION OPTIONS

Bundler Client Comparison

A comparison of the primary open-source bundler clients for launching an ERC-4337 bundling service.

Feature / MetricStackup BundlerEtherspot SkandhaAlchemy RundlerPimlico Periphery

Client Language

TypeScript

Rust

Rust

TypeScript

License

MIT

Apache 2.0

MIT

MIT

Gas Estimation

Paymaster Support

MEV Protection (P2P)

Flashbots Protect

MEV-Share

Not Native

MEV-Share

Avg. Bundle Latency

< 1 sec

< 2 sec

< 1 sec

< 1 sec

RPC Endpoint Required

Ethereum Node

Ethereum Node

Alchemy API

Ethereum Node

On-Chain Reputation

profitability-reliability
OPERATIONAL GUIDE

Step 5: Strategies for Profitability and Reliability

Running a profitable and reliable bundler requires a deliberate strategy. This section covers the key operational decisions and technical considerations for sustainable service management.

A successful bundling service balances fee optimization with service reliability. Your primary revenue stream is the priority fee included in each UserOperation. You must set a competitive fee strategy that attracts users while covering your operational costs, which include gas for on-chain submission and server infrastructure. Analyze the market by monitoring other public bundlers like those on the Pimlico network or Stackup to understand prevailing fee structures. Consider implementing dynamic pricing that adjusts based on network congestion and the complexity of bundled operations.

To ensure reliability, your bundler must maintain a high inclusion rate. This depends on two factors: mempool monitoring and gas management. You need to listen to the eth_sendUserOperation RPC endpoint and the P2P mempool to gather operations. Implement robust logic to handle operations with different paymasters, signature types, and calldata. Crucially, you must simulate every operation using eth_estimateUserOperationGas and eth_call for pre-execution checks to avoid bundling failing transactions, which wastes gas and hurts profitability.

Your bundling strategy directly impacts profitability. You can choose to bundle on a timer (e.g., every 30 seconds) to provide predictable service, or bundle on gas price thresholds to submit only when network fees are low. More advanced strategies involve MEV-aware bundling, where you reorder operations within a bundle to extract maximal value, though this requires sophisticated simulation. Remember, each bundle is a single on-chain transaction; packing more UserOperation objects into one bundle amortizes your base transaction cost across more fees, improving margins.

Operational resilience is non-negotiable. Implement health checks and alerting for your node RPC connections, mempool listener, and database. Use a fallback RPC provider to avoid single points of failure. Since your bundler's reputation depends on successful on-chain inclusion, monitor for replacement transactions (txn replacement via higher gas) and implement logic to boost your bundle's gas price if it's stuck. Tools like the Ethereum Execution API and services like Flashbots Protect can be integrated for this purpose.

Finally, track key performance indicators (KPIs) to guide your strategy. Essential metrics include: Operations Bundled per Day, Average Fee per Operation, Bundle Inclusion Success Rate, and Average Gas Cost per Bundle. Analyze this data to identify inefficiencies. For example, a low success rate may indicate faulty simulation, while high gas costs might mean you're bundling too infrequently. Continuously iterating based on these metrics is the path to a sustainable and profitable ERC-4337 bundling service.

USER OPERATION BUNDLER

Common Issues and Troubleshooting

Solutions to frequent technical hurdles encountered when deploying and operating a bundler service for ERC-4337 accounts.

Inaccurate gas estimation is a primary cause of bundler failures. This often stems from the eth_estimateUserOperationGas RPC call returning errors or unrealistic values.

Common root causes:

  • Unsupported opcodes: The simulation may execute opcodes your bundler's node doesn't support (e.g., certain precompiles on a testnet).
  • State dependencies: The estimation depends on a recent block hash or state that has changed by the time the bundle is submitted.
  • Paymaster issues: If the paymaster validation logic reverts during simulation, estimation fails.

How to fix:

  • Verify your Execution Client (e.g., Geth, Erigon) and its version are compatible with the network's hard forks.
  • Implement a fallback gas buffer. Add a fixed percentage (e.g., 20-50%) on top of the estimated callGasLimit and verificationGasLimit to account for state variability.
  • Check paymaster logs. Ensure the paymaster contract's validatePaymasterUserOp function does not revert for valid operations and has sufficient stake/balance.
USER OPERATION BUNDLING

Frequently Asked Questions

Common technical questions and solutions for developers building or integrating a bundler service for ERC-4337 accounts.

A bundler is a network participant in the ERC-4337 (Account Abstraction) ecosystem that collects UserOperations from users, packages them into a single transaction, and submits this bundle to an Ethereum EntryPoint contract. It acts as a transaction relayer and pays the gas fees for the bundle, earning fees from the users' operations. The bundler's core responsibilities are:

  • Validating UserOperation signatures and paymaster sponsorship.
  • Simulating operations to ensure they will succeed on-chain.
  • Aggregating multiple operations into one bundle transaction.
  • Handling gas estimation and managing mempool logic.

Without a bundler, UserOperations cannot be executed on-chain, making it a critical infrastructure component for smart contract wallets.

How to Launch a User Operation Bundling Service | ChainScore Guides