Understanding Ethereum’s Maximum Gas Fee
In Ethereum, the maxFeePerGas
parameter allows miners to set a maximum fee per gas unit for transactions. However, it is essential to understand how this value affects the actual gas cost of your transaction.
Maximum Gas Fee: Not Per Gas Unit
The term “maxFeePerGas” is often misinterpreted as “per gas unit”. This means that you will be charged the maximum fee regardless of the number of units in the gas pool. This is not a direct conversion to per unit fees.
Entering the Maximum Gas Fee into the Gas Pool: The Formula
To calculate the actual gas cost, you need to consider two factors:
- MaxFeePerGas: Maximum fee per transaction.
- TotalGasUnitsRequired: Total number of gas units required for your transaction.
Using a simple formula, we calculate the current cost of gas:
Current cost of gas = MaxFeePerGas + (MaxFeePerGas x TotalGasUnitsRequired)
Example: 10,000 units of gas required
Let’s say you want to pay up to 50 gwei per unit of gas. To calculate the actual cost of gas:
Actual gas cost = 50$20 + (50$20 x 10,000) = 50$50+ 500$500 = 550$50
Putting it into practice
In your example, if you send a transaction that requires 10,000 units of gas and want to pay up to 50 gwei per unit, the maxFeePerGas
value will be:
maxFeePerGas = 50gwei + (50gwei x 10^-9)
This is equivalent to paying 550gwei for 10,000 units of gas.
Conclusion
To sum up: when setting maxFeePerGas
, do not confuse it with “per unit of gas”. It is essential to understand that the maximum fee will be charged regardless of the number of units in the gas pool. To calculate the actual cost of gas, use the formula above and consider the total number of gas units needed for the transaction.
I hope this helps clarify things!
Leave a Reply