5

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.

  • Are you using the genesis.json file while starting geth ? – Abhiram mishra Jun 29 '16 at 5:08
  • I am running the customised genesis file from above, here is the command: geth --datadir ~/.ethereum_private init ./customGenesis.json – James Jun 29 '16 at 5:35
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.

3

I've used the guide How to Run Multiple Geth Instances on a Private Ethereum Blockchain. And can use above 1,000,000 gas.

{
"nonce": "0xdeadbeefdeadbeef",
"timestamp": "0x00",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x686f727365",
"gasLimit": "0x8000000",
"difficulty": "0x0400",
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x3333333333333333333333333333333333333333",
"alloc": {
}
}

New versions of geth don't allow to modify the genesis block once it has started. You have to reset your data directory and start again.

0

You don't need to change the genesis file. It is just to initialize the ethereum node. You have to check the latest block with eth.getBlock("latest") command and there you will get the gasLimit. It increases as the block increases in the network. Always insure that your transaction gas limit must be less than this.

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.