Gas

Gas refers to the fees charged to successfully conduct a transaction on the Ethereum network. It is denoted in tiny ether (ETH) units known as gwei. 

What is Gas (in Crypto)?

Gas refers to the fees charged to successfully conduct a transaction on the Ethereum network. It is denoted in tiny ether (ETH) units known as gwei.

The Long Definition

Gas is the cost required by Ethereum for specific operations on the blockchain, like transactions and smart contract executions. The fees collected go to validators as rewards for helping secure the network by verifying transactions and adding them to the blockchain.

Gas fees are paid in ether (ETH), the protocol’s native cryptocurrency. However, they are measured in small ETH denominations called gwei. The word ‘gwei’ is a combination of the words “giga” and “wei.” A wei is the smallest ETH denomination while giga is a unit of measurement equal to 10^9. So, 1 gwei is equal to 10^9 wei.

The size of the gas fee for a particular transaction is usually determined by the level of network congestion. But overall, the network is criticized for having relatively high transaction fees.

what is gas

Understanding Gas

Participants, known as validators, verify Ethereum transactions before adding them to the network. Doing so is work– validators use computers which consume energy which costs money. Therefore, they need to be compensated. This happens through gas fees charged on every transaction.

Also, at the heart of the Ethereum blockchain lies the Ethereum Virtual Machine (EVM). This is a worldwide virtual computer maintained by all the full nodes on the network. It provides the environment for smart contracts to run. And this comes at a cost– a computational cost. This cost is charged as Gas fees.

So, you can say that transactions on Ethereum require a certain amount of computational effort, done by either validators or the EVM. Users pay for this effort in Gas fees.

Gas fees are paid in ETH but denoted in gwei. A gwei is a tiny denomination of ETH – one gwei is 10-9 ETH (0.000000001 ETH). So, if your gas fee is 25,000 gwei, you’ll be charged 0.00025 ETH for the operation.

How do Gas Fees Work?

Gas fees charged on transactions depend on the level of network congestion. During peak periods, there are many transaction requests. This leads to a high demand for validation requests, leading to high fees. On the other hand, off-peak periods have a lower demand leading to lower gas fees.

These fees aren’t generated randomly; they follow a specific formula:

Total gas fee = Gas units (limit) * (base fee + priority fee).

Let’s break it down.

how gas works

Gas Units (Limit)

The gas limit is the maximum amount of gas you’re willing to pay for the transaction. This amount is left for you, the user, to set. You can adjust it based on how much work you think it will take a validator to complete your transaction.

Different operations require different amounts of work. The Ethereum developer community estimates that for a standard ETH transaction, a gas limit of 21,000 units will do. A more complex operation, like a smart contract execution, requires a higher gas limit.

Usually, overestimating the gas limit has no consequences. If you put 40,000 gas units for a transaction that consumes 25,000 units, you’ll get back the remaining 15,000 units.

However, underestimating is a different story altogether. Let’s say you put a gas limit of 20,000 for a transaction that requires 25,000. The EVM will try to fulfill the transfer, and in the process, consume your 20,000. However, it will be unable to complete the transaction because the units provided were not enough.

So, the protocol will revert any changes made toward this action. However, since the validator has already done 20,000 gas units worth of work, you will not be refunded.

low on gas

Base Fee

The base fee is the minimum amount of gas required to write a transaction to the blockchain. It is set by the network. This is done based on the demand. Therefore, it is adjusted from block to block depending on the number of users interacting with the network at that particular time. The more users there are, the higher the base fee.

Ethereum also typically burns all the base fees of a particular block after it’s fully added to the blockchain. Burning is the act of removing crypto coins from circulation. It involves sending them to an irretrievable wallet address. Doing so helps reduce inflation.

Priority Fee

Since the base fee is burned, something has to go to validators. This is where the priority fee comes in. It serves to incentivize the validator to verify your transaction first. Think of it as a ‘tip.’

You’re the one who decides the size of this tip. Generally, validators prioritize transactions with the highest tips attached. This doesn’t matter in off-peak periods. Any reasonably sized tip will see your transfer completed in good time.

But in peak periods, it’s a race to the top. Due to the high demand for validation, users are essentially trying to outbid each other. So, each tries to include a higher priority fee than other users to have their transactions completed first. Those with small tips may have to wait for hours for their requests to be validated.

priority fee

Gas Fee Example

Assume you’re sending 1 ETH to a friend, Jane. The transaction requires a gas limit of 25,000 units, the base fee is set at 15 gwei, and you include a tip of 5 gwei. So, the total gas fee will be;

Gas units (limit) * (base fee + priority fee), which is 25,000 * (15 + 5)= 500,000 gwei or 0.000620 ETH.

Why Are Gas Fees Important?

Gas fees serve two crucial functions. One, they provide an economic incentive to validators. Part of the fees you pay goes to validators as a reward for verifying your transaction.

And two, they protect the network from bad actors. How? The EVM charges gas fees for every computation work done on the network. Generally, running a malicious program at the level needed to affect Ethereum operations requires some complex code.

More complexity equals more work. Therefore, the cost of executing such a program will be very high. This discourages bad actors from trying to break the network.


Want to join the Dypto journey? Follow our socials!