1

Geth command-line options

I am looking at geth command-line options for miners, specifically:

--miner.gastarget value
--miner.gaslimit value

The default value for both is 8000000 on Ethereum according to the documentation. However, I do not understand the documentation description of what they do.

What do these options do exactly when mining blocks?

Etherscan Gas Limit and Gas Used

Blocks on etherscan have a Gas Used and a Gas Limit value. By looking at random blocks, I see that those values are around 12500000. Gas Used is always a percentage of Gas Limit.

What do these values mean exactly? What is their relation with the above geth options, if any?

You would think that both gas limits are the maximum gas that a block would include, but the value on etherscan does not match the geth default value.

You would also think that gas limit on etherscan is the sum of the gas limit of all the transactions in the block, but I do not think that it is the case.

Thanks for the help.

3
+50

Each block has a gasLimit field. A miner can increase or decrease it. This change is small, less than 0.05 % of the parent's value. So it cannot be changed immediately to an arbitrary value, usually changes have to be applied for several hundred of blocks before it reaches a particular value.

Now there are three situations with respect to miner gasTarget and miner gasLimit:

  • block gasLimit < miner gasTarget: Miner will increase the block gas limit until it reaches miner gasTarget.

  • miner gasTarget < block gasLimit < miner gasLimit: Miner will keep block gasLimit without changes.

  • miner gasLimit < block gasLimit: Miner will decrease block gasLimit until it is below miner gasLimit.

3
  • So the next block gasLimit is not determined by the available transactions in the txpool, but by the parent block gasLimit, plus a possible 0.05% increase or decrease depending on the miner's gasTarget and gasLimit values. Correct? Does it mean that a miner using unmodified Geth must accept available tx from the txpool until the block gasLimit is reached, regardless of his gasTarget and gasLimit values?
    – Undead8
    Apr 24 at 13:55
  • @Undead8 A miner has to accept blocks whose gasLimit is within 0.05% from the parent block, blocks outside those limits must to be rejected. A block gasUsed has to be lower than gasLimit but otherwise it can be zero, for example empty blocks are accepted. Obviously it is expected a miner will prefer a block with transaction close to gasLimit. A large gasLimit affects how long it takes to process, and it causes more uncle blocks. gasLimit is a value agreed between miners that is more benefitial for them.
    – Ismael
    Apr 24 at 20:13
  • Thanks it's very helpful. If there are no other answers, I will accept it before the bounty period ends.
    – Undead8
    Apr 25 at 17:15

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.