What is Ethereum Gas? (Examples + Easy Explanation)

whiteboard crypto logo
Published by:
Whiteboard Crypto
on

Imagine you’re at a coffee shop where the number of people in line decides how much extra you pay for your coffee. It’s like an auction: the more people, the higher the extra fee if you want your coffee quickly.

For instance, if there are just 4 people ahead of you, you might pay $8 for your coffee and an extra $2 to get it faster, totaling $10.

But, let’s say the coffee shop introduces a popular new flavor, and now there are 300 people in line. Because of this big crowd, the extra fee to get your coffee soon shoots up to $50. So, your $8 coffee now costs $58 if you don’t want to wait for hours.

This is like how some cryptocurrency transactions work. When the network is busy, you pay higher fees—called gas—to get your transaction processed faster. If it’s not so busy, the fee is lower. Just like in the coffee shop, the busier it is, the more you pay to skip the line.

Gas is the fee you pay for making transactions on a blockchain network, like Ethereum. It’s like a toll fee, covering the computational energy required to process and validate transactions on the network.

What is Ethereum?

Ethereum Gas

Ethereum is a revolutionary blockchain platform, well-known for its ability to run smart contracts. These are programs that automatically execute the terms of a contract when certain conditions are met. This is why Ethereum is called programmable money—you can use it to do things.

Unlike Bitcoin, which is mainly a digital currency, Ethereum is more like a supercomputer. It’s a shared, global system that powers applications beyond just payments.

Developers use Ethereum to create decentralized applications (dApps) across various industries, making it a key player in the cryptocurrency world. This platform uses its own cryptocurrency called ether (ETH) to facilitate transactions and incentivize network participants.

What is Ethereum Gas?

So you already know what gas is from reading above—it’s the cost of the transaction. Just like you need gas to make your car move, you need crypto gas to make your transaction move. Gas is the fuel that powers the code and computations that happen on the Ethereum network. 

For example, you could add 4 + 4 and it would tell you the answer is 8, but it would cost you 3 gas. If you wanted to check your friend’s Ethereum wallet balance to know how much money he has, you might need 400 gas.

And if you wanted the network to send some ether you have to your friend, you would have to pay 21,000 gas.

We have gas as a way to make sure the price of activity on the network doesn’t change even if the price of Ethereum skyrockets or plummets. It should always take 3 gas to add two numbers, whether the price of Ethereum is $200 or $20,000.

However, we have to convert the amount of gas to the cost of gas. 

To find out how much it will truly cost, we need to multiply gas cost by the gas price. The gas cost of actions doesn’t change, but the price of one gas does. There is where something weird called gwei comes in.

What is gwei? Gwei stands for “giga wei.” A wei is to ethereum like what one penny is to a dollar, or one satoshi to a bitcoin. So there are one quintillion weis in one ether. Because this is a ridiculously small amount, we instead use Gigawei, which is .000000001 ether. 

Example of a Simple Transaction

Gas

Let’s say you want to send some money to your friend. First, we will need to know two things. 

First thing: the price of a transaction is 21,000 gas. This number never changes.

Second thing: right now, ETH price is at $2000 USD. This number changes regularly. 

The price of gas can be whatever you want it to be, but the higher it is, the faster it will be confirmed. When you perform a transaction, you can set the price of gas—i.e., how much gas you are willing to pay for the transaction.

We will talk more about setting gas price in a bit, but right now let’s assume the average price of gas is 100 gwei. 

This means the cost of the transaction is 21,000 gas times 100 gwei. 

To reduce this, we do 21,000 times .000000100 because 100 gwei is equal to that in ether. 

This comes out to be .0021.

That means it costs us .0021 ether to send a transaction. 

If you want to figure out how much cash that is, you just take .0021 times $2000 and you get $4.2. 

This means it costs $4.2 to make that transaction. 

So to find out how much something costs, you take

[Price of action] * [Cost of gas] = amount of ether to perform

And to get how much it costs in dollars, you just take

[amount of ether] * [current price of ether]

I hope this explanation was helpful!

If you’re curious what the current prices of gas is, check out Etherscan’s live gas tracker.

Let’s go over one more example just so you get the hang of it. 

Example of a Transaction When Congested

Now, let’s assume the same situation as above, but for this example, the network is VERY busy and the cost of gas is high. Now the cost of one gas is 700 gwei. 

