Batched Transactions on EVM: Execute Multiple Operations
What are batched transactions?
What are batched transactions?
Batched transactions combine multiple blockchain operations into a single transaction. Instead of submitting separate transactions (each with its own gas cost and confirmation), you execute everything atomically in one go.Batching is enabled by smart contract wallets (account abstraction).
Why should I batch transactions?
Why should I batch transactions?
| Benefit | Description |
|---|---|
| Lower gas costs | One base transaction fee instead of multiple |
| Better UX | Users sign once instead of multiple times |
| Atomic execution | All operations succeed or all fail together |
| Faster completion | No waiting between steps |
| Reduced failure risk | No partial state from incomplete sequences |
| Scenario | Without Batching | With Batching | Savings |
|---|---|---|---|
| Approve + Swap | ~140k gas | ~95k gas | 32% |
| 3 token transfers | ~120k gas | ~75k gas | 37% |
| Approve + Deposit + Claim | ~200k gas | ~130k gas | 35% |
How do I batch transactions with Biconomy?
How do I batch transactions with Biconomy?
Using AbstractJS SDK with MEE:
MEE (Modular Execution Environment) provides all the batching capabilities of ERC-4337 bundlers and paymasters, plus cross-chain orchestration. Use MEE instead of configuring bundlers and paymasters separately.
What operations can I batch together?
What operations can I batch together?
You can batch any combination of EVM operations:Common batching patterns:
Example: Multi-token transfer
| Pattern | Operations |
|---|---|
| Token + Action | Approve → Swap/Deposit/Stake |
| Multi-send | Multiple token transfers in one tx |
| DeFi combo | Claim → Swap → Deposit |
| NFT batch | Approve → List multiple NFTs |
| Gaming | Equip + Upgrade + Consume items |
| DAO | Delegate → Vote on multiple proposals |
How does atomic execution work?
How does atomic execution work?
Atomic execution means all operations succeed or all fail. There’s no partial state.Why this matters:Biconomy ensures atomicity:
Can I batch operations that depend on each other?
Can I batch operations that depend on each other?
Yes! Use runtime values to reference outputs from earlier operations:The
runtime.outputOf(0) is resolved at execution time with the actual value from the first operation.What's the maximum batch size?
What's the maximum batch size?
Batch size is limited by:
Best practices:
- Block gas limit: Total gas must fit in a block
- Bundler limits: Typically 5-10M gas per UserOperation
- Practical limits: More operations = higher failure risk
| Chain | Recommended Max Operations | Max Gas |
|---|---|---|
| Ethereum | 10-20 | 3-5M gas |
| Arbitrum | 20-50 | 10M gas |
| Base | 20-50 | 10M gas |
| Polygon | 20-50 | 8M gas |
How do I estimate gas for batched transactions?
How do I estimate gas for batched transactions?
How do I handle failures in batches?
How do I handle failures in batches?
Default behavior: Atomic revertFor non-critical operations, use conditional execution:Pre-validate operations:
Can I batch across multiple chains?
Can I batch across multiple chains?
Yes! Cross-chain batching is possible with Biconomy’s orchestration:See Multi-Chain Execution for details.
What are real-world batching examples?
What are real-world batching examples?
Example 1: DeFi Yield OptimizationExample 2: NFT Marketplace ListingExample 3: Payroll Distribution