2

I am able to get gas price data as follows from some oracles (i.e., ethgasstation.info, etherscan.io):

{  
   "fast":50.0,
   "fastest":200.0,
   "safeLow":10.0,
   "average":20.0,
   "block_time":13.942307692307692,
   "blockNum":7403346,
   "speed":0.7090284960673774,
   "safeLowWait":13.4,
   "avgWait":1.8,
   "fastWait":0.5,
   "fastestWait":0.5
}

Is there a way to get similar information (including any other gas info) directly from Geth?

From Geth documentation I tried some commands especially related to Gas Price Oracle Options and also the curl that throws errors as follows:

geth curl

When I run geth with or without options, the results are as follows, probably they are the current network status.

I am new to this and pretty sure I am missing something! Any clue is appreciated.

geth with options geth without options

3

You can try to get pending transactions and calculate an average amount of gasprice.

pending_transactions = web3.provider.make_request("parity_pendingTransactions", [])
gas_prices = []
for tx in pending_transactions["result"[:10]]:
    gas_prices.append(int((tx["gasPrice"]),16))

print("Average:")
print("-"*80)
print("gasPrice: ", statistics.mean(gas_prices))

Related article (subheader Estimating Gas):

https://www.quiknode.io/guides/web3-sdks/estimating-gas-price-using-pending-transactions-in-python

1

Yes. You can use the eth_gasPrice RPC call. From the docs:

Returns the current price per gas in wei.

2
  • Thank you @shane, I just updated the question with few more queries after your post. Could you please provide me some hint?
    – temp
    May 19 '20 at 18:53
  • Hmmm. I would think that that should work. Maybe you can try reaching out to the Geth team on their discord channel. I am not sure of the answer. May 19 '20 at 19:39

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.