What is your most painful experience when starting your crypto journey?
Being rugged and scammed? Messing up when trying to distinguish between a passphrase and a private key?
How about the pain of staying up until 3 AM to ape in a potential alpha but then witnessing your transaction fail because of “Not enough gas”?
These are just some of thousands of trouble for crypto newbies. And from here, a solution called “relayer” has been born.
In blockchain, relayer can be:
(i) A place where individual orders are aggregated to an orderbook for users to store and find matched orders off-chain; only final transaction is submitted on-chain. An example of this is 0x.
(ii) A third party executing transactions on behalf of users and paying platform-native token in exchange for a small fee of service (denominated in other currency).
(iii) A third party being in charge of “connecting” different blockchain platforms. These relayers are used in cross-chain projects such as LayerZero or RelayChain.
In this article, we will only discuss the second meaning of a relayer.
Under the hood, such relayer is working based on the so-called meta-transaction, or gasless transaction.
Below is how Gas Station Network (GSN), a system of meta-transaction relayers on Ethereum, operate.
Basically, meta-transactions are transactions in which there is data about an actual transaction inside to be executed which will be created and signed by an individual, and then sent to the relayer. There will be a smart contract (paymaster) responsible for gas payment in exchange for a service fee. A smart contract called forwarder verifies the sender’s signature and forwards the request to a recipient contract. Recipient contract here is the final “destination” where the sender wants to interact with his DApps.
To avoid being criticized the decentralization philosophy of blockchain, relayers and paymasters will work independently and competitively on the network of RelayHub.
On Solana, the way meta-transactions work is quite different as users can directly specify who the gas payers are. This assignee will have to sign the transaction for it to be approved, thereby reducing the verification and confirmation process of the forwarder as in the GSN system.
Take an example from Octane (in alpha stage), the process occurs as follows:
(i) First, user A will add to their transaction (txn) two instructions: one is to transfer the fee to the relayer, the other is to specify the amount to be transferred to user B (in this case, we need to assume that user A’s wallet has enough funds to pay relayer fees and transfer money to user B, but since there is no SOL available in the wallet, user A needs to go through relayer to send money to user B)
(ii) User A also needs to set the payer as the relayer, instead of him/herself
(iii) User A signs txn
(iv) User A sends this txn to relayer’s API server
(v) Relayer will confirm if it received the fee
(vi) If yes, relayer will sign and send the transaction back to user A
(vii) User A will add the relayer’s signature into the transaction and submit it to the Solana network
Pros and cons of meta-transactions
The main benefit of meta-transactions is the minimalization of user experience when beginning their crypto journey. Users do not need to own any tokens prior to interacting with dApp and web3. The use of meta-transactions may not require non-custodial wallet but developers would need a key storage system or password that removes technical obstacles of such decentralized wallet. Moreover, having a third-party for transaction settlement can help reduce some burdens on the blockchain network as mutiple transactions from a DApp can be processed off-chain and finalized to only one transaction to submit on-chain.
However, meta-transaction relayers still face two big drawbacks:
- Not all smart contracts support meta-transactions
- Although these protocols can use a network of relayers to decentralize the process of validating transactions, this cannot totally guarantee that the network will be secure and that there will be no corruption among relayer servers
Why relayer is important in crypto?
Besides GSN, some other DeFi protocols do apply meta-transactions to make their UX smoother. Zero Swap, a liquidity aggregator from AMMs on 0x, or Colony, an infrastructure project for DAOs have utilized meta-transactions. Gelato Network, a decentralized network of bots for automatic execution of smart contracts, has implemented meta-transaction in their infrastructure. Gelato connects developers who need to automate their smart contracts with the infrastructure operators who are responsible for running bots to receive corresponding service fees. To complete user request, Gelato needs to pay gas fee to interact with the blockchain, and meta-transaction relayer will be used here to fulfill such tasks.
However, building an in-house system of meta-transaction relayers for meta-transaction will consume a lot of resources in terms of time and effort for crypto projects. Therefore, there are meta-transactions solutions built to optimize this process, of which the most prominent names are GSN (mentioned above) and Biconomy.
Biconomy supports both DeFi and NFT meta-transactions. One of their three main products – Gasless Transactions – allow projects to sponsor their users for gas fees – either it is DeFi or NFT transaction. In August 2021, the fashion brand D&G and UNXD, an NFT platform for luxury products have collaborated with Biconomy to launch the Glass Box NFT project, including NFTs which give users access to their metaverse as well as real-life benefits from D&G.
In the beginning of this year, 100Thieves, a lifestyle brand, has also worked with Biconomy for a free NFT airdrop to their community.
Although relayers still have a few disadvantages that need to be overcome, its role in making the experience on DApps less “bumpy” is undeniably important, especially in the context of crypto projects that are having a hard time expanding their customer base due to high technical knowledge required by these users.
Building a relayer can be compared to building an automatic toll collection. Although it is expensive and labor-intensive at first, the benefits of traffic infrastructure and network connection will be smoother and more efficient in the future.