Ethereum Gas explained

So you received your airdrop tokens in your Ethereum wallet, but now you need Gas to transfer them. But what is Gas?

The funny thing is when you start reading articles or watching YouTube videos on what Ethereum Gas is, you slowly come to a conclusion that everybody understands the concept as different as chalk and cheese.

Let’s try to accumulate all the useful info out there and take an honest look at the concept of Gas, Ether, Gwei and finally establish the difference between these cryptic words.

GAS is a preventing mechanism

stop

Unsplash.com

  • The most important thing you need to know about Gas is that on the very basic level it is a preventing mechanism.

As a concept Gas was created to prevent attackers from creating programs that would run on everyone’s computers forever.

In what way does it keep the network safe?

Ethereum charges a fee for every computational step that the network takes. The fee “program” covers all the operations no matter what you do — poke smart contracts or carry out transactions.

At the end of the day, all you do is change the state of Ethereum, which costs money, aka Gas. How much Gas?

Look at a couple of examples. To create a contract via a transaction, you will need to pay 53000 Gas. To carry out the transaction – 500 Gas.

So, if attackers want their programs to run on everyone’s computers forever, they will have to pay for every computational step those programs take… which doesn’t make sense, really.

GAS stabilizes the network

stability

  • People often mistake Ether for Gas and vice versa. But Gas and Ether were decoupled on purpose.

After reading the first part about fees in Gas for every computational step, you might be wondering, how can those fees be in Gas if you don’t even see them in Gas?

The only fee you pay is in Ether or in USD, right?

MetamaskTransFee

Metamask. Transaction fees in ETH and in USD

The answer is, you don’t see those fees in Gas because they get exchanged from Gas to Ether for your convenience.

I know what you’re thinking. For my convenience, wouldn’t it be easier if they had set all these fees in Ether from the very beginning?

But they separated Gas and Ether on purpose.

It was important to decouple the price of the operation and the price of the ETH token because the price of ETH is always fluctuating.

EthFluctuation

Coinmarketcap.com, March 11, 2019

However, the cost of an operation in Gas is constant.

gasPrices

Ethdocs.org

Let’s say, the concept of Gas didn’t exist.

In this scenario, to carry out the transaction would cost you 1 ETH. But today 1 ETH equals 100$, tomorrow – $200 and the day after tomorrow – $30.

The fluctuation would simply destabilize the whole network.

That being said, the second reason for Gas to exist is to secure the stability of the whole network.

This is the quote from the official documentation:

The Gas Price is a floating value such that if the cost of tokens or currency fluctuates, the Gas Price changes to keep the same real value. The Gas Price is set by the equilibrium price of how much users are willing to spend, and how much processing nodes are willing to accept.

gasPrice

https://etherscan.io/chart/gasprice

Now when you know that Gas not only helps prevent attacks but also keeps the network stable, let’s discuss how you can use it. Or can you?

GAS price (in Gwei) and GAS limit

price&limit

Unsplash.com

First of all, let’s try and answer this question. Why is it important to understand what Gas limit means as well as Gas price?

As Ethgasstation.info explains, sometimes it makes sense to pay more if you want the transaction mined/carried out quickly.

If you don’t care how quickly it is mined, you may offer a cheap gas price.

GAS price (in Gwei)

ethStationGasPriceRecom

Ethgasstation.info, March 12, 2019

Based on desired transaction speed and cost, Ethgasstation presents users with this chart on the right.

Safe low is a gas price that is intended to be both cheap and successful.

Standard is the price accepted by top miners who account for at least 50% of the blocks mined.

Fast is the lowest gas price that is accepted by all top miners

You’re probably wondering, why is this mysterious Gas price in Gwei?

Gwei is a name for a little fraction of Ether. 1 Ether = 1,000,000,000 Gwei (109)

Gwei.io explains the concept like this.  Gwei is most commonly used when talking about Gas (network transaction fees). Rather than saying your Gas cost is 0.000000001 Ether you can say 1 Gwei.

Why Gwei, then?

