TL;DR - Watch the video at the end of this article!
So you started hearing about NFTs, CryptoArt, DeFi and all the insane money people were making with them and, in that moment of FOMO, you decided you HAD to get into it. You did some research, started using these platforms or protocols and very soon realized that for everything you wanna do, you have to pay these so-called “gas fees”...and sometimes they can get pretty CRAZY...but what are they, really? Why do we have to pay them? Why do they keep changing so much? Why does it take so long sometimes for my transactions to go through?
Well...today, we are gonna find out the answers to all these questions, and figure out how to avoid making transactions when the network is very busy, and gas fees are too high.
What is gas on Ethereum
First of all, it’s very important to know that gas fees are particular to the Ethereum network. Before we talk about how they work, let’s understand what gas is on Ethereum.
In the same way a car needs fuel in order to run, Ethereum needs a certain amount of computational effort (or what we call gas) in order to execute operations.
Ethereum is a proof-of-work blockchain, where computer power all over the network is used to solve a complex cryptographic puzzle. Whoever solves this puzzle first, gets to create a new block and include transactions in it. In order to put transactions in the block, a certain amount of computational power is used to validate smart contracts. The people running these computers are known as miners.
Ethereum will soon change to proof-of-stake, but we’ll get back to that later on, when we talk about the future of gas fees.
Gas on Ethereum is measured in units and “gas limit” refers to the maximum amount of gas units you need in order to perform an operation.
What are gas fees and why do they exist?
Gas fees are the amount of money you have to pay for the quantity of computational power that will be used to execute your transaction. They play a very important role in keeping the Ethereum network secure and preventing bad actors from spamming the network.
Some transactions demand more computational work than others. This is why you pay much more gas fees when you mint an NFT, than when you transfer ETH from one address to another. Just so you have an idea, a standard ETH transfer requires a gas limit of 21,000 units of gas, while minting an NFT can require 100s of thousands of gas units.
How to calculate your gas fee
But how do we get from gas units to the actual gas fee?
To get there, we need one more element, which is the gas price. Gas prices are denoted in gwei, which corresponds to 0.000000001 ETH. So instead of saying that the gas costs 0.000000001 ether, you can say the gas costs 1 gwei. To know how much you’d actually pay for a transaction, you have to first know how many gas units are needed to execute the transaction and the gas price at that moment.
Let's say I have to transfer 1 ETH to a friend of mine. This transaction requires a gas limit of 21,000 units and the gas price, at the moment, is, let’s say, 50 gwei.
The total fee will be: 21000 * 50 = 1,050,000 gwei or 0.00105 ETH
To know the price in USD, just multiply 0.00105 ETH by the USD price of ETH at that moment.
There are some websites like Gasnow.org where you could check the gas price at the time and also see the historic data of prices within the week.
Why gas fees can get so high
Up until last week, Ethereum used a “first price auction” system to price gas, so users would basically bid to get their transactions included in the block. The highest bids would be given priority.
Fees were highly volatile and transaction fees soared quickly when the network was busy, as people were competing to get their transactions inserted in the new block. If you happened to include a gas price that was lower than what people were bidding at that moment, your transaction wouldn’t go through, or it would take minutes, or even hours to be included, depending on how congested the network was.
This past week the Ethereum network implemented an update called London, which included a proposal called EIP-1559 that changed this auction dynamic.
Now, every block has a base fee, the minimum per gas price for inclusion in this block. This fee is algorithmically determined by the network depending on how busy it is, which replaces the bidding system we had before. The user is also able to pay the miner a "tip" to have their transaction processed sooner.
Metamask, for example, used an algorithm that calculated the best gas price at the moment that would ensure the insertion of your transaction in the block, automatically; but it was never very accurate. The bidding system made it very hard to make accurate predictions. With the update, this calculation became more predictable, therefore making the whole network easier to use.
The update doesn’t prevent gas prices from getting high, but it does make it more predictable and avoids those sudden jumps we were used to seeing. The network's base fee is always clear to users as they go into transactions, and if the base fee is too high, users can wait until it's lower.
The future of gas fees on Ethereum
As I said before, Ethereum will change to a proof-of-stake model as part of a project known as ETH 2.0. In this model, in order to be a block validator, you gotta have a certain amount of ETH locked, or staked, in the network.
This projects will allow scaling solutions to increase the amount of transactions per second, which will lead to a reduction in gas fees. Unfortunately, this upgrade may not be completed soon. ETH2.0 is expected to start going live some time in 2022, but there’s no concrete date yet.
Until then, we’ll have to occasionally deal with these high gas prices, but now that you know how they work, you can start avoiding making transactions when the network is very busy, and gas fees are too high.
Comments