7

I am currently running a private ethereum chain with 2 nodes. My coinbase address on the main node has plenty of ether so I went to make a transaction but got the error "Gas Limit exceeded". I noticed that the gas limit was set to 5000 which is too low to make a transaction so I went to the customised genesis.json file and increased the limit to "0xC350" or 50000. Despite this the limit only moved to 5003. I have no idea why it does this and I have replaced the figure with other bigger numbers yet it only ever manages to get to 5003 instead of the default 5000. Any help would be much appreciated.

Here is my Genesis.json file:

{
"nonce": "0x0000000000000042",
"timestamp": "0x0",
"parentHash":      "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x0",
"gasLimit": "0xC350",
"difficulty": "0x400",
"mixhash":"0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x3333333333333333333333333333333333333333",
"alloc":
{ 
"0xcf117e46aa225864ed1d0dd7e99b8b006abe3410":
{ "balance": "10000000000000000000000000" } 
}

}

I am using Geth.

0

1 Answer 1

4

Don't change the genesis file, as it changes the dynamics of the blockchain. Geth has a --targetgaslimit flag that will cause the miner to converge towards a specific number opposed to the hard coded value.

Every block has a gas limit that's contained within the block itself. This limit can only change with a certain amount between blocks (prev limit/1024 to be precise). If the change is larger, the block is not accepted any more.

Make sure that you not only set --targetgaslimit but also to start mining --mine your private network. This will slowly move the block gas limit towards the target gas limit specified and you will see how the gas limit increases each block.

Also note, the target gas limit flag was introduced in geth 1.4.x, so make sure you have a very recent client.

See also this excellent answer on Ethereum Stack Exchange.

7
  • Are you aware that I am running a private chain and not the main net ethereum blockchain? Does this still apply to private local chains? Thanks
    – James
    Commented Jun 29, 2016 at 6:50
  • Yes, set --targetgaslimit to 500000 and start mining your private network and you will see how the gas limit increases each block.
    – q9f
    Commented Jun 29, 2016 at 6:51
  • Still won't change for some reason...
    – James
    Commented Jun 29, 2016 at 7:30
  • Which geth version? Are you mining?
    – q9f
    Commented Jun 29, 2016 at 7:34
  • 1.5.0. I even erased the blockchain, started over and mined but the limit is still 5000. Cheers
    – James
    Commented Jun 30, 2016 at 5:14

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