On-chain paymasters are smart contracts that sponsor gas fees by accepting ERC-20 tokens from users. They handle the token-to-ETH conversion on-chain, allowing users to pay gas with tokens they hold.
Implementations
- Permissionless
- API Endpoints
This example uses Pimlico’s ERC-20 Paymaster. You can substitute any compatible on-chain paymaster.
1
Create an API Key
Check out our How-To Guide for detailed instructions on generating a Gelato API key.You’ll also need an API key from your paymaster provider (e.g., Pimlico).
2
Create Smart Account
3
Create Paymaster Client
Set up the on-chain paymaster client. This example uses Pimlico:
4
Create Smart Account Client with Gelato Bundler
Combine Gelato’s bundler with the on-chain paymaster:
5
Send Transaction
How It Works
- Request Sponsorship - Your app requests paymaster data from the on-chain paymaster provider
- Build UserOperation - Include the paymaster fields (
paymaster,paymasterData, gas limits) - Submit to Bundler - Gelato validates and bundles the UserOperation
- On-Chain Execution - The paymaster validates the operation and charges ERC-20 tokens
Compatible Paymasters
Any ERC-4337 compatible paymaster works with Gelato’s bundler:Additional Resources
- ERC-20 Payment Tokens - Supported tokens
- Estimate Gas - Gas estimation methods