So to calculate how much it would cost to send your friend some money, we have to plug in those numbers into the equation. 

Remember the equation is:

[price of action in gas] * [cost of gas in gwei] * [ethereum price in dollars]

Price of a transaction is still 21,000 gas.

Cost of gas is now 700 gwei, which is .000000700 ether. 

And the price of ethereum is still 2000. 

21,000 * .0000007 * 2000 = $29.4

Since the network is congested and tons of people are wanting to do stuff on it, it will cost $29.4 to send money to your friend, and that is whether you send $5 or $5,000,000.

This is the beauty and downfall of this system. 

Speed of Transaction

Now, earlier I said that the gas price can be set differently. This is where we go back to the coffee analogy. There are people standing in line for coffee, and the people willing to pay the most get their coffee first.

Since Ethereum validators can only include a certain number of transactions per block, they pick the ones that pay the most, since they get the fees as a reward. 

So you could spend 100 gwei, or 10 gwei, or even 1000 gwei. If you spent 10 gwei, it might take a few hours to get confirmed, but if you spend 1000, it could be confirmed almost immediately.

Imagine you’re a validator and on average you’re getting $5 to confirm some transactions, and some guy gives you a $50 tip to hurry up and confirm his transaction… you’re gonna be doing his very fast.

However, if someone’s like “20 cents is all I got… do it when you can,” you’re only going to do it when the higher transactions are finished. 

You might be wondering why we need all of this, it’s quite confusing. Gwei and gas were implemented into the Ethereum network so people had to pay for code to be run.

Imagine if you could say “I want someone to do this action for free, forever.” Without a gas limit and gwei price, they could do that. 

EIP 1559

EIP 1559, which stands for Ethereum Improvement Proposal 1559, is a significant update to Ethereum’s transaction pricing mechanism. This proposal, implemented in August 2021, brought two major changes to the network:

  1. Base Fee and Burn Mechanism:
    • Before EIP 1559, users had to guess how much gas to pay for their transactions to be included in a block. With EIP 1559, the network now sets a “base fee” for transactions, which fluctuates depending on network congestion. This base fee is burned, meaning it’s permanently removed from circulation. This burning mechanism can potentially reduce the overall supply of Ether, impacting its economic model.
  2. Inclusion Fee or Tip:
    • Besides the base fee, users can add a tip or “priority fee” to incentivize validators to prioritize their transactions. This tip system helps ensure that transactions are processed quickly during times of high demand.

The key goals of EIP 1559 were to make transaction fees more predictable and to improve the overall economic system of Ethereum by creating a deflationary pressure on the Ether supply.

This change was also a step towards Ethereum’s transition from a Proof of Work (PoW) to a Proof of Stake (PoS) consensus mechanism.

Use Cases of Ethereum

Ethereum

So, I said earlier that Ethereum was programmable money. In fact, you can write entire programs and even whole functioning websites that work on the Ethereum blockchain.

These are called Decentralized Apps, or dApps. DApps function by running code that you paid for to do certain things, and on the Ethereum network, you can literally write programming code. 

So adding is really basic, but it’s the foundation of code. You can also subtract, multiply, divide, and from there you can do other logic things like “if/then” and “for loops”.

It gets really complicated really quick and with enough imagination and education, you could create a whole decentralized exchange like Uniswap where you can trade coins for other coins without there being a central authority like Coinbase.

In fact, we have a whole section about coding, so feel free to check that out.

Conclusion

Gas is kind of complicated, but luckily you don’t have to calculate it yourself. Most crypto wallets, exchanges, and websites have it all built in so you just have to say you’re willing to pay that amount or not, and if not, how much you are willing to pay.

But understanding gas is important because if you are trying to buy a super popular new NFT, you will probably have to pay a high gas fee. We’ve seen ether gas hit almost $200 per transaction! So, knowing that the gas price changes based on network activity can be really helpful.

Thanks for reading, we hope you learned something, and we really hope you enjoyed this article!

whiteboard crypto logo

WhiteboardCrypto is the #1 online resource for crypto education that explains topics of the cryptocurrency world using analogies, stories, and examples so that anyone can easily understand them. Growing to over 870,000 Youtube subscribers, the content has been shared around the world, played in public conferences and universities, and even in Congress.