Understanding Ethereum Gas

WildMonkeyCrypto
3 min readAug 5, 2022

--

If you want to start learning about crypto, we need to introduce you to what “gas” is on the blockchain.

What is “gas” in crypto (AKA blockchain)?

Gas is an abstract unit that measures the computational power required to perform a specific operation in the Ethereum network: crypto swaps, exchange, trading, and transfers, among others. For instance, let’s say your car is the blockchain and your transaction is the act of driving from point A to point B. You need gas in your car to get there. It works the same way on the blockchain.

In other words, gas depends on the complexity of the operation.

For example, doing a transfer of Ethereum to another wallet on the chain would be “?” gas. While using a decentralized exchange to trade an ERC20 token for another ERC20 token would be “?” gas. The amount of gas needed depends on which operations, how many of them are happening within a transaction and how congested the Ethereum network is at the time of the transaction.

The cost of gas is always specific to a particular operation (size of the contract) and how much network activity is happening at the time of the transaction. So if ETH price goes up or down, it won’t have an impact on the amount of gas. It will stay the same in a bull¹ or bear² market but will have an effect on the actual cost of the transaction.

Now, let’s talk about the gas limit. This is the amount of gas you’re willing to spend to execute a specific operation.

So, if a transaction requires a minimum of 21,000 gas and I’m willing to spend 30,000 gas for that transaction, then 30,000 gas is my gas limit. If, in the end, the operation only necessitated 25,000 gas, the remaining 5,000 gas will be refunded back to me. On the flip side, if you were to use 20,000 gas, there is a chance the transaction will fail and you will lose the money that was used for gas for that transaction.

Then, there’s the price of gas, the amount of ETH you’re willing to pay per gas, depending on:

  1. The transaction speed you choose (fast, medium/standard, and slow).
  2. How busy the network is.

Fees are lower in networks with less congestion. The busier the network, the more people queuing in front of you, and the more money you need to spend to get served or verified quickly.

The price of gas is expressed in Gwei (Giga Wei), which is the unit in which ETH is represented.

Why is it Wei? The goal is to make it easier to comprehend instead of using 18 decimals when talking about the amount of ETH in a transaction.

See it this way. Is it easier to say “It costs me 10 Gwei” or “It costs me 0.00000001 ETH”?

1$ can be broken down into 100 cents

1 Bitcoin can be broken down into 100M Satoshis

1 ETH can be broken down into 1 Quintillion Wei.

1 ETH can also be broken down into 1 Billion Gwei.

So, for any kind of operations on the Ethereum network, we need to know:

  • The gas limit you’re willing to spend.
  • The price of gas (depending on the speed chosen and the network activity).
  • The current value of ETH

The formula for the operation total cost in FIAT money is:

Gas Cost x Gas Price x current value of ETH

So, let’s see the example below:

You can also use https://www.ethgasstation.info/ to help estimate the current gas price and choose a reasonable speed for your operation. The website continuously monitors the blockchain and calculates the speed, generally accepted by miners at the current time.

¹ Bull market: the value of a cryptocurrency goes up, rise market.

² Bear market: the value of a cryptocurrency goes down, decline market.

--

--