Bundler Sponsored Operations
What is Bundler Sponsorship?
Bundler Sponsorship is a beta feature that allows the bundler to sponsor gas fees for user operations directly, eliminating the need for an onchain paymaster contract. This approach provides a streamlined way to abstract gas costs from your users while reducing the complexity and overhead associated with deploying and managing paymaster contracts.
How It Differs from Paymaster Sponsorship
Traditional gas sponsorship in ERC-4337 relies on paymaster contracts deployed onchain. These contracts:
- Need to be deployed and funded on each network
- Require onchain verification logic
- Add additional gas overhead to user operations
- Require management of separate balances per chain
Bundler sponsorship, in contrast:
- Operates offchain at the bundler level
- Uses your Gas Manager policy to control spending
- Reduces gas overhead by eliminating paymaster contract calls
- Simplifies multi-chain deployments
Bundler sponsorship is currently in beta. While it’s production-ready, features and pricing may evolve based on user feedback.
For beta access, please reach out to [email protected].
Policy Setup
To use bundler sponsorship, you must create a Gas Manager policy of type Bundler Sponsored Operations in your Alchemy dashboard.
Required Policy Configuration
When creating a Bundler Sponsored Operations policy, you must configure:
- Policy Type: Select “Bundler Sponsored Operations”
- Max Spend Per UO: Set the maximum amount the bundler can spend per user operation (required field)
This policy type differs from standard Gas Manager policies and is specifically designed for offchain bundler sponsorship.
Compute Unit Costs
When using bundler sponsorship with eth_sendUserOperation:
For more details, see the Compute Unit Costs documentation.
How to Use Bundler Sponsorship
To enable bundler sponsorship, you need to:
- Create a Bundler Sponsored Operations policy in your Alchemy dashboard with the required Max Spend Per UO configuration
- Include the policy ID in your requests via the
x-alchemy-policy-idheader - Set gas fees to zero in your user operation overrides
Example Implementation
Here’s a complete example using Account Kit to send a sponsored user operation:
Key Configuration Points
-
Policy Type: Ensure you’ve created a policy of type “Bundler Sponsored Operations” with Max Spend Per UO configured.
-
Transport Configuration: The
x-alchemy-policy-idheader must be included in the transport configuration’sfetchOptions.headers. -
Gas Fee Overrides: Set both
maxFeePerGasandmaxPriorityFeePerGasto"0x0"to indicate that the bundler should sponsor all gas costs.
Requirements
- A valid Alchemy API key with Bundler API access
- A configured Gas Manager policy of type Bundler Sponsored Operations with Max Spend Per UO set
- Account Kit SDK or equivalent setup for creating and signing user operations
Ensure your Bundler Sponsored Operations policy has sufficient balance and that the Max Spend Per UO limit is set appropriately. If the policy balance is insufficient or the operation exceeds the spending limit, the user operation will fail.
Benefits
- Simplified Architecture: No need to deploy or manage paymaster contracts
- Lower Onchain Gas Costs: Eliminates the gas overhead of paymaster verification and contract calls
- Reduced Latency: Fewer network calls and onchain interactions result in faster user operation processing
- Easier Multi-Chain Support: Use the same policy type across multiple chains
- Centralized Policy Management: Control spending limits and rules from the Alchemy dashboard
Limitations (Beta)
As this feature is currently in beta, please be aware of:
- Features and API surface may change based on feedback
- Not all networks may support bundler sponsorship
- Compute unit costs are subject to change
- Requires a specific policy type with mandatory Max Spend Per UO configuration