Buy Crypto
Web3 new
Academy > Crypto Insights > What is Ethereum Gas and How Does It Work? >

What is Ethereum Gas and How Does It Work?

2021-02-05 08:35:29

Anyone familiar with Ethereum will know that high transaction fees are an ongoing problem and have been since the network first started experiencing congestion back in 2017 and 2018. However, the explosion of DeFi applications means that all but the highest of rollers risk being priced out of the market in some cases. After all, fees eat into profits. During the first week of January 2021, transaction fees hit a new average high of nearly $18.

Ethereum gas is one part of the equation behind these fluctuating fees. Gas refers to the amount of computing power that an Ethereum miner needs to expend to confirm a transaction. The miner is expending their computational energy in return for mining rewards, which comprise a share of transaction fees paid in ETH. Therefore, Ethereum gas has a value in ETH. The cost of the gas is usually called the gas fee or gas cost.

Although Ethereum gas fees are effectively denominated in ETH, the amounts can be tiny relative to the value of one ETH. Therefore, gas costs are usually listed in gwei, which is one-billionth of an ETH, or 0.000000001 ETH.

ethereum gas

How Does Ethereum Gas fee Work?

Ethereum runs based on smart contracts, which are processed by the Ethereum Virtual Machine. A virtual machine requires a dedicated programming language, which is the Solidity language in the case of the EVM.

Each line of Solidity code uses a certain amount of gas to execute. An ERC-20 token is one of the most simple forms of a smart contract running on Ethereum, involving only nine rules, meaning it doesn’t take many lines of Solidity to write an ERC-20 token contract.

However, more elaborate smart contracts, such as the MakerDAO Collateralized Debt Position contract, which issues the DAI stablecoin, involve more Solidity code lines. This explains why complex smart contracts cost more to execute than a simple ERC-20 token transfer.

The term “gas” is apt because it lends itself well to the vehicle analogy. If gas is the same as the gas you use to fill your car, then driving your vehicle is comparable to executing your Ethereum transaction. You need to buy gas from the gas station, which is equivalent to a miner. In this analogy, you pay a miner in ETH for your Ethereum gas, as you would pay a cashier in a gas station.

How Are Ether Gas Fees Defined?

There is no set price for the cost of gas, either in ETH or USD. Gas costs are effectively a marketplace, which sets fees based on Ethereum users and miners agreeing on rates. It’s important to remember that like most blockchains, Ethereum works on the principles of incentivization. Miners take a share of transaction fees as profit.

Therefore, the gas fee paid for a transaction must cover their computing power and still make it attractive enough for them to process the transaction.

Moreover, an Ethereum miner can select which transactions they want to include in the next block they mine. So you can consider that Ethereum users are just bidding for a space in the next block, as miners will choose the transactions that offer them the most profit potential.

This economic model for gas fees also explains why prices go up when traffic on the Ethereum network increases. As more people queue up to have their transactions processed, a miner can become pickier about which transactions they include in their blocks. This means that users have to bid higher gas fees to ensure their transaction doesn’t get stuck in a queue behind other more profitable ones.

What is the Ethereum Gas Limit?

The gas limit allows the user to specify a maximum amount of gas that they’re prepared to pay for in any one transaction. The gas limit helps us calculate the transaction cost as a real value because the gas limit multiplied by the current gas price (as set by the markets) will provide the transaction cost.

ETH Gas Station

For most basic ETH transactions, the standard gas limit is 21,000 gas. We can use a site like EthGasStation to calculate our transaction cost. From the screenshot below, you can see that the current average gas price is 123 gwei, and we’re assuming the standard gas limit of 21,000 gas.

current average eth gas price

We can see several important metrics from the screenshot that tell us how valuable our transaction is and how quickly it will get confirmed. For instance, we know that around 64%, nearly two-thirds of miners, will process our transaction at this price, and it will take 147 seconds or 11.9 blocks to confirm the transaction if we accept the fee at 0.002 ETH or $4.

If we want a faster confirmation time and are prepared to pay more, then we can get a 25 second confirmation time but end up paying around $5.70 for the transaction with a gas limit of 21,000 gas.

a faster confirmation time with a gas limit of 21,000 gas

Similarly, if we’re prepared to wait longer, we can get our 21,000 gas transaction costs down to $3.45.

21,000 gas transaction costs down to $3.45

What If I Reduce the Gas Limit?

You may be thinking that you could just reduce the amount of gas you’re prepared to use for the transaction. What if it doesn’t use all of the 21,000 gas? Of course, you can set your gas limit lower. In principle, whatever gas is left gets refunded to you, so there may be some headroom.

However, there’s a balance between high and low costs and high and low gas. We’ve already looked at the cost part – higher gas costs incentivize the miners to choose your transaction.

But remember, gas is the computing power needed to complete the action. If you lower your gas limit, there’s a risk that you won’t have enough gas to compute your transaction.

Once it runs out, the miner will simply stop processing and revert the smart contract to its previous state. The attempted transaction gets recorded on the Ethereum blockchain, and you still pay the fee because the miner has fulfilled their end of the contract.

On the flip side, vastly inflating your gas limit could also inhibit your chances of getting the transaction picked. Ethereum blocks are subject to a gas limit of 6.7 million gas. Even if they return part of the gas limit to the initiator, the transaction’s gas limit is still counted as part of the block. Therefore, there’s no incentive for them to pick transactions with falsely inflated gas limits because it reduces the number of transactions they can put into their block.


In many respects, Ethereum’s gas system is a well-engineered system that plays on the principles of market economics. However, it’s not necessarily perfect, as we see during times of high congestion when users suffer from astronomical fees. It makes apps like games that use micropayments prohibitively expensive to run on the Ethereum blockchain.

Furthermore, requiring gas to be paid in ETH can be cumbersome for users and developers as it means they always need an ETH balance even if the native token of the application is different.

As Ethereum transitions to proof-of-stake and sharding with the Ethereum 2.0 upgrade, we may see solutions emerge to these issues. The increasing prevalence of second-layer platforms may also result in a shift away from developing on Ethereum directly. However, given the already established ecosystem that thrives on Ethereum, it seems inevitable that the platform itself will remain a vital part of the blockchain landscape for some time to come.

For any inquiries contact us at
Follow our official Twitter | Join our community on Telegram
Trade crypto on the go: Download for iOS | Download for Android
Phemex | Break Through, Break Free
giftRegister to get $180 Welcome Bonus!
Invitation code (Optional)
  • Facebook
  • Twitter
  • LinkedIn
  • Telegram
  • Discord
  • Youtube
Subscribe Phemex

Register on Phemex and begin your crypto journey today

Get $180 to Sign Up