Integration with Pimlico (AA Infrastructure)
Pimlico is infrastructure provider for Account Abstraction: bundler (packs UserOperations into transactions) and paymaster (sponsors gas). This is managed service on top of ERC-4337, which removes need to run own bundler and manage paymaster contract.
What Pimlico Provides
Bundler API — accepts UserOperations, validates, packs into bundle transactions and sends on-chain. Supports eth_sendUserOperation, eth_estimateUserOperationGas, eth_getUserOperationByHash — standard ERC-4337 interface.
Paymaster API — sponsoring gas without needing ETH on user wallet. Two modes: verifying paymaster (signs permission to sponsor specific operation) and ERC-20 paymaster (user pays gas in USDC/other token).
Alto — Pimlico's open-source bundler, which can be deployed independently if you need independence from their infrastructure.
Integration via permissionless.js
Pimlico supports permissionless.js — TypeScript library for working with AA:
import { createSmartAccountClient } from "permissionless";
import { createPimlicoBundlerClient, createPimlicoPaymasterClient } from "permissionless/clients/pimlico";
import { createPublicClient, http } from "viem";
import { sepolia } from "viem/chains";
const publicClient = createPublicClient({
chain: sepolia,
transport: http("https://rpc.ankr.com/eth_sepolia"),
});
const bundlerClient = createPimlicoBundlerClient({
transport: http(`https://api.pimlico.io/v2/sepolia/rpc?apikey=${PIMLICO_API_KEY}`),
entryPoint: ENTRYPOINT_ADDRESS_V07,
});
const paymasterClient = createPimlicoPaymasterClient({
transport: http(`https://api.pimlico.io/v2/sepolia/rpc?apikey=${PIMLICO_API_KEY}`),
entryPoint: ENTRYPOINT_ADDRESS_V07,
});
Creating smart account (based on Safe or Kernel):
import { signerToSafeSmartAccount } from "permissionless/accounts";
const safeAccount = await signerToSafeSmartAccount(publicClient, {
signer: walletClient,
entryPoint: ENTRYPOINT_ADDRESS_V07,
safeVersion: "1.4.1",
});
const smartAccountClient = createSmartAccountClient({
account: safeAccount,
entryPoint: ENTRYPOINT_ADDRESS_V07,
chain: sepolia,
bundlerTransport: http(`https://api.pimlico.io/v2/sepolia/rpc?apikey=${API_KEY}`),
middleware: {
sponsorUserOperation: paymasterClient.sponsorUserOperation,
},
});
// Send transaction without ETH on wallet
const txHash = await smartAccountClient.sendTransaction({
to: "0xTarget",
value: 0n,
data: "0xCalldata",
});
Paymaster Integration
For sponsored transactions — paymaster signs permission to sponsor specific UserOperation:
// Getting sponsorship from Pimlico
const sponsorResult = await paymasterClient.sponsorUserOperation({
userOperation: userOp,
});
// sponsorResult contains:
// - paymasterAndData (for EntryPoint V0.6)
// - paymaster + paymasterData + paymasterVerificationGasLimit + paymasterPostOpGasLimit (V0.7)
ERC-20 paymaster allows users to pay gas in USDC. Pimlico supports this via pimlicoPaymasterClient.getTokenQuotes to get rate and approveTokenPaymaster to approve token.
Limits and Pricing
Pimlico works on freemium model: free tier with limits on number of UserOperations per day. Production requires API key with per-operation payment or fixed plan. When choosing paymaster — Pimlico charges commission on top of actual gas cost.
Integration timeline of basic AA flow with Pimlico bundler and paymaster — 1-2 weeks. Includes smart account implementation choice (Safe, Kernel, Biconomy), paymaster policy setup, testnet testing.







