How can I increase the gas limit in this case? The error message is "n: Exceeds block gas limit" or "base fee exceeds gas limit".

I think there is some kind of api I need to set the block gas limit here.

Are my contracts too large? Should I test each contract one by one instead? Please advise. Thank you.

  • exceeds block gas limit ganache
    – Russo
    Commented Sep 27, 2018 at 9:57

2 Answers 2


The error message

"n: Exceeds block gas limit"

means your transaction has declared a gas value greater that the maximum allowed in the network. A client will reject such transaction.

With ganache-cli you can launch with a larger amount of gas available with the -l parameter:

ganache-cli -l 8000000

Will launch ganache with a block gas limit of 8M.

From the readme documentation it has a mode where you pass extra options in a parameter when you launch ganache. There you can set gasLimit.

const ganache = require("ganache-cli");
const options = { gasLimit: 8000000 };
const server = ganache.server(options);
server.listen(port, (err, blockchain) => {
    /* */
  • Hi Ismael, how can I add this command inside my Javascript file so I can run this file during Mocha Tests with Ganache-cli ? Thanks
    – Russo
    Commented May 1, 2018 at 9:38
  • 1
    @user2965665 How do you start your ganache instance? You can pass more options in the extra parameter, you can set gasLimit from there.
    – Ismael
    Commented May 1, 2018 at 14:45
  • Thank you. I figured it out: const provider = ganache.provider(options);
    – Russo
    Commented Sep 27, 2018 at 9:56

Thanks to Ismael's solution:

const ganache = require('ganache-cli');
const Web3 = require('web3');

const options = { gasLimit: 8000000 };
const provider = ganache.provider(options);
// quote from doc "Both .provider() and .server() take a single object
// which allows you to specify behavior of ganache-cli"
// https://github.com/trufflesuite/ganache-cli#using-ganache-cli
const web3 = new Web3(provider);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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