How Ethereum Gas Fees Actually Work (Explained Simply)

How Ethereum Gas Fees Actually Work (Explained Simply)

Gas fees have made me super confused while i was starting my journey on WEB3 and Smart Contracts. Why does sending $10 on ETH sometimes cost $20 in fees?? (I know it’s rare to be doubled, but it’s possible)

I know they scare the shit out of you as a beginner in WEB3. (They did for me). So let’s break down:

  • what gas really is?
  • Why fees go up and down? (They need to grow up and be more stable for god’s sake)
  • And how you can save some money on gas?

What’s Gas In Ethereum?

Imagine you want to drive your car, from your home, to a nearby coffee place; You need for example 0.5 litres of fuel (I think it would be a 4 km drive).

That 0.5 litres of fuel is exactly the same as gas fees. The fuel your transaction needs to move, on Ethereum highway. Every action, smart contract, NFT mint means a certain driving distance.

For example if we say deploying a smart contract costs 0.02 ETH. (Long road leading to your parents house)

Minting NFT is the shorter and less complex path that is going to cost you 0.004 ETH. (Your short journey to the coffee place)

So it’s just like a car; more complex and longer path you take, more fuel (or gas fee) your car consumes. (or you pay, from your savings for a romantic trip to PARIS)

More complex equals more fuel.

Gas Units vs Gas Price

Gas units means how much fuel your transaction needs for a certain action (or your car needs for a certain destination).

For instance sending ETH needs approximately 21,000 units. Or minting an NFT may need around 100,000 gas units.

But gas price (Gwei) means how much you pay per each unit of gas — like fuel price per litre.

So total fee = Gas Units × Gas Price.

Sending ETH = 21,000 gas units.
Gas price = 50 Gwei.
Fee = 21,000 × 50 Gwei = 1,050,000 Gwei = 0.00105 ETH.
  

Why Do Fees Fluctuate?

Why? Well … When the network is busy you’ll have to pay more gas. (Just like Uber; When there’s a traffic jam, the cost of your travel turns out to be higher.)

When it’s quiet and you’re not sending a transaction during a rush hour, gas fees are cheaper.

So that’s why they go up and down. (Thank you Iliya)

Base Fee + Tip (EIP-1559)

After August 2021, Ethereum introduced EIP-1559. Based on that each transaction has also a Base Fee (burned), and a Priority Tip (that goes to miners and validators).

Base fee is like a toll fee that you have to pay; and priority tip is an extra cash you pay if you want to get faster services. (Get to the coffee place faster but with more cost)

How To Save On Gas

(Well, i can give you some tips on that)

  • Use Layer 2 protocols: Arbitrum, Optimism, zkSync, Polygon.
  • Schedule transactions during low traffic times.
  • Use gas trackers: Etherscan Gas Tracker, Blocknative.
  • Batch transactions when it’s possible.

Gas fees have some benefits too, like preventing spam, rewarding validators and keeping ETH secure.

So now you can say this big freak called Gas Fee wasn’t so much scary after all and it has some benefits for us too. (Good for us Iliya, we are also happy that we pay gas fees for every single transaction)

Back to all blogs