6

As mentioned in documentation eth.gasPrice returns the current gas price. The gas price is determined by the x latest blocks median gas price.

I was relying on this method to estimate current gas price that I send along with my transactions. But recently I faced an issue, most of my transactions are pending.

When I looked at the transactions, the gas price provided was 35 GWei, while on eth gas station, the safe low gas price is 57 GWei.

I checked the value of eth.gasPrice` on my node and this resulted to 25000000000 (25 GWei).

Why the value of eth.gasPrice is so low when the gas price of the network is increased to double.

I also checked some recent transactions on etherscan : 0xf5ccc6ecc36b318c8ac9794e2b472fa2f9b3acc0b2adf662b4f858b76a69c278, 0x123789fd42ad2037fff8bfaca3caeb6bec179b4630588902ae95c9515c742432, 0xf78960adb886d9a31549a04154ce459e00896dac6c7156e749c63f6755c5a4c9

All of them has gas price of 60 Gwei. So why is eth.gasPrice is giving me 21GWei? Can I rely on this method to estimate current gas price? Are there any alternatives?

edit: Recently the values returned by eth.gasPrice has been to 2 GWei, and the transactions (here) are pending for more than a day. While I can see the safe-low is around 12 Gwei.This function ditched me again.

0

The eth.gasPrice is made up by the gas price oracle running on miners. You are not required to comply with this oracle, it's up to you whether you want to be greedy or not. However, using the suggested gasPrice might help in terms of stabilizing the network.

Miners have a strategy for how much they charge to 'hire' them to work on mining your transaction. How much you are willing to pay, directly relates to how fast you can convince a miner to complete your work and add your transaction to the network.

The transactions that you've witnessed on etherscan (which all have 60 GasPrice in common), are related to activities where fast addition to the network is prioritised i.e. trades, auctions, etc and by paying a generous price above average, then those transactions are more likely to evoke miner interest and be added to the network with greater priority.

  • Yes, I know, how gas works and I need to comply with the price given by eth.gasPrice. But as per their document: The gas price is determined by the last few blocks median gas , which does not seem true. I checked recent blocks and txs and the gas price was around 60Gwei. However, eth.gasPrice returned way too low value which is not acceptable. They don't mention how may blocks they use for calculating median values and I have seen this happening lots of times. If everyone is sending txs with 60Gwei, I would expect the median gas price of few blocks to be around 60 and 12. – Prashant Prabhakar Singh Jun 13 at 5:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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