Meta Transaction
Meta Transaction is a solution that utilizes third-party relayers to facilitate gas fee payments, allowing users to interact with the blockchain without the need to pay native token gas fees.
Why Meta Transactions Are Needed
Meta Transactions offer several benefits for both users and developers. As follow:
- Eliminate the barriers of users needing to hold and manage cryptocurrencies. This enables non-crypto-native users to interact with blockchain more easily, without delving into the complexities of cryptocurrency wallets and intricate transaction processes.
- Interact with dApps without paying gas fees or waiting for transaction confirmations. This feature contributes to the increased adoption of dApps by removing significant barriers for users.
- Alleviate the competition issue regarding gas fees. Sometimes users will raise the gas price to ensure quick transaction confirmations. Through Meta Transactions, users can submit transactions without worrying about competing for block space.
Why Mantle Implements Meta Transactions at the Protocol Level
While solutions like Biconomy and Etherspot exist in the market as contract-based account abstraction solutions that can indirectly provide gasless options, they often require users to pre-fund native tokens or other ERC20 assets on the account abstraction (AA) platform as transaction fees, thereby increasing user costs.
On the other hand, contract-level gasless Meta Transaction solutions like GSN and Defender allow users to sign transactions off-chain (without gas consumption) and send them to a relayer for execution. However, the involvement of a relayer requires asset contracts and dApps to inherit ERC2771Context to separate msg.sender
and relayer addresses.
Given the existing solutions in the market, Mantle introduces a protocol-level Meta Transaction solution, enabling users to initiate gasless transactions in any scenario without addressing technical debt, truly achieving a contract-agnostic Meta Transaction solution.
For the account abstraction solutions at the contract level, Mantle has also been integrated, see here for more details.
Implementation in Mantle
To implement Meta Transactions, modifications are made to the op-geth
system within the Mantle framework. This involves introducing a metaTx
flag in the transaction payload field, along with a signature for gas fee sponsorship payment. The specific steps are as follows:
- Users construct a
SimulateTx
transaction, sending it to layer 1 (L1), specifying the gas fee sponsor and the percentage to be paid by the sponsor. This step calculates the gas fee required for subsequentmetaTx
transactions. - Upon receiving the results, users request a signature from the sponsor.
- The sponsor accepts the request and returns the corresponding sponsorship signature.
- Users use this signature to construct a
metaTx
. op-geth
processes the transaction upon receipt, completing verification and gas handling.op-batcher
andop-proposer
submit the transaction and state commitments to L1, finalizing the transaction.
Features of Mantle Meta Transactions
The Mantle Meta Transaction solution encompasses the following features:
- Support for Sponsor Exit: By setting an expired height, sponsors can exit the gas sponsorship role after a specific height, enhancing system flexibility.
- Partial Gas Fee Payment Support: By setting a percentage, users can flexibly manage gas fees. This feature provides users with greater flexibility and control over gas expenses according to their specific needs.
Through these innovative features, the Mantle Meta Transaction solution aims to offer users a more convenient and efficient transaction experience.