Bundlers
Bundlers are crucial infrastructure in the Account Abstraction ecosystem, responsible for collecting UserOperations and submitting them to the blockchain.
What is a Bundler?
A Bundler is a specialized node that collects UserOperations from users and smart contract wallets, bundles them together, and submits them to the blockchain as a single transaction. This process improves efficiency and reduces overall gas costs.
How Bundlers Work
- Users or applications submit UserOperations to a Bundler
- The Bundler validates each UserOperation
- Multiple valid UserOperations are grouped into a bundle
- The Bundler submits the bundle to the EntryPoint contract
- The EntryPoint executes each UserOperation in the bundle
0xGasless Bundler Network
0xGasless maintains a network of Bundlers across all supported blockchains, ensuring reliable and efficient transaction processing. The SDK automatically connects to the optimal Bundler based on network conditions.
Supported Networks
The 0xGasless Bundler network currently supports the following EVM-compatible blockchains:
- Base
- Avalanche
- BSC
- Fantom
- Moonbeam
Using the 0xGasless Bundler
When you initialize your Smart Account with the 0xGasless SDK, you can specify the bundler URL:
import { createSmartAccountClient } from "@0xgasless/smart-account";
// Initialize smart account with bundler URL
const smartAccount = await createSmartAccountClient({
signer: walletClient,
bundlerUrl: "https://bundler.0xgasless.com/{chainId}",
chainId: 43114, // Avalanche
});
Interacting with Bundlers Directly
For advanced use cases, you can interact with the bundler RPC API directly:
import { createBundlerClient } from "@0xgasless/smart-account";
// Create bundler client
const bundlerClient = createBundlerClient({
bundlerUrl: "https://bundler.0xgasless.com/{chainId}", // Ethereum Mainnet
entryPointAddress: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789", // EntryPoint contract
});
// Get UserOperation by hash
const userOpHash = "0x...";
const userOp = await bundlerClient.getUserOperationByHash(userOpHash);
console.log("UserOperation:", userOp);
// Get UserOperation receipt
const receipt = await bundlerClient.getUserOperationReceipt(userOpHash);
console.log("Receipt:", receipt);
Bundler Fees and Economics
Bundlers charge fees for their services, typically calculated based on:
- Base fee for inclusion in a bundle
- Gas price premium based on network congestion
- Priority fees for expedited processing
The 0xGasless bundler network uses dynamic fee calculation to optimize for both cost and speed.
Best Practices
- Efficient UserOperations: Design UserOperations to be gas-efficient
- Batching: Group related operations when possible
- Gas Estimation: Use accurate gas estimations to prevent failures
- Timeouts: Implement appropriate timeouts when waiting for bundler responses
- Fallbacks: Configure multiple bundler endpoints for reliability
Troubleshooting
Common Issues
- Bundler Rejection: The bundler may reject UserOperations that don't meet minimum requirements
- Simulation Failure: UserOperations may fail during simulation
- Nonce Issues: Using incorrect nonces can cause UserOperations to be rejected
- Gas Related Errors: Insufficient gas limits or prices
- Network Congestion: During high network congestion, bundlers may prioritize higher-paying UserOperations
Debug Mode
Enable debug mode to get more detailed information
Resources
For further assistance with bundlers, join our Discord community or contact our support team.