Ethereum GasPrice conversion

According to documentation ethereum gasprice is printed in gwei.

when I try to get the gasprice with ethers like this

const gasPrice = await provider.getGasPrice()
    console.log(ethers.utils.formatEther(gasPrice))
    console.log(ethers.utils.formatUnits(gasPrice, 'gwei'))

I get following output:
0.00000000528432879 ether
5.28432879 gwei

However at the time of this writing the eth gasprice according to ethGasStation is
Gas Price (legacy): 30 (gwei)

So why is there a 6x difference in price what I get with ethers than what ethgasstation shows me?

ALso whats more reliable, because if I check the gasPrice on etherscan this matches more the results I get than on gasstationInfo, so what is a more reliable source, etherscan or ethGasstation?

That ETH Gas Station site seems to have some issues (missing title) and their Twitter hasn’t been updated in a year, I don’t think it’s maintained anymore.

You can just use etherscan for reference, getGasPrice() matches close enough to their average gas price.

1 Like