5

According to https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gasprice rpc-json method eth_gasPrice returns the current price per gas in wei. But I have several questions:

  1. What does exactly mean "current price per gas"?

  2. What does define the price per gas?

  3. Shouldn't gas price always be 20,000 Babbages for coin transfer transactions?

  4. Why most of the times when calling eth_gasPrice method it returns 20,000 Babbages, but from time to time it returns 21,912 Babbages or 21,905 Babbages, just a few seconds later?

  5. Why effective gas price on completed transactions is always 20,000 Babbages, but never those funny and sporadic values (21,912 Babbages or 21,905 Babbages).

  6. So gas price on transactions seems to be constant and a round number, while gas price when querying eth_gasPrice() is very volatile. Is eth_gasPrice() a reliable function? Should I trust it?

1

1 Answer 1

2

According to the JS API's documenation, what it returns is the median gas price from the latest blocks.

You may be confused by the difference between gas and gasPrice. Gas is how much computational resources a given transaction used. gasPrice is how much the user pays for each unit of those resources. The actual fee for a transaction is gas*gasPrice.

20,000 babbage is an example of gasPrice, which happens to be the current default (and therefore often the median, and why you'll see it so often.) A simple send costs 21000 gas, for an actual total of 0.00042 ETH.

But why set gasPrice to any specific number? The gasPrice is how much a miner gets paid for including the transaction, therefore setting it higher will mean it will most likely be included in a block faster. To simply have a transaction included at all, the default (20,000 babbage, or 20 Gwei) will be sufficient.

1

Your Answer

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

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