How Paymaster Works
A user submits a UserOperation (UserOp) to a bundler through the ERC-4337 alt-mempool. If the UserOp’s paymasterAndData field is non-empty, it signals that a Paymaster should be used.
Before a bundler includes the UserOp on-chain, it typically simulates the operation through the EntryPoint (using EntryPoint simulation tooling) to check that validation will pass and that gas costs are covered.
On-chain, EntryPoint calls the Paymaster during the validation phase via validatePaymasterUserOp(userOp, requestId, maxCost). The Paymaster can accept (optionally returning “context” data) or reject by reverting. After execution, EntryPoint calls postOp(mode, context, actualGasCost) so the Paymaster can finalize accounting, such as charging a user in tokens or decrementing a quota.
To participate, Paymasters maintain an ETH deposit in EntryPoint to pay fees, and they also post an additional stake with an unstake delay to discourage griefing/DoS behavior.
Common patterns include:
- Sponsored Paymaster (true “gasless”): the sponsor pays.
- ERC-20 / token Paymaster: the user pays in a token while the Paymaster covers ETH.
- Verifying Paymaster: an off-chain service signs approvals embedded in
paymasterAndData. - Whitelist / hybrid: allowlists, quotas, or action-specific sponsorship.
Example
If paying gas is like needing cash for a toll road, then a Paymaster is like a toll account that pays for you—sometimes free, sometimes billing you later in another currency.
Why It Matters
Paymasters enable gas abstraction, which can remove the “must hold ETH” hurdle for onboarding and app UX. They also let apps enforce business rules around who gets sponsored and when.
Risks or Limitations
A Paymaster can still pay gas when a sponsored operation fails, so weak validation rules can lead to gas griefing and deposit draining. Designs that rely on off-chain signatures must prevent replay and bind approvals to the intended call data, limits, and validity window. Token paymasters add pricing, slippage, and execution risks around token-to-ETH conversion.
Related Terms
- ERC-4337 (Account Abstraction)
- EntryPoint
- UserOperation
- Bundler
- Gas Abstraction