Understanding MetaFab's Gasless Transactions

Introduction

A "gasless" transaction is a transaction submitted to a blockchain's network for processing where one wallet specifies the transaction details and signs the transaction, while another wallet submits the transaction and pays the gas fee on the signing wallet's behalf. The architecture for this system at its core is based on EIP2771 / ERC2771.

MetaFab implements gasless transactions for player wallets across all contracts deployed by MetaFab and any contract that implements support for MetaFab's trusted forwarder. This means players can do blockchain level transactions (trading, buying, selling, earning, etc) without ever needing to deal with exchanges to get native chain tokens for gas, deal with transaction signing, wallet management, and more. This ultimately enables a player experience that is seamless and frictionless for all aspects of your crypto game or gamified application.

Funding Gasless Transactions

First off let's be clear, MetaFab's gasless transactions don't mean that network fees are avoided. It means that to players, they don't have to deal with the friction of network fees to submit their transactions.

Gasless transactions for your game are funded by the native token balance of the fundingWallet's address specific to your game.

For example, if your game's contracts that players interact with are deployed on the Polygon network, you would keep a balance of $MATIC token (Polygon's native token) in your fundingWallet's address. Anytime a player associated with an API request that requires a transaction to be submitted, the following process happens.

  1. MetaFab signs the transaction on behalf of the authenticated player tied to the API request.

  2. MetaFab checks the status of many internally managed wallets in our system that are only for submitting transactions on behalf of players of your game.

  • If an available submitting wallet that does not have a pending transaction is found, that wallet is selected to submit the player's signed transaction.

  • If no available wallet is found, MetaFab will create a new internal submission wallet for your game and deposit a small amount of token from your funding wallet into this new internal submission wallet to submit the transaction on the player's behalf.

  • If an existing submitting wallet is found but has an insufficient balance of native token to submit the transaction, a small amount of native token will be transferred from your game's funding wallet to the submitting wallet for use.

  1. The transaction is submitted to the network and processed.
1954

Scalability

MetaFab's gasless transaction system is setup to indefinitely scale and handle demand spikes. The system will automatically generate more internal wallets on-demand for your game to handle more transaction throughput as needed. Creating new internal wallets takes less than 1/10th of a second internally and is designed to be unnoticeable from a latency perspective.

Considerations

πŸ“˜

Dealing with exhausted funding wallet balances.

It's incredibly important to make sure your game's fundingWallet has a sufficient balance of native tokens for the specific chain your players are interacting with your game currencies, items, marketplace or other systems on.

If your funding wallet runs out of native token balance to cover transaction fees on behalf of your players, all MetaFab API requests requiring a transaction to be submitted on behalf of your players will immediately begin returning 400 - Bad Request errors indicating that your funding wallet has an insufficient balance.

πŸ“˜

Bad actor rate limiting.

MetaFab's gasless transaction system is setup to rate limit API requests on a per-player basis to prevent a sudden flood transactions per second in a malicious attempt to disrupt your game's services by draining your funding wallet's balance.

MetaFab API's will return a 429 - Too Many Requests error for any single player that is tied with a sudden burst or large volume of API requests over a dynamically managed interval of time.