DEV Community

Cover image for WHAT IS GAS IN THE ETHEREUM BLOCKCHAIN NETWORK?
steve kimoi
steve kimoi

Posted on

WHAT IS GAS IN THE ETHEREUM BLOCKCHAIN NETWORK?

GAS:
Gas in the blockchain ecosystem is normally compared to the gasoline that is required by a car to move.

Why do we give such a comparison, and what is gas anyway? Let's have a look:

Gas: this is the fee that is required to successfully run a transaction or execute a smart contract in the Ethereum blockchain network.

The main reason for introducing the concept of gas was:

  1. To pay the Ethereum miners for the energy they’ve used to conduct transactions. This is why it is described as the fuel that is needed to run the Ethereum network.
  2. To provide a layer of security by making it expensive for users to spam the network.

A lot of people hate gas fees because they can be very expensive. Why is this so?

  1. When there is a surge in activity of the network; a lot of people trying to conduct transactions at once, the gas fees usually skyrocket. This is because as more transactions occur, the blockchain needs more computational power, thus leading to the surge in gas prices.
  2. When you’re executing a transaction that requires more computational power. Simple transactions such as a peer-to-peer transaction of sending ether, doesn’t require a lot of computational power thus it will use little gas. But complex transactions such as interacting with smart contracts will require higher gas fees.

Now that we have an idea of what is gas, let's see at how gas fees are calculated:

How are gas fees calculated:
Gas fees are paid in Ethereum’s native currency, ether (ETH). The gas prices are usually denoted in gwei (a denomination of ETH i.e 1 gwei = 0.000000001 ETH (10^-9 ETH).

Gas fees are usually calculated using the formular:

Gas limit * Gas price per unit = Gas fees

Gas limit is the maximum amount of gas a user can use to in a transaction.

Gas price is the the amount of ETH paid to the miners for processing the transactions.

So, if the gas limit was 30,000 and price unit was 300 gwei, the result would be:

30,000 * 300 = 9,000,000 gwei or 0.004ETH

That sums it all. I hope you now have a good understanding of what gas is in the blockchain ecosystem and how it works.

Thank you for reading this far!

Top comments (2)

Collapse
 
sloan profile image
Sloan the DEV Moderator

Heyo!

This is an awesome post! 🔥

In fact, the topic of your post would also work really well in the Meta Punk Community too!

Metapunk Web3 Community 🦙

We’re a community where blockchain builders and makers, web3 devs, and metaverse creators can connect, learn and share 🦙

favicon metapunk.to

Meta Punk is a really cool international NFT and web3 community where artists, web3 developers, and traders can connect, learn, and share exciting discoveries and ideas. 🦙

Would you consider posting this article there too? Because Meta Punk is built on the same platform as DEV (Forem) you can fairly easily copy the Markdown and post your article there as well.

Really hope that you'll share your post with the community there and consider browsing the other Forem communities out there!

Collapse
 
stephenkimoi profile image
steve kimoi

Amazing! Thank you for the consideration.