I'm new to eth and dapp development and I'm running my own private test chain for development/ testing purposes and keep running into the above error when running truffle test.

Is there a way to increase the gas limit for my tests services? I have the following

testrpc '--debug --account="0xaa73b5c98e60d589e71ce7cff59c02f82e12c7ce676ee356da8e058a285ccd61,912082343256218" --account="0x52f3a1fa15405e1d5a68d7774ca45c7a3c7373a66c3c44db94a7f99a22c14d28,9023291452436789"

and my genesis file

{ "nonce": "0x0000000000000042", "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000", "difficulty": "0x40", "alloc": {}, "coinbase": "0x0000000000000000000000000000000000000000", "timestamp": "0x0", "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "extraData": "0x", "gasLimit": "0x8000000", "coinbase": "0xaa73b5c98e60d589e71ce7cff59c02f82e12c7ce676ee356da8e058a285ccd61", "config": { "chainId": 4224, "homesteadBlock": 0, "eip155Block": 0, "eip158Block": 0 } }

  • Would increasing the gas limit solve my problem?
  • Can i set my prices so I can keep within the range of the limit?

You can use provide the custom gas limit while starting the TestRPC or Ganache with the option of -l

testrpc -l 0x8000000


ganache-cli -l 0x8000000
  • Or --gasLimit=0x1fffffffffffff (13 Fs) if you want to use JS max integer, which is the max value supported in testrpc / ganache. – goodvibration Nov 25 '18 at 10:22

If you want to increase the block gas limit, you can increase the value in gasLimit field in your genesis.json file and initiate your blockchain again.

Currently, your defined block gas limit is quite high (0x8000000 or 134,217,728) and you still have "Exceeds block gas limit" error. Did you get that error when deploying a contract or executing a contract's function?

  • Simple contract based on a tutorial. Got it to work eventually but will heed your advice is it comes up again. – KArneaud Feb 3 '18 at 19:23

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.