A Quick Guide to Understand Meta Transactions

Arcana Network
Arcana Network Blog
3 min readMar 10, 2022

This blog post is authored by our in-house Blockchain Developer, Saurav Kanchan, as a part of our on-going “Engineering at Arcana” series. Get up to speed with meta transactions and how they benefit both developers and users.

Let’s say you made a wonderful dapp which can be used by anyone. The problem that most of the dapp users face is account setup. In order to interact with a dapp, they need to go through tedious a process.

This process we mentioned previously involves two aspects:

  1. Creating a wallet
  2. Funding that wallet

Now you might wonder why a person needs funds in his wallet — the answer is transaction fees. Whenever you are calling any function(setter) on a smart contract, you need to pay transaction fees.

Funding the wallet is not an easy step. It involves following things:

  1. Search for an exchange
  2. Creating an account
  3. Entering personal data and uploading proof of identity
  4. Depositing fiat currency
  5. Awaiting for funds to be accredited
  6. Purchasing currency needed for the transaction &
  7. Transferring currency to a wallet that was created earlier.

In order to simplify the whole ordeal of creating and funding a wallet, meta transactions were developed.

A meta transaction primarily separates the signer and gas fees payer of the transaction.

There are 3 main actors in meta transactions: User, relayer, and the contract.

  1. User
    a. User signs the transaction with his private key.
    b. He sends the signed transaction to relayer.
    Note: Here user just signed the transaction and didn’t execute it.
  2. Relayer
    a. Relayer verifies the transaction received from the user.
    b. Relayer wraps the signed transaction into an Ethereum transaction and executes it.
    c. In this way, relayer pays the transaction fees.
  3. Contract
    a. The Contract receives the transaction made by the relayer.
    b. It then unwraps the original signature and uses it.

Technical details

  1. EIP 712: Ethereum-typed structured data hashing and signing
    When a user signs the transaction instead of doing a normal signature, it is said to be a typed signature. The main reason behind doing this is because in a normal signature, users don’t know what they are signing for. In a typed signature, however, they have a clear picture of what data they are signing in. Difference between normal signature and typed signature can be seen below.
  2. EIP 2771: Secure Protocol for Native Meta Transactions
    Wrapping and unwrapping of transactions happens through this protocol. Developer has to inherit their contracts from here. After inheriting their contracts in their code, they need to rename two keywords throughout their code:
    a. msg.sender to _msgSender()
    b. msg.data to _msgData()

Advantages of Meta Transactions

  • User need not have funds in his wallet
  • Developers can pay for users’ transaction fees and later charge users with fiat currencies.

Disadvantages of Meta Transactions

  • Meta tx does not work on all the contracts, it should support meta transactions by importing appropriate code.

A part of our “Engineering at Arcana” series, blogs such as this and more are coming your way every month. Follow us on our socials and subcribe to our mailing list to stay updated. Links to our previous engineering blogs 👇

About Arcana Network

Arcana is the Web3 Infra to manage your data layer. Web3 App and wallet developers use Arcana’s SDK to authenticate users by generating wallets with Social and Passwordless Auth, Store Encrypted Data, and Manage Access. Built for Ethereum and EVM based chains, with Arcana’s privacy stack, developers can build secure and privacy-preserving apps with a seamless user experience.

Arcana has raised 2.7Mn USD from some of the leading investors and founders in the ecosystem such as Balaji Srinivasan, Founders of Polygon, Woodstock, Republic Crypto, and Digital Currency Group.

Watch out for Arcana’s upcoming Testnet and Mainnet in 2022.

Official Links: Website | Telegram | TG Announcement | Twitter | Medium

--

--

Arcana Network
Arcana Network Blog

Modular Layer 1 to power Web3 Abstractions. Wallet Abstraction 🟢 Gas Fee Abstraction 🟢 Chain Abstraction 🔜 ⏳. $XAR available on ByBit & Gate