Home/Guide/Blockchain Encyclopedia/DeFi/What are Miner Fees and Gas Fees?

What are Miner Fees and Gas Fees?

2023.08.19 MEXC
Share

1. What are Miner Fees and Gas Fees?


Gas is a unit of measurement in the Ethereum protocol. It quantifies the computational and storage resources required to execute specific operations on the Ethereum blockchain. In simple terms, much like the literal meaning of "gas" in its context, just as every car on the road continuously consumes gasoline, on platforms like Ethereum and other smart contract platforms, each operation also consumes gas. The amount of gas represents the cost needed to perform a specific operation within the blockchain network and is eventually paid as a fee to miners. Therefore, it's often referred to as a miner fee.

The gas mechanism incentivizes the network's ecosystem through payments while effectively preventing the network from being congested by a large number of meaningless transactions. However, unlike Bitcoin, on smart contract platforms, regardless of the success of the transaction, a certain amount of gas must be paid. This is because even in the case of failure, miners have still expended resources to verify the transaction's computation.

2. Why is Gas Needed?


Gas is a crucial component of Ethereum, serving a dual purpose: as a buffer for Ethereum's floating price and miner rewards, and as a preventative measure against denial-of-service attacks. To prevent accidental or malicious infinite loops and other forms of computational waste within the network, creators of each transaction need to set a limit indicating the computational load they are willing to invest in transaction execution. The gas system helps deter attackers from sending spam transactions since they must bear the cost of the computational load, bandwidth, and storage resources they consume.

3. Gas Price and Gas Limit


Before delving into how to calculate gas fees, we need to understand two concepts in a transaction: gas price and gas limit.

Gas price allows the initiator of the transaction to set the amount of gas they are willing to pay. A higher gas price results in a faster confirmation of the transaction, while a lower gas price leads to a slower confirmation. The gas price can even be set to a minimum of 0. If there is extra space in a block, transactions with such gas prices can still be packed by miners and added to the blockchain. The Ethereum protocol itself does not prohibit feeless transactions, and there have been instances of successful feeless transactions in Ethereum's historical blocks.

Gas limit signifies the maximum amount of gas the initiator of the transaction is willing to pay to complete the transaction.

4. How to Calculate Gas Fees


In Ethereum, gas is paid using ETH, with the unit price measured in gwei. 1 gwei is equal to 0.000000001 ETH.

Prior to the Ethereum London upgrade, the gas fee calculation formula was:

Gas = Gas Limit * Gas Price

Let's assume Bob needs to send 1 ETH to Tom. The current gas limit is 21,000 units, and the gas price is 200 gwei. The gas fee would be: 21,000 * 200 = 4,200,000 gwei, which translates to 0.0042 ETH. In other words, Bob's account is debited a total of 1.0042 ETH when making the transfer, with 1 ETH going to Tom and 0.0042 ETH as the miner fee.

In August 2020, with the Ethereum London upgrade and the introduction of EIP-1559, to create smoother and more predictable fluctuations in gas prices, the gas calculation formula was adjusted:

Gas = Gas Limit * (Base Gas Price + Priority Fee)

The base gas price is calculated based on current block space usage demands and is burned upon expenditure. Users can also set a priority fee (often automatically set by third-party wallets) to ensure their transactions are processed quickly during network congestion.

Now, let's say Bob is sending 1 ETH to Tom again. Assuming a gas limit of 21,000 units, the base fee is priced at 100 gwei, and Bob pays an additional 10 gwei as a priority fee. The gas fee would be: 21,000 * (100 + 10) = 2,310,000 gwei, which is 0.00231 ETH. Thus, Bob's account is debited 1.00231 ETH, with 1 ETH going to Tom, 0.00021 ETH as the miner fee, and 0.0021 as the priority fee.

5. Why Are Gas Fees So High?


Any operation on Ethereum requires payment of gas fees, but the space in each block is limited. As Dapp functionality becomes more complex and the number of operations executed in smart contracts increases, each transaction takes up more space within the limited-sized block. With high demand, users must provide higher fees, striving to outbid other users' transactions. The higher the fee, the greater the likelihood of the transaction being included in the next block.

6. How to Improve?


Scalability upgrades for Ethereum should ultimately address some of the gas cost issues, enabling the platform to process thousands of transactions per second for comprehensive scalability.

Layer 2 scaling is a major initiative that can significantly optimize Gas costs, user experience, and scalability.

Conclusion


The surge in miner fees to some extent reflects the activity on the chain, and increased activity on the chain has a positive impact on network development and market valuation. However, the current high fees significantly impact user experience and require urgent resolution.

Beginner Benefits

Sign up and easily get New User Rewards. There is up to 1,000 USDT Futures Bonus waiting for you.