What is gas? Why do transactions take so long?

What is gas? Why do transactions take so long?

By Mattison Asher

TL;DR: Just like you pay a wire or ACH fee when transferring money out of your bank account, there is a fee (called gas fee) to send transactions on Ethereum. It is like paying a toll to use Ethereum.

What is gas?

While you may think of filling up your car, or even what you ate earlier in the day, when you hear the term gas, the term has a special context in the world of crypto. Gas in crypto refers to the unit that measures the amount of computational effort required to execute specific operations on Ethereum. You must pay a gas fee in order to execute a transaction on Ethereum. Whether you are on MetaMask mobile or the desktop extension, you will always need to pay for gas when executing transactions.

Need to send your mom some ETH? That transaction requires gas. Want to lend out your money via Compound? That transaction requires gas too. What about buying an NFT? You guessed it–gas. Gas is like a toll. If you want to use the highway, you have to pay the toll so the government has money to maintain the highway. The more duress a vehicle puts the road under, the higher the toll the driver must pay. Tolls are a lot higher for 18 wheelers than motorcycle drivers.

Similarly, the more complex the transaction on Ethereum, the higher the gas fee, since the transaction will require more computational effort.

What is a gas limit?

Gas fees are denoted in Gwei, which is just .000000001 ETH. You can think of Gwei like cents, since 1 cent is .01 of a dollar. For every transaction you want to make, you must set what fee you are willing to pay for your transaction to be executed. The maximum amount of gas units you are willing to pay for in a particular transaction is called the gas limit. In addition to there being a gas limit that needs to be specified for a transaction to execute, there is also a gas price that must be input as well. The gas limit x gas price = gas fee, which is what you have to pay for the transaction to be executed.

Lucky for you, MetaMask calculates the approximate gas fee you should set for you based on how fast you want your transaction to be confirmed.

Where your gas fees go

You might be wondering “why will my transaction be confirmed if I set a higher gas fee?” An excellent question!

When you submit a transaction on Ethereum, you are competing with a bunch of other people who also want to submit a transaction at the same time. While you might be sending your mom some Ether, someone in India might be trading on Uniswap, while someone in Nepal might be buying the latest NFT minted on OpenSea. Each person is trying to have their transaction executed at the same time. But, only so many transactions can be included in an Ethereum block, and there are only new blocks every roughly 13 seconds. In fact, only 12.5 million units of gas can be included in each block. This means everyone is competing against one another to have their transaction included in the next block. When demand is high, and supply is constrained since only so many transactions can be included in a block, price must increase.

But where do these transactions go when they are submitted but prior to them actually being executed? These transactions go to the mempool, short for “memory pool.” The mempool is where all the transactions that have been submitted but not yet verified live.In short, the mempool is the waiting queue for validation. Miners, who validate transactions before they are executed to make sure they aren’t malicious, pick the transactions that should be included in the next block from the mempool.

“So why would miners pick my transaction from the mempool where I am sending my mom some ETH to be included in the next block?” Because I am willing to pay them more of course!

Miners select what transactions should be included in the next block based on how high the gas fee users set prior to submitting the transaction. The higher the gas fee, the higher chance a miner will be willing to include your transaction in the next block. This situation is where the competition comes in, since you are competing with everyone else setting gas fees during that time frame to be included in the next block.

Why do transactions take so long

Since you are competing against other users submitting transactions, if your gas fee is too low, miners won’t be incentivized to include your transaction in a block in the near future. Thus, your transaction takes so long because the gas fee was not set high enough for it to be included in a near-future block. You will have to wait for the gas fees that other users are willing to pay to go down for your gas fee to be attractive to miners.

Series Disclaimer:
This series article is intended for general guidance and information purposes only for beginners participating in cryptocurrencies and DeFi. The contents of this article are not to be construed as legal, business, investment, or tax advice. You should consult with your advisors for all legal, business, investment, and tax implications and advice. ConsenSys is not responsible for any lost funds. Please use your best judgment and practice due diligence before interacting with smart contracts.

Excellent information regarding gas fee.
Thanks for this article.

1 Like

Thank you this is very helpful.

1 Like