1

I'm trying to understand gas in ethereum with EIP 1559. During my search I found this article https://www.blocknative.com/blog/eip-1559-fees (I have a light node deployed so I have access to block informations instantly).

In this article they say : enter image description here

I tried with an increase of 12.5% ( when the gas limit is reached ), and I found the next block base fee. However when gas limit is not reached I do this :

percent = (<gas_used> / <gas_limit>) * 100 , and I now know that the block is percent% full

If block is filled to 100%, we increase by 12.5% the base fee. I deduced that if it's filled to 75% for example, we increase by ( 0.75 * 12.5 ) = 9.375% the base fee at the next block. I have checked on etherscan and never found the good result ...

I have another question, when I visit blocknative calculator (https://www.blocknative.com/gas-estimator) enter image description here

They do the opposite of what they say in their article. On the screen we can see that the base fee is 10.61, and max fee are 17/18gwei

but according to them : enter image description here

Max fee = 10.61*2 + 2 = 23.22gwei

Thanks in advance for your answers

2 Answers 2

2

Based on the CalcBaseFee function in the source code of Geth, the process for determining the next base fee is as follows:

def predict_next_basefee(basefee, gasused, gaslimit):
    param = 4 # 4 for Ethereum, 8 for Polygon, ...

    tmp = (gasused - (gaslimit / 2)) * basefee / gaslimit / param
    if tmp == 0:
        return basefee
    elif tmp > 0:
        return basefee + max(1, tmp)
    else:
        return max(0, basefee + tmp)
0

In plain English, it means if gasUsedRatio (gasUsed/gasLimit) is 70%, then baseFee will increase by abs(70%-50%)/4 = 5%. If gasUsedRatio is 42%, then baseFee will decrease by abs(42%-50%)/4 = 2%.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.