[Ethereum] How is the gasPrice generated in ethereum

gas-price

while I execute eth.gasPrice via the geth console,it returns the current default gasPrice 20322509741, so

  1. how is this default value generated
  2. will it changes now and then according to the market
  3. transaction creators hope the lower gasPrice while the miners opposite,how to reach an agreement
  4. miners could start the geth with the parameter –ask to set the lowest gasPrice,will the setting changes during the runtime?

Best Answer

how is this default value generated

This is a median based on the value used in recent blocks.

will it changes now and then according to the market

Yes, it changes.

transaction creators hope the lower gasPrice while the miners opposite,how to reach an agreement miners could start the geth with the parameter --ask to set the lowest gasPrice,will the setting changes during the runtime?

It's a market mechanism.

Miners set the minimum price at which they are prepared to accept transactions. This can be either set on the command line when the node is started or changed while the node runs. Transaction creators set the maximum price which they are prepared to pay for their transaction to be mined.

Miners want to maximize their revenue. There's a cost to accepting a transaction, because a bigger block will take longer to propagate across the network and get validated by other miners, resulting in a greater risk that the block will be orphaned. There's also a maximum limit to the gas that can be used in the block, beyond which it is invalid, so if they fill that up they want to fill it at a high price, not a low price. However, if they set their price too high then they'll lose money be turning away too many paying transactions.

Related Topic