A paymaster is a smart contract that pays the transaction costs (gas) on behalf of a user, as part of account abstraction (ERC-4337). With a paymaster, users can perform blockchain transactions without holding ETH or another native coin: the app sponsors the gas, or the user pays in a token such as USDC. Paymasters are one of the main building blocks for crypto apps that feel like normal apps.
How does a paymaster work?
- The user's wallet creates a UserOperation and names a paymaster in it, usually with data or a signature from the paymaster's off-chain service.
- The bundler simulates the operation. The EntryPoint contract asks the paymaster to validate it: does it agree to pay for this operation?
- If so, the gas is charged to the paymaster's deposit in the EntryPoint contract, instead of to the user's account.
- After execution, the paymaster can settle costs, for example by charging the user an amount in an ERC-20 token.
Paymasters must keep a deposit and a stake in the EntryPoint contract. That stake discourages paymasters from approving operations in simulation and then making them fail, which would cost bundlers money.
Types of paymasters
- Sponsoring (verifying) paymaster: the app pays the gas for its users, usually after an off-chain check of rules such as "new users only" or "maximum ten transactions per day".
- Token (ERC-20) paymaster: the user pays the gas in an ERC-20 token such as a stablecoin; the paymaster converts it using a price feed.
- Custom paymasters: logic for specific situations, such as paying gas only for certain contracts, subscription models or loyalty points.
Running a paymaster: points of attention
A paymaster pays real money, so its rules must be watertight: limits per user and per day, protection against abuse by bots, monitoring of the deposit, and reliable exchange rates for token paymasters. Many projects start with a hosted paymaster service from an infrastructure provider and build their own when they need custom rules or lower costs. See our paymaster solutions, custom paymaster development and gasless transactions.
Frequently Asked Questions about Paymasters
What does gasless mean?
Gasless means the user doesn't pay gas themselves; someone else, usually the app via a paymaster, pays it. The gas is still paid on the blockchain.
Who pays for a sponsored transaction?
The party that runs or funds the paymaster, usually the app or platform, from its deposit in the EntryPoint contract. Many apps see this as a customer acquisition cost.
Can a paymaster be abused?
Yes, if its rules are too loose: bots can drain the deposit with useless transactions. Limits per user, off-chain approval and monitoring prevent that.
Do paymasters only work with ERC-4337?
Paymasters are part of ERC-4337 on Ethereum and EVM chains. Networks with native account abstraction, such as zkSync, have their own built-in paymaster mechanism.