⛽What is Gas?

ELI5 Gas.

What is Gas and how is it calculated? Imagine you want to drive a car and it takes gas. Also, imagine every road you drive on comes with a cost like toll roads. The cost to drive on these roads is there to encourage those that own the roads to keep them open. How much you pay them to use their roads is determined in a way by how busy the road is and how fast you want go to get to your destination. How much your car weighs, like if you wanted to load it up with suitcases of gold bars, doesn't matter. Only how many cars are on the road will affect how much it costs to drive on the road. If the roads are not busy, you can speed down the road by paying more, and the cost can still be pretty low. If the roads are very busy and you who want to speed down the road still, you will now have to pay a very high fee. Someone who is not in a hurry may still be paying a much higher fee than the highest cost of going fast on a slow time of day.

The people who own the road wont let you even get on the road without first agreeing to pay to use the road and they also give priority to those that pay a higher rate to go faster. This higher rate tapers off and paying more than the current highest rate will not make you go faster. If you aren't in a hurry and would rather not pay the high fee but rather pay rates you are used to during slow times, you may end up waiting a long time for the traffic to die down and until then you can't immediately leave. There is also some times when you will not make it to your destination and have to start over. When this happens, to get your car off the road so you can try again, you first have to pay a small fee to cancel your original trip. Depending on what kind of trip you are taking you could be stuck there for a very long time until you just "fade away". In other situations, you will also lose the original fee you paid to get on the road. Keep in mind, you can only have one car on the road at a time even though you can have multiple cars ready to go as soon as the previous one is done. This includes the car you have that got stuck waiting.

To minimize how much you end up paying, take into account:

  • The amount of gas it takes to get to your destination.

  • The cost to get on the road to get to your destination.

  • Attempting to pay too little may mean you get stuck for a very long time and sometimes have to pay a smaller trip cancelation fee to get off the road AND in some cases the original fee you paid to get on the road if you decide to not wait.

  • Attempting to pay too much will not make you go faster than just paying the highest rate at the time you decided to get on the road.

Gas on Ethereum.

Each action (transaction) on the network, like moving tokens from one wallet to another, is like the car that needs to deliver something from point A to point B. Keep in mind if the car is heavier, say if you are sending 1 ETH or 10,000 ETH, that DOES NOT makes the price of gas go up. It depends on the type of action you need to make, and how much activity or traffic there is on the network. When you start an action, this action must finish before any other actions you have planned can take place. From the time a wallet is created and actions take place with that address, each action is numbered (called the nonce). Transactions are ordered by the nonce value.

How much ETH in gas you will pay (lets call it "Z") is determined by the kind of transaction you want to do (maximum gas, lets call it "X") and how busy the traffic is on the network (Gwei rate, lets call it "Y"). To find the ETH in gas, 1Gwei = .000000001ETH (or 1 ETH = 1,000,000,000 Gwei), so the total gas will always be Z x .000000001.

Taking one of the cheapest transactions, like 21,000 gas for a moving ETH around wallets, and a decently low Gwei rate of 40 (at time of writing), your gas cost would look like this:

(X)21,000 x (Y)40 = (Z)840,000 x .000000001 = .00084ETH OR about $1.11 (at time of writing ETH is $1,329.44).

To minimize how much you end up paying in gas:

  • Keep an eye on current Gwei prices. Finding a time when the network is slower will help you have lower transaction costs.

  • If you are comfortable it may be best to use a mid to high Gwei price to ensure your transaction goes through in a timely manner.

  • In general, transactions with very low Gwei prices can enter a pending state and stay there until it becomes the oldest in the "pending pool" and gets kicked out, or disappears. This is not advised as it can take a very long period to process.

  • When interacting with protocols, be aware of any that may have a time limit on "pending" transactions. This may lead to additional losses in ETH if your transaction is not picked up and processed.

  • Don't mess with the "gas limit" unless you absolutely know what you are doing because this can negatively affect your transaction.

Last updated