This Hardhat plugin automatically starts and stops Ganache when running tests or scripts.
This plugin creates a network named
ganache. When this network is used, a Ganache server will be
automatically started before running tests and scripts, and stopped when finished.
npm install --save-dev @nomiclabs/hardhat-ganache
And add the following statement to your
Or, if you are using TypeScript, add this to your
This plugin hooks into the
run tasks to wrap them in the instantiation and termination of a
This plugin creates no additional tasks.
This plugin doesn't extend the Hardhat Runtime Environment.
There are no additional steps you need to take for this plugin to work.
You can set any of the Ganache's options through the
network config. All of them are supported, with the exception of
This example sets a larger block gas limit and the default balance of Ganache's accounts.
moduleexports =defaultNetwork: "ganache"networks:ganache:gasLimit: 6000000000defaultBalanceEther: 10;
accounts option is not currently supported.