Breaking Web3 Entry Barriers with Meta Transactions
As you begin dipping your toes into the much hyped world of blockchain, crypto and Web3, you realise that unlike Web2, this is not a piece of cake. This is mostly true irrespective of whether you are an end user or a developer of decentralised applications (dApps).
Web3 entails a significant barrier to entry for both end users as well as Web2 developers that are building decentralised applications (dApps) for the end users. Despite the hype, the Web3 adoption rates are nowhere close to those of Web2, in its infancy.
There is a long road ahead with a bumpy ride guaranteed. While dApp developers and end users grapple with onboarding woes, the blockchain backend ecosystems that power the dApps, have their own bigger challenges that are yet to be solved.
Should that deter you from delving any deeper into Web3, yet?
Not at all, unless you don’t enjoy a front row seat in the fast evolving Web3 technology arena.
In this post, we will take a look at some of these chicken and egg kind of onboarding challenges that are impacting dApp adoption and how those can be addressed through the Meta Transaction approach while building dApps.
End user challenges
Getting started with a Web3 app requires end users to understand the blockchain onboarding model, the token and payment mechanisms involved and managing secret keys. Web3 dapps use blockchain technology and smart contracts at the backend that are driven primarily by block mining and verification transactions. For initiating a transaction, end user must have:
- A secret key to sign the transaction, mechanism to store and access it securely.
- Besides the basic knowledge of blockchain semantics, user needs to know which encryption and decryption mechanism (key and data) is secure for them to use.
- A wallet loaded with tokens or acceptable blockchain currency (coins) to pay gas or the transaction fees.
The biggest challenge faced by dApps developers is end user adoption.
Well, they can make onboarding a little easier for end users by offering them dApp subscriptions that can be purchased using fiat currency, while the developers themselves bear the burden of paying gas fees through blockchain wallet and token mechanisms.
However, that brings up to a different set of issues altogether, related to creating and funding the wallet, before any functions can be called (Setters) on the smart contracts living in blockchains:
- Searching for a suitable blockchain exchange that meets the dApps security and privacy, use model requirements.
- Creating and managing the accounts and wallets.
- Storing personal information and identity proofs.
- Depositing fiat currency.
- Ensuring fiat funds are accredited and available for transactions
- Purchase currency or tokens required for the requisite blockchain transactions.
- Transfer currency to the wallet.
If dApp developers choose to manage these for their end-users to make Web3 dApps onboarding experience similar to Web2 and enable more end-users, these issues listed above are big enough to eat into a significant portion of dApp developer’s time and efforts. That time and effort can be better spent in focusing on building the dApp application logic itself.
Well, this is where Meta Transactions can make a huge difference! Let’s look at what Meta Transactions are and how they work.
A meta transaction is a regular Ethereum transaction that embeds another transaction within the actual transaction. The actual transaction is signed by a user and then sent to an operator or relayer. Users do not require gas and blockchain interaction to submit a meta transaction but they could pay a subscription fee in fiat currency to the operator to submit blockchain transactions on their behalf. The operator takes this user signed transaction and submits it to the blockchain paying for the fees himself. The operator cannot change the actual transaction but can submit it to the blockchain smart contract. The contract checks that there is a valid signature on the actual transaction and then executes it.
There are three key actors in a meta transaction — User, Relayer or Operator, and the Blockchain Smart Contract.
Figure below shows the sequence of actions that form a meta transaction:
Sequence of actions that take place in the above illustration:
- User signs the transaction using their private key.
- User sends the signed transaction to the relayer.
- Relayer verifies the transaction received from the user.
- Relayer wraps the signed transaction into an Ethereum blockchain transaction and executes it after paying requisite gas fees.
- Contract receives the transaction made by the relayer.
- It unwraps the meta-transaction and extracts user signature therein to execute the transaction.
So does meta transaction solve all onboarding issues, maybe not. Let us take a look at some of the advantages and disadvantages.
Pros and Cons
- Users can get started with Web3 dApps with Fiat currency.
- Wallets are not mandatory but optional as long as dApp developer offers secure key storage and management or passwordless kind of features in dApps taking off the key management burden from end users.
- Not all smart contracts support meta transactions.
- There could be a trust issue as the meta transaction model involves a third party between a user owning and signing a blockchain transaction on one end and the smart contract on the other end. There is no guarantee that the operator or Relayer will actually submit the transaction.
In the context of meta transactions there are certain security considerations that we need to be aware of:
- EIP712: Ethereum Typed Structured Data Hashing and Signing
When a user signs the meta transaction, instead of a normal signature, he is required to perform a typed signature.
The reason why this is done is that in case of normal signatures, users do not have visibility and they don’t know what they are signing for. However, in typed signatures, they can obtain a clearer picture of what data they are signing in.
Figure below shows the difference between normal signature and typed signature:
2. EIP2771: Secure Protocol for Native Meta Transactions
Meta Transaction related wrapping and unwrapping of the transaction happens through this protocol. Developers have to inherit their contracts from here in order to wrap the transaction. After inheriting the contracts in their code, developers need to rename 2 keywords throughout their code.
- 1. msg.sender to _msgSender()
- 2. msg.data to _msgData()
Meta transaction is a way forward to enable Web2 users and developers onboard Web3 easily with a lower barrier to entry. For more information see the following references:
- Understanding ethereum meta transactions https://betterprogramming.pub/ethereum-erc-20-meta-transactions-4cacbb3630ee
- Gasless or meta transactions https://docs.openzeppelin.com/learn/sending-gasless-transactions
- Contracts: Meta transactions core https://docs.openzeppelin.com/contracts/4.x/api/metatx
Subscribe to our mailing list and follow us on all our socials to stay up to date with all our latest updates. Here are some of our previous “Engineering at Arcana” blogs to check out👇
Vue 3 Composition API: Basics and Patterns
This blog is a part of our “Engineering at Arcana” series, and is written by our Frontend Developer Shrinath Prabhu.
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.