Zksync

Zksync paymasters pay Era gas fees with ETH while enabling sponsorship or ERC-20 reimbursement

Zksync paymasters pay Era gas fees from their ETH balance, allowing applications to sponsor eligible transactions or accept supported ERC-20 tokens from users. The selected contract determines token support, authorization, and charging rules. A user can avoid supplying ETH for gas when that contract approves and funds the transaction. Choosing a paymaster therefore means checking who bears the cost, what spending permission it needs, and how its settlement rules handle failed execution and unused gas.

Updated ·
Bottom line: A token allowance authorizes spending, while the paymaster’s charging and refund logic determines the user’s eventual token cost.

Sponsorship and ERC-20 payment choices

Gas sponsorship covers the network fee from a sponsor’s budget, while token payment reimburses a paymaster under its contract’s terms. Both models use Era’s native account abstraction. Direct ETH payment remains an alternative when sponsorship is unavailable and the sender can fund gas.

An application’s choice of flow controls account preparation. The general flow carries data for the paymaster without a predefined token-approval operation. The approval-based flow supplies token and allowance instructions. Custom accounts can implement different interactions, so native paymaster support does not automatically establish compatibility with every standardized flow.

Fee payment option Funding and authorization requirements
Direct ETH payment The sender funds gas; no paymaster approval applies.
General-flow sponsorship The paymaster accepts sponsorship and supplies ETH; the default account performs no predefined token approval.
Approval-based token payment The account supplies token allowance; the paymaster checks its conditions and supplies ETH.
Built-in testnet paymaster Approval-based ERC-20 payment on Era’s Sepolia testnet, subject to its demonstration terms.
Common paymaster dependency Every Era paymaster option requires ETH for the network fee.

Why do paymasters need ETH when users pay in tokens?

Paymasters need ETH because Era’s bootloader collects the sponsored network fee in ETH. The bootloader coordinates transaction validation and execution. ERC-20 reimbursement follows the agreement between the user and the paymaster. Token collection alone does not replenish the contract’s ETH balance. A paymaster can include conversion logic, or retain tokens while its operator supplies ETH separately. Its funding arrangement must deliver enough ETH during validation, before the application call executes.

Common implementations prepay gasLimit * maxFeePerGas wei, providing fee capacity that can exceed the eventual network charge.


Token allowances inside the sponsored transaction

Account preparation

An ordinary Era account can establish the requested token allowance during preparation for an approval-based paymaster transaction. A separate approval transaction is not inherently necessary. The account reads the token and minimum allowance from the encoded input. The additional payload carries data for the paymaster’s own validation logic.

Custom accounts choose how to implement preparation. Their integration must provide the permissions that the selected paymaster actually requires. A token-charging paymaster needs its own allowance checks and must handle token transfer failures. An input that names a minimum allowance cannot substitute for those checks.

Permission left after payment

A token allowance authorizes a spender to transfer tokens up to the approved amount without moving tokens by itself. The amount that a paymaster collects follows its charging logic, so an allowance ceiling can exceed the settled token charge. Token balances, remaining allowance, and transfer records describe different parts of that payment.

Visual summary: Permission left after payment (Zksync paymasters)
Diagram: Permission left after payment.

View image file

Unused permission can survive when a paymaster does not consume the entire allowance. A later revocation changes future spending authority, subject to the token’s behavior. It cannot undo a completed transfer. The spender address and requested allowance therefore matter before signing the sponsored transaction.


Gas estimates with paymaster validation

Gas estimation needs the intended paymaster address and input because sponsorship adds validation and payment work to the target contract call. ERC-20 transfers and allowance changes can add further cost. Era uses one transaction gas limit across these operations, and publishing public rollup data, called pubdata, can affect it. A quote for a call without the paymaster omits the chosen payment path. Some designs also bind authorization to fee parameters, creating a dependency between signing and estimation. Their estimation logic needs to preserve relevant work without treating incomplete authorization as valid sponsorship.


What does a paymaster validation error mean?

A paymaster validation error means that the sponsored transaction failed acceptance checks before the application call could execute.

Validation rejection

Validation rejection leaves the target call unexecuted and prevents the transaction from entering a block or incurring a network fee. Possible causes include unsupported input, inadequate token allowance, invalid authorization, or insufficient paymaster ETH. More gas cannot repair a rejected signature or make an unsupported token acceptable.

Gas estimation can report the same rejection because it runs the paymaster’s validation logic. Repeatedly increasing the gas limit can therefore leave the underlying failure unchanged. A transaction hash from submission alone establishes neither inclusion nor successful execution.

Execution reverts

An execution revert happens after successful validation and fee payment. Era can include that failed transaction in a block and charge gas for the work performed. The target call’s failure does not erase every action from the earlier validation phase, including token collection that a paymaster performed.

