If we want Ethereum to reach to the masses then we should make the user experience in our dapp as easy and smooth as possible because we know that every interaction with a dapp is a blockchain transaction and blockchain transactions require a significant amount of knowledge .Users need to be proficient in estimating gas fees and should be able to understand the nitty gritties of blockchain transactions and this in turn makes the user experience in our dapp complicated and cumbersome and that's where the concept of gasless transactions comes into the picture.
To understand why gasless transactions are important, we have to start with a brief rundown of the purpose of gas in Ethereum. Gas on Ethereum is a way of paying for computations on the network that takes place while executing code on the blockchain. Every transaction made on Ethereum requires gas. That includes sending tokens (such as ERC-20) or interacting with a smart contract (like signing up for a subscription). For example, let's say you want to send some ERC-20 tokens from your wallet address to another wallet address. Those tokens live on top of Ethereum and still require computing power to move them around between addresses. Whether it's Bitcoin, Litecoin, or any other cryptocurrency, all transactions require computing power to be executed and stored permanently in their respective blockchains
When Alice sends Bob ERC-20 tokens from her address to his address, she has to pay for the computation that executes that transfer transaction by adding some ETH as "gas" in her transaction data. The more computation required by a transaction like this (e.g., the more data being sent), the more gas Alice must use in her transaction data when attempting it—the same goes for Bob when he eventually spends those ERC-20 tokens (by spending them at his favorite store that accepts crypto)..
The sender of the transaction must pay for this fee in ETH and will be charged even if the transaction is stuck or fails due to an error in code or insufficient funds.
If you've ever tried Ethereum development, you probably know how easy it is to make a mistake and break your whole application. Users are not immune to these kinds of mistakes either, since they may send transactions that contain errors in code or don't have enough funds to complete them successfully. These transactions won't get executed on chain because there's no way for them to pay gas costs.
This means that users who want to use dapps as intended need at least some ETH balance on their wallet just so they can try out different scenarios without wasting time waiting for transactions without sufficient funds or incorrect parameters being mined into blocks first before seeing what works best for them .
And also, Gas is paid in ether (ETH), and so as the price of ETH rises, so will the cost of running your smart contracts. That's why every time there's news about ETH hitting an all-time high (ATH), it's going to affect developers who create decentralized apps (dApps) on Ethereum by making them and their users pay more in fees and the other reason for high gas fees is also that the Ethereum blockchain has become extremely congested. The activity is much higher than the chain can efficiently process and as a result, we observed absurdly high gas fees and this hike in gas fees creates an aversion for the user to use our dapp, and thats where we should take the help of gasless transactions .
Imagine you are Bob, and you are using Alice’s dApp to buy a t-shirt online. Since your dApp is only a payment interface and doesn’t store any ERC20 tokens, each time you buy a t-shirt, it will prompt you to send some ETH with the transaction. Now imagine if Bob just wanted to try out Alice’s dApp and transfer a small amount of tokens from her dApp contract as a game reward! He would not want to go through all the trouble of buying ETH just to use 1 dApp.
And buying ether is not an easy task, dApp users often need to go through Know Your Customer and Anti Money-Laundering processes (KYC & AML), which not only takes time but often involves sending a selfie holding their passport over the Internet (!). On top of that, they also need to provide financial information to be able to purchase Ether through an exchange. Only the most hardcore users will put up with this hassle.
If Alice wants to create a great user experience for her users (as she should), the first step is making sure her product’s value proposition aligns with their needs. In Alice’s case this means making it easy for users like Bob to interact with her dApps so that they can get the most possible value from them.and for making her dapp's adoption easy for the users like bob she should take the help of gasless transactions.
Now,we have understood that gasless transactions are a real deal and studying them is important
Now lets deep dive in the technical aspects of a gasless transaction
In the ethereum ecosystem ,gasless transactions are called as Meta Transactions
A meta-transaction is a regular Ethereum transaction which contains another transaction, the actual transaction. The actual transaction is signed by a user and then sent to an operator or something similar; no gas and blockchain interaction required. The operator takes this signed transaction and submits it to the blockchain paying for the fees himself. The operator who submits the transaction on behalf of the user is called a relayer.
The Steps that are followed for a meta transaction are:
1. The user signs the transactions and the then sends it to a relayer.
2. The relayer gets the signed transaction ,the signed transaction contains all the important data that the relayer need to send the transaction to the blockchain.
3. The relayer now sends the transaction to the blockchain paying the gas fees himself because he knows how to estimate it and is aware of the technical aspects of sending a blockchain transaction.
That's all for now , we will understand more about the meta transactions in the next part of this article