Denomination nicknames in Ethereum are based off influential figures from the world of cryptography. The smallest fraction of Ether is Wei, which is called so to honour Wei Dai.

This cryptographer has formulated the concepts of all modern cryptocurrencies.

Gwei (or shannon) was named after Claude Shannon, the Father of Information Theory, codebreaker and crypto-analysis guru.

There are names for other denominations of Ether as well, such as Kwei (babbage), Mwei (lovelace), Twei (szabo) etc.

Why do you need to keep in mind at least what Gwei is? This unit can help you understand your transaction fee.

If one transaction costs 21000 Gas and Gas price is 1 Gwei, what will be your fee for the transaction?

To find the answer, let’s do the following:

  • Let’s multiply 1 Gwei by 21000 Gas, which will make 21000 Gwei.
  • Now, we divide 21000 Gwei by 1,000, 000, 000 Gwei. Why? Remember? 1 Ether = 1,000,000,000 Gwei.

This is how the fee will make 0.000021 in Ether. Still not sure? You can always calculate the fee for your transaction using the fee calculator!

To conclude, a certain amount of Gwei is a price you pay per unit of Gas, and you can decide for yourself how much you want to pay for Gas.

But can you decide how much Gas your transaction should take?

GAS limit

Take a look at the quote from the Ethereum official documentation:

Gas Limit is the maximum amount of Gas that can be used per block, it is considered the maximum computational load, transaction volume, or block size of a block, and miners can slowly change this value over time.

Speaking plain English, every block on the Ethereum network has got a certain Gas limit.

Note that miners decide on their own in which way they want to allocate their blocks’ resources.

For example, they can decide if they want to spend their Gas limits to write down your transaction. Hmmm, the Gas price you set could play a certain role here!

While competing for your transaction to be written in the block as soon as possible, try to achieve two goals.

Set the gas limit as high as your transaction will consume, but no higher. Normally, 21000.

Plus, try to increase the Gas Price.  When I did it in my Metamask, it resulted in a 34-sec time transaction. Bingo!

MetamaskGasLimit

Metamask

On the other hand, if you have 5 mins and 38 seconds 🙂 and the network is not too overloaded, why setting a very high Gas price?

metamaskLowGasPrice

Metamask

No worries. If it doesn’t work, you’ll get your ETH back. But if you’re not ready to get nervous while waiting for the conformation, slightly increase the Gas price.

So, let’s recap.

Gas cost for certain steps is something that was preinstalled, and you cannot change how much Gas the network will take for each operational step.

But the Gas limit you can set manually, which will result in a lesser fee for your transaction!

Phew! Now that you know what Gas is, let’s take a fresh look at Ether.

What is Ether (ETH)?

Ether (ETH) is the name of the currency used within Ethereum and the second most popular crypto after Bitcoin, as  of writing.

etherMetricsMarch19

Coinmarketcap.com, March 11, 2019

Note that the currency is not called Ethereum as many mistakenly think, nor is Ethereum a unit.

In order to obtain Ether, you need to either become an Ethereum miner or trade other currencies for Ether using centralised or trustless services.

If you have Ether, you can buy a super cute kitty from the CryptoKitties dApp or use other dApps, such as Ethlance or Golem.

To sum up…

Hopefully, now you know better what’s the difference between Ether and Gas.

Talking about Ether, it’s a top-10 crypto that you can take advantage of while using dApps on Ethereum.

Gas prevents attackers from running malicious software eternally and keeps the execution of all operations on the network stable.

Such parameter as Gas price gives the users a choice. You might want to choose how soon your transaction should be executed. Just set up a higher Gas price.

As for Gas limit, it also indicates how much you are willing to pay for the operation. Just in a little bit different way. It’s an amount of hash power the network will use to execute your request. Just multiply Gas limit by Gas price to see the max fee you’re about to pay!

And if you have any questions left, don’t hesitate to leave a comment down below!

***

Did you enjoy the article? Please click the ? button and keep on reading!

What is Ethereum? ← P R E V I O U S

N E X T → How to buy Ethereum for the first time ever

36
Subscribe now
Categories

×