The receipt’s execution status and the paymaster’s token settlement describe separate outcomes. Transfer records identify tokens actually collected or returned; application state establishes what the target call changed. A sponsorship confirmation cannot establish either outcome before execution.

Network refunds and token reimbursement

ETH returned to the payer

Era sends its unused-gas refund to the paymaster when that contract paid the transaction fee. That refund replenishes the paymaster’s native balance. It does not, by itself, reverse the user’s ERC-20 payment or establish the token amount that the user should receive.

Visual summary: ETH returned to the payer (Zksync paymasters)

View image file

Contract-defined token refunds

A paymaster can implement token refunds through its settlement logic. The postTransaction hook lets a contract examine execution and perform follow-up accounting. The protocol does not guarantee that it will invoke this hook; an out-of-gas execution can prevent it. Refund designs that rely entirely on the hook must account for that failure condition.

The hook also consumes gas, which can reduce the eventual native refund. A fixed token charge, proportional charge, or refund policy describes the selected contract’s economics. Era’s ETH refund mechanism does not impose a matching token tariff or refund policy on every paymaster.


Testnet pricing and production limits

The built-in paymaster on Era’s Sepolia testnet supports only the approval-based flow and does not use the inner payload, which should be empty. Its encoded token charge must cover at least gasLimit * maxFeePerGas token base units, with sufficient allowance from the sender. The contract collects that encoded amount and leaves its post-transaction hook empty, so it does not reimburse surplus tokens through that hook.

Production paymasters choose their supported tokens, charging logic, and authorization requirements. Sponsorship remains conditional on available ETH and accepted transaction rules. Operators need authorization controls that constrain access to the gas budget. Noncompliant paymasters can stop working if the protocol tightens enforcement of its verification rules.

Testnet fee calculations use raw token quantities, so different decimal precision produces different whole-token charges. The Sepolia testnet paymaster sets the minimum token charge at 1 token base unit per wei of prepaid ETH.

Graphic: Zksync paymasters - Testnet pricing and production limits

View image file

Zksync paymasters: quick answers

Can an ordinary Era account use a paymaster without deploying a smart wallet?

An ordinary externally owned Era account can use a compatible native paymaster without deploying a separate smart wallet. Era integrates paymaster support into its account-abstraction transaction flow. The wallet or application still needs to construct and sign the appropriate transaction. Protocol support does not establish that every wallet interface exposes sponsorship or every sponsor accepts that account.

Does sponsorship also fund ETH sent to the target contract?

Fee sponsorship does not automatically fund the ETH value that a transaction sends to its target contract. Era’s default account still needs enough ETH for that attached value when a paymaster covers gas. A sponsored call with no attached ETH can avoid that requirement, subject to the account’s validation and the paymaster’s terms. Token reimbursement can create a separate token-balance requirement.

Are EIP-4337 paymasters directly interchangeable with native Era paymasters?

An EIP-4337 paymaster is not automatically compatible with Era’s native paymaster interface. Native Era paymasters implement IPaymaster and interact with the bootloader using Era’s transaction structure. An integration built for an EntryPoint and UserOperations needs corresponding adaptation before it can use that native path.

Where must an Era transaction carry its paymaster parameters?

A native sponsored Era transaction carries a nonzero paymaster address and encoded paymasterInput in its EIP-712 transaction data. Era SDKs commonly expose these through paymasterParams in customData. The input must match the flow and payload that the selected contract accepts. Supplying an address alone does not establish valid sponsorship or authorize a token charge.

Why can changing the gas limit invalidate a sponsorship signature?

Changing the gas limit can invalidate sponsorship when the paymaster’s signed authorization binds that field. The submitted transaction must match the values that the sponsor authorized. Other implementations can bind different fields, including fee settings or the destination. A larger gas allowance does not preserve a signature over different transaction parameters, even if the application call stays unchanged.

How long can an unused sponsorship authorization remain valid?

A sponsorship authorization remains usable only while its contract-defined validity conditions hold. Signature-based designs can enforce an expiration time and a permitted nonce range. Their deadlines and nonce constraints govern acceptance; native paymaster support supplies no universal validity period. An unexpired signature also cannot compensate for depleted funding or a mismatch in the transaction fields that it covers.

Will a paymaster cover the gas for an Era contract deployment?

A native Era paymaster can fund a compatible contract-deployment transaction when its validation rules permit that deployment. The transaction needs compatible paymaster data and enough gas for deployment and fee handling. Sponsorship covers the deployment fee under the selected contract’s terms. It does not establish that every sponsor accepts deployments or that ordinary deployment tooling automatically supplies the necessary parameters.

What does _maxRefundedGas mean in a paymaster callback?

The _maxRefundedGas parameter represents an upper bound on refundable gas, not a settled ETH payment. The postTransaction hook receives it alongside execution context and the transaction result. Gas that the hook itself consumes can reduce the eventual refund. Converting that bound into a promised token refund would also require the contract’s pricing and settlement rules.