Skip to main content
1 of 2
Mat.C
  • 176
  • 1
  • 1
  • 6

How to retrive a dynamic average value for gas-price

i'm wondering how can i get the correct current average gas price ( or the new parameters maxPriorityFeePerGas and maxFeePerGas ) to push to my web3 wallet in order to have my transaction mined?

I know that there is an rpc call that you make that returns the current gasPrice of the rpc node you are calling, but it always seems not dynamic, by dynamic i mean that i'd like the value to change over time to match the real variation of gasPrice used by transactions of the latest blocks.

I mean, in a self hosted geth node, there is a way for retriving a dynamic value for this attributes? they seems like hardcoded and never get updated, for example from the geth cli eth.gasPrice , eth.maxPriorityFeePerGas returns always 1000000000 why is that? do i have to implement myself a tracker that based on the latest 'x' blocks it returns the average gasPrice used or does geth have an internal logic that already does this that i can call ? Thanks in advance :)

Mat.C
  • 176
  • 1
  • 1
  • 6