Connect with us

Education

Gas-Less Transactions: A Guide to Understanding Meta-transactions (ERC-2771)

Published

on

Gas-Less Transactions: A Guide to Understanding Meta-transactions (ERC-2771)

Every day, we hear or read about how the cryptocurrency space has the potential to revolutionise the financial landscape. Yes, this might be true, but it is yet to happen. The entire space has been on the brink of mass adoption for some time now. 

While almost no one seems to acknowledge it, there is this silent-giant-major roadblock that stands in the path of mass adoption – the concept of gas fees. Gas fees are transaction costs incurred when using blockchain networks, and they have been a source of frustration for users and a hindrance to widespread adoption.

Normally, the argument is that Gas fees serve as a way to compensate network validators (miners or stakers) for processing and securing transactions. They prevent spam and abuse of the network’s resources. 

Gas fees are determined by two main factors: the gas price and the gas limit.

  • Gas Price: This is the price (in cryptocurrency) that a user is willing to pay for each unit of gas. It represents how much the user values their transaction and how quickly they want it to be processed. A higher gas price means a faster transaction but at a higher transaction cost. 
  • Gas Limit: This is the maximum amount of gas a user is willing to spend on a transaction. It sets an upper limit on the computational resources that the transaction can consume. If a transaction requires more gas than the specified limit, it will fail, and the user will still be charged for the gas used up to that point.

To calculate the total transaction fee for a blockchain operation, you multiply the gas price by the gas used. So, Total Fee = Gas Price × Gas Used.

Now, Gas prices are not fixed and can vary widely based on network congestion. When the network is busy with many transactions, gas prices tend to rise because users compete to have their transactions processed faster. Conversely, during periods of low activity, gas prices may decrease.

For the average Joe, navigating the complexities of gas fees can be bewildering and discouraging. Imagine Joe receiving a payment in USDC (a stablecoin) but is unable to send a portion of it to pay a vendor because his wallet balance in Ether (ETH) is zero. 

This dilemma highlights the need for innovative solutions to make crypto transactions more accessible.

Joe’s predicament is a common one among crypto users. 

As I said earlier, the Ethereum network, on which many cryptocurrencies and tokens operate, requires a small amount of ETH as a transaction fee, commonly known as “gas.” This fee ensures that the network remains secure and processes transactions efficiently. However, for users like Joe, the requirement to hold ETH in their wallets poses a significant obstacle. They are often left with limited options.

Joe can’t exchange his USDC for ETH on decentralized exchanges (DEX) because interacting with DEX requires some ETH in the wallet to pay gas fees. Traditional centralized exchanges are also not an option for Joe due to banking restrictions on crypto-related transactions e.t.c

The only recourse for users like Joe is to borrow some ETH from a friend to pay the gas fee for DEX interaction, and then repay the borrowed ETH.

This cumbersome process can drive users away from blockchain-based payments, back to traditional fiat-only methods. But what if there is a solution that can help users like Joe overcome this challenge?

The Power of Meta-Transactions

Meta-transactions are a not-widely spread solution to the gas fee problem. 

Unlike the normal modes of transactions that we know, meta-transactions are gas-less, making them more user-friendly. Even a wallet with zero balance can sign messages, which serve as proof of ownership and can be used to interact with smart contracts.

The basic concept behind a Meta Transaction is that:

  • A relayer, or third party, sends the transaction on the user’s behalf and covers the gas costs.
  • Users sign messages that provide details about the transaction to be carried out and are preferably EIP-712 compliant.
  • The Relayer then receives the signed message and is then in charge of validating whether or not the Relayer will be paid (this could be optional), having enough money to cover gas costs, and signing a native transaction before submitting it for execution.

Taking advantage of this concept, USDC token contracts support a function called “permit” that accepts an EIP-712 signature. This enables token holders to sign spending approvals off-chain, allowing someone else to execute the permit on-chain and cover the associated gas fees. 

Let’s delve into the workflow of this solution.

The Workflow

Let’s consider a scenario where our Joe is a Customer, and someone willing to sell ETH to him is the Gas Provider. The Gas Provider should have an incentive, usually a reward, for facilitating the trade right?

To make an order, the Customer prepares a signed EIP-712 message for spending approval and specifies the reward they are willing to pay. Importantly, the spending approval is not granted to the Gas Provider but to a trusted gateway, known as the Gas Broker, a smart contract that is open-source and immutable.

The Gas Broker acts as an arbiter in trades. 

It ensures the trade’s fairness by considering the ETH price provided by a Price Oracle and the reward offered by the Customer. Tokens and ETH are initially deposited with the Gas Broker. The Gas Broker checks the rates and validates the reward’s value from the signed message. This mechanism prevents Gas Providers from manipulating rewards.

The two signed messages, alongside the token amount, the Customer’s wallet address, and a deadline, are published in an Order-book. The Gas Providers can then browse the Order-book, select profitable orders, and send transactions to the Gas Broker with the corresponding amount of ETH. Competition among Gas Providers ensures optimal fees are chosen.

The Gas Broker verifies ETH prices, signature validity, and the amount of ETH provided by the Gas Provider. If all checks pass, it calls the permit function on the USDC token contract, transfers USDC to the Gas Provider, and sends ETH to the Customer. Once the transaction is mined, the Customer receives ETH, and the Gas Provider gets tokens.

Finally, the call must be able to determine the original user (msg.sender) and calldata (msg.data), which are nested inside the Relayer’s transaction, when it reaches the intended destination contract. 

Mind you, (msg.sender) is the address of the account that is currently executing the transaction while the (msg.data) is the data that is associated with the transaction.

An Ethereum Account called a Relayer is where the money is kept that will be used to pay the user’s gas fees. On the server of the supplier, the private key of the Account is kept in a safe. The developer can then transfer money to the Relayer, who will pay the transaction costs for their users. Developers are free to create as many Relayers as they like, but each one requires ETH funding independently.

Keep in mind, that the user-defined transaction now lives inside the data field of the Relayer’s native transaction. Hence, a Meta Transaction is this transaction inside of another transaction!

Closing 

Meta-transactions, along with the Gas Broker concept, offer a promising solution to the gas fee challenge in cryptocurrency transactions. 

The development plan for this solution includes the creation of the Gas Broker smart contract, a backend API for receiving orders from Customers, user interfaces for making orders and browsing the Order-book, and a bot for Gas Providers to automate order execution.

By removing the need for users to hold ETH in their wallets and enabling secure, fair, and efficient exchanges, this innovation paves the way for broader crypto adoption. It not only benefits users like Joe but also creates opportunities for ETH holders to earn rewards while helping newcomers enter the world of crypto with ease.

Maybe in the future, a web-based platform will enable anyone to request ETH by submitting orders with no gas fees. They will only need to sign two messages and choose from published orders or connect a bot using an API. This user-friendly approach will boost adoption because it allows the average user like Joe to exchange USDC for ETH quickly, securely, and without relying on friends.

0 0 votes
Article Rating
Continue Reading
Advertisement Earnathon.com
Click to comment
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Crypto News Update

Latest Episode on Inside Blockchain

Crypto Street

Advertisement



Trending

ALL Sections

Recent Posts

0
Would love your thoughts, please comment.x
()
x