Paymasters
How to create and use paymasters
Creating Your Own Paymaster
You can create your own paymaster with your custom logic to subsidize users in multiple ways. For general information on paymasters, please refer to the Paymasters page.
1. Deploy via txSync
txSync Tsuko offers everyone an easy way to create sponsored paymasters on Sophon and Sophon testnet. To create one, please follow our walkthrough video.
Via txSync Tsuko, you can:
- Top it up with $SOPH
- Withdraw your $SOPH from it at any time
- Monitor it (see usage)
- Add extensions
It is important to restrict your paymasters to your target audience only to avoid unintended usage.
Configure Your Restrictions
txSync Tsuko extensions offer you a list of pre-built restrictions you can plug into your paymasters to filter transactions. This list includes:
- User whitelisting: specify which user addresses (EOAs) can send a transaction.
- Contract whitelisting: specify which contract addresses can be interacted with.
- Function whitelisting: specify both contracts AND functions from those contracts that can be interacted with.
- NFT(ERC721) whitelisting: exclusively authorize paymaster access for holders of a specific NFT collection on Sophon.
For more detail, check their detailed list here.
2. Deploy via Hardhat/Foundry
The ZKsync contract templates repository has examples for both ERC20-based paymasters as well as sponsored(gasless) ones. If you are proficient with direct on-chain deployments, you can tailor these examples to your needs and deploy it following their respective deployment templates.
Was this page helpful?