Any kind of action on the Ethereum blockchain – be it a simple transfer of Ether (ETH), the unwinding of a smart contract (smart contract), the mining of an NFT or the use of a decentralized application (dApp) – requires computational resources. These resources are paid for in gas.
Components of the transaction fee (Gas Fee)
Gas Units
- Each transaction on the network has a fixed cost in gas units, which reflects the computational complexity of that transaction.
- For example, a simple ETH transfer between two addresses requires a fixed number of gas units (typically 21,000 units).
- Smart contract interactions are much more complex and may require hundreds of thousands or even millions of gas units.
Gas Price
- Gas price is the cost per unit of gas and is expressed in Gwei (1 Gwei = 0.000000001 ETH). Gwei is a fundamental unit of measurement used on the Ethereum blockchain, representing a subunit of the cryptocurrency Ether (ETH). The name “Gwei” is an abbreviation of “gigawei”, where “giga” stands for one billion and “wei” is the lowest denomination of Ether.
- The price of gas is variable, depending on supply and demand in the network.
- When the network is crowded (many transactions are trying to be processed simultaneously), the price of gas goes up as users bid against each other to get their transactions included in a block faster.
- When the network is less crowded, the price of gas decreases.
Gas Limit
- The maximum amount of gas you are willing to pay for a given transaction.
- Setting the gas limit too low may cause the transaction to fail, but you will still lose the fee for the gas consumed up to that point because the validators have put in the computational effort.
- Setting too high a limit is not a problem, as unused gas is returned to your wallet. The gas limit also serves as a safeguard against errors in smart contracts that could consume gas indefinitely.
How the total charge is calculated
Total Transaction Charge = (Units of Gas Consumed) x (Gas Price)
For example: If a simple transfer requires 50,000 units of gas, and the gas price is 20 Gwei, the total fee will be: 50,000×20 Gwei=1,000,000 Gwei
1.000.000 Gwei=1.000.000×0.000000001 ETH=0.001 ETH
So the total fee would be: 50.000×20 Gwei=1.000.000 Gwei=0.001 ETH
Why “Gas” fees exist
- Incentivizing Validators: Gas fees are paid to validators (former miners, after the transition to Proof-of-Stake), who process and validate transactions, ensuring the security and integrity of the network. Without these fees, there would be no economic incentive for them to devote their resources.
- Prevent Spam: By attaching a cost to each transaction, gas fees discourage malicious actors from flooding the network with unnecessary transactions or spam, which could slow down or block the blockchain.
- Resource Allocation: Gas fees help manage demand for the blockchain’s limited block space, ensuring that more important or urgent transactions are prioritized for processing.
Evolution of Gas fees (EIP-1559)
With the London Hard Fork upgrade (which included EIP-1559), the mechanism for calculating gas fees has been improved:
- Base Fee: This is a mandatory fee that automatically adjusts for network congestion and is burned (taken out of circulation), helping to reduce ETH inflation.
- Priority Fee: This is an optional fee that you can add to “tip” the validator, incentivizing them to include your transaction faster in a block.
Total Transaction Fee (per EIP-1559) = (Gas Units Consumed) x (Base Fee + Priority Fee)
In conclusion, the “gas” is a fundamental element of the Ethereum network, balancing demand, supply and security, ensuring the efficient and decentralized operation of the blockchain.
Curious about a cryptocurrency’s journey and its current price? Visit our cryptocurrency price page for the latest information.