Hardhat Block Gas Limit – How to Specify Block GasLimit for Hardhat Node

hardhatnodes

When starting local ganache blockchain I am able to specify block gasLimit for the network.

Example:

 ganache-cli --gasLimit=60000000

I tired to do same with hardhat node

npx hardhat node --gasLimit==60000000

But that doesn't seem to work, so I hope someone here knows the way around this.

Best Answer

I managed to do it by setting the blockGasLimit value inside hardhat.config.js

require("hardhat-tracer");
require("@nomiclabs/hardhat-waffle");


/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {

  defaultNetwork: "hardhat",
  networks: {
      hardhat: {
          blockGasLimit: 60000000 // Network block gasLimit
      },
  },

  solidity: {
    version: "0.8.3",
    settings: {
      optimizer: {
        enabled: true,
        runs: 2**32-1,     // Optimized for SmartContract usage, not deployment cost.
      },
    },
  },

};
Related Topic