Paymaster Flow

Understanding each phase

The flow of the paymaster enables a smooth process for users to be able to swap without the need for gas. The following process is completely trustless and can enable a user to pay with any ERC-20 token. Let's break down in detail the whole process into 3 steps.

1. Fetching the transaction data from the front end

Our API can be integrated into any front-end for whatever type of transactions whether it's a DEX, NFT marketplace, DeFi protocol, or a gaming dApp. When connected to the front-end, the API retrieves user-requested transaction data. Zyfi then estimates the gas fee on zkSync's network and fetches off-chain the ERC-20 token price chosen by the user for gas payment.

The API subsequently completes the transaction data, incorporating the ERC-20 token fee to cover gas costs, and signs a message for the transaction to be accepted by the paymaster. The filled transaction data is sent back to the front-end ready for user approval.

2. User signing the reconstructed transaction

The front-end then submits the transaction as normal to the user. The user then reviews the details and signs an off-chain transaction containing the updated transaction data. This data grants the paymaster the ERC-20 fee allowance and authorization to engage with Zyfi's paymaster. The possibilities for the transaction are virtually limitless, as long as the user possesses enough of the ERC-20 token to cover the gas fees.

3. Transaction Execution

The Zyfi paymaster then receives the transaction data associated with the signature of the user approving the signed transaction data. Zyfi then receives the ERC-20 fee, validates & executes the transaction by paying the gas needed for the transaction. If you have any questions regarding the flow don't hesitate to contact the team on Telegram or Discord

If you wish to use the API in your front-end, you can check our documentation: https://api.zyfi.org/api-doc

Last updated