Choose your paymaster provider

Selecting the right paymaster infrastructure depends on your target chains, preferred account abstraction standard, and pricing model. The market has consolidated around three primary options: Pimlico, ZeroDev, and Coinbase. Each offers distinct advantages for different developer stacks.

Pimlico provides a robust, chain-agnostic bundler and paymaster service. It is the go-to choice for teams building on EVM-compatible chains who need deep customization of user operations and gas sponsorship logic. Their API is designed for developers who want granular control over transaction batching and verification.

ZeroDev focuses heavily on account abstraction and smart account deployment. If your product relies on complex smart contract wallets or specific AA features beyond simple gas sponsorship, ZeroDev’s SDK integrates tightly with their infrastructure. They offer a streamlined developer experience for launching sponsored transaction flows quickly.

Coinbase Developer Platform (CDP) offers a paymaster solution optimized for its own ecosystem and supported chains. It is particularly attractive for teams already using Coinbase infrastructure or targeting retail audiences familiar with Coinbase wallets. The service includes built-in sponsorship limits and batch transaction capabilities, reducing the operational overhead of managing gas infrastructure.

ProviderPrimary FocusChain SupportPricing Model
PimlicoCustom AA & BundlingMulti-chain EVMPay-as-you-go
ZeroDevSmart Account SDKMulti-chain EVMUsage-based
CoinbaseRetail & EcosystemCoinbase-supportedFree tier + usage
The Paymaster Kit

Integrate the smart account SDK

Connecting your application to the Paymaster Kit requires initializing the smart account SDK and binding it to a bundler. This setup ensures that user transactions are properly formatted and routed through the paymaster contract.

The Paymaster Kit
1
Install the SDK package

Run the standard package manager command to add the SDK to your project dependencies. This installs the core client libraries needed to interact with ERC-4337 smart accounts. For most Node.js environments, use npm install @account-kit/sdk or the equivalent for your chosen provider like Pimlico or ZeroDev.

2
Initialize the bundler connection

Create a bundler instance using your provider's RPC endpoint. The bundler is responsible for collecting user operations and submitting them to the network. Configure the bundler URL with your API key to ensure reliable transaction propagation. This step links your local environment to the mempool where paymasters monitor incoming requests.

3
Configure the paymaster contract

Bind your smart account to the specific Paymaster Kit contract address. Pass the paymaster address and optional data into the SDK configuration object. This allows the account to request gas sponsorship automatically during transaction execution. Verify that the paymaster is whitelisted on the bundler you selected.

4
Test the integration

Send a test transaction from a development wallet to confirm the paymaster covers the gas fees. Check the transaction receipt to ensure the paymasterAndData field is populated correctly. If the transaction fails, verify that your bundler RPC is active and that the paymaster contract has sufficient funds in the target token.

Configure gas fee optimization

Switching your paymaster to accept ERC-20 tokens like USDC removes the friction of requiring users to hold native ETH for gas. This approach stabilizes operational costs and aligns transaction fees with the value users are already transacting in.

Step 1: Define the accepted token

Identify the specific ERC-20 contract address you want to accept for gas payments. USDC is the standard choice for most applications due to its liquidity and stability. Ensure your smart contract is configured to recognize this address as a valid payment method for the payForTransaction function.

Step 2: Implement the allowance check

Your smart account logic must verify that the user has granted sufficient allowance to the paymaster contract. Unlike native ETH, ERC-20 tokens require an explicit approve or increaseAllowance transaction before the paymaster can deduct fees. Integrate this check into your onboarding flow to prevent failed transactions.

Step 3: Update the bundler configuration

Configure your user operation bundler to route gas payments through the ERC-20 paymaster contract. This ensures that when a user submits a transaction, the bundler interacts with the paymaster to deduct the fee from the user's USDC balance rather than requesting ETH from the user's wallet.

The Paymaster Kit
1
Set up the ERC-20 paymaster contract

Deploy or configure the paymaster contract to accept your chosen ERC-20 token. Verify the token address and ensure the contract has sufficient liquidity to cover gas refunds for the bundler.

2
Integrate allowance logic into your frontend

Add a pre-transaction step that checks the user's USDC allowance. If the allowance is insufficient, trigger an increaseAllowance call before submitting the main user operation.

3
Route operations through the bundler

Update your SDK configuration to point to the ERC-20 paymaster. This ensures all user operations are signed and submitted with the correct gas payment context.

Step 4: Test with a bundler

Use a testnet environment to validate the end-to-end flow. Submit a transaction and verify that the bundler successfully deducts the gas fee from the user's USDC balance and forwards the appropriate amount to the validator. Monitor the transaction receipt to ensure no unexpected revert errors occur due to allowance limits.

For a detailed technical walkthrough of the contract integration, refer to the MetaMask ERC-20 Paymaster tutorial.

Test batch transaction logic

Batching transactions reduces on-chain overhead by grouping multiple user operations into a single paymaster call. This approach lowers gas costs and improves throughput, but it requires precise validation to ensure no single failed operation breaks the entire batch. Testing this logic ensures your paymaster can handle both successful batches and partial failures without locking funds or leaving users stranded.

The Paymaster Kit
1
Set up the test environment

Initialize a local blockchain environment using a tool like Hardhat or Foundry. Deploy your paymaster contract and a test ERC-20 token. Fund the paymaster with sufficient ETH to cover gas and the test token to cover user balances. Ensure your test suite can simulate multiple user wallets interacting with the paymaster simultaneously.

2
Create a multi-operation batch

Define a batch containing three distinct user operations: a token transfer, a token approval, and a simple ETH transfer. Each operation should have a unique nonce and be signed by a different user wallet. This variety tests whether your paymaster can correctly parse and validate heterogeneous transaction data within a single batch.

3
Execute the batch via the paymaster

Submit the batch to your paymaster contract. The paymaster should aggregate the gas costs, sponsor them, and execute the operations in order. Verify that the transaction is accepted by the node and that the gas fee is deducted from the paymaster’s balance. Check the transaction receipt for the correct status code.

4
Validate partial failure handling

Introduce a deliberate error in one of the operations (e.g., insufficient token balance for one user). Resubmit the batch. Confirm that the paymaster rejects the entire batch or handles the failure gracefully, depending on your contract’s design. Ensure that no funds are locked and that the other valid operations are not compromised by the failure.

5
Verify gas cost efficiency

Compare the gas used by the batched transaction against three separate individual transactions. The batched version should demonstrate significant gas savings due to shared overhead costs. Document the gas difference to confirm that batching delivers the expected cost efficiency for end users.

For production deployments, consider using Coinbase Paymaster’s batch transaction support, which offers secure infrastructure and up to $15K in free gas credits for testing and initial scaling. This can help validate your batch logic against real-world network conditions before full launch.

Paymaster Integration FAQ