Paymasters
Learn about support for Paymasters in ZKsync Era
Besides Account Abstraction, ZKsync Era natively supports paymasters. Introduced in EIP-4337, paymasters allow to implement an intermediate step for transaction processing that can alter how the fees are being processed.
This feature can be used for things like:
- Ability to pay fees in ERC20 or even NFT tokens.
- Subsidizing transactions.
- Managing fee payments for a static set of wallets.
...and many others.
If you want to learn about Paymaster design, see the protocol documentation.
Testnet Paymaster
To simplify development and testing, ZKsync Sepolia Testnet provides a testnet paymaster with built-in support for paying fees in ERC20 tokens.
Key details:
- Address:
0x3cb2b87d10ac01736a65688f3e0fb1b070b3eea3
(see in explorer) - Chain: ZKsync Sepolia Testnet
- Exchange rate: 1:1 with ETH (1 token unit = 1 wei)
- Flow type: Approval-based only
- Usage requirements:
token
: must match the ERC20 token used for fee paymentminimalAllowance
: must be at leasttx.maxFeePerGas * tx.gasLimit
innerInput
: must be empty (0x
)
Example usage:
const paymasterParams = {
paymaster: "0x3cb2b87d10ac01736a65688f3e0fb1b070b3eea3",
paymasterInput: {
type: "ApprovalBased",
token: "<ERC20_TOKEN_ADDRESS>",
minimalAllowance: tx.maxFeePerGas * tx.gasLimit, // at least
innerInput: "0x",
},
};
This setup allows developers to simulate ERC20-based fee payments in a testnet environment without needing a custom paymaster deployment.
Paymaster tutorials
If you prefer learning from tutorials, you can check out the following ones: