All Collections
NFT Basics
Basics of NFTs
What is gas and why do we need transaction fees?
What is gas and why do we need transaction fees?
Ev Tchebotarev avatar
Written by Ev Tchebotarev
Updated over a week ago

When you send a transaction on Ethereum, you must pay a fee to get it included in the blockchain. This fee is called the "transaction fee." Transaction fees ensure that blockchain resources are allocated in a fair free-market manner. They incentivize miners to process transactions and users to send only the transactions they are willing to pay for.

The transaction fee is gas consumed times price per unit of gas (the dreaded "gas price"). The "gas" is an accounting unit used to measure the number of steps of computation performed (as in "gas makes the Ethereum machine go"). For example, a typical token transfer requires about 30,000 gas, while taking out a loan on-chain requires about 250,000.

Sometimes, we don't know the exact amount of gas required in advance (e.g., when the operation depends on the actions of others or on the time when it is processed). To handle that, we specify the maximum number of computation steps the transaction can take — the "gas limit." Apps usually compute this parameter for you; there is no need to change it.

Transaction fees are also a defence mechanism! The user must have enough Ether to cover the maximum fee for miners to accept their transaction. Since nobody has infinite money, this also takes care of operations that would never complete (either because of a bug or malicious intent). Clever!

Defending Ethereum from attackers is also why failed transactions cost money: if the miners allowed failing transactions to be included for free, attackers could send a constant stream of failing transactions and drain computational resources without any consequences.

In practice, most wallets today are pretty good at estimating both gas limits and gas prices. It's still a good idea to check that your transaction fee is reasonable when sending the transaction:

  1. If the gas limit is unreasonably high (usually in the millions), that may indicate a bug. Contact the app's developer to get some advice before you send the transaction.

  2. Waiting a couple of hours to send your transaction can save you 50% or more. Check the "Average GasPrice" on to see when the quieter times are.

Did this answer your question?