Search code examples
ubuntublockchainethereumgeth

gasLimit decrease over time


I am deploying Ethereum over Ubuntu server. I initiated the blockchain with custom genesis.json parameters including gasLimit and difficulty level.

Over time, I noticed that difficulty keeps on adjusting itself by increasing and decreasing on every block generated. As for the gasLimit, it starts with the value I set and keeps on decreasing on every block until it reaches the default value of 4,712,388 which is less than my transaction cost and causing me issues.


Solution

  • The gasLimit in the genesis block is only used as a starting point. As blocks are added to the chain, the block gas limit will change over time based on the miners processing the transactions on the network. To keep the block gas limit higher, you need to override the default configuration in your node client.

    For Parity:

    --gas-floor-target=[GAS]
        Amount of gas per block to target when sealing a new block.
        (default: 4700000)
    
    --gas-cap=[GAS]
        A cap on how large we will raise the gas limit per block
        due to transaction volume. (default: 6283184)
    

    For Geth:

    --targetgaslimit value    
        Target gas limit sets the artificial target gas floor for the blocks to mine (default: 4712388)