< All Blog
November 05, 2022
Hardhat is a toolkit for local smart contracts development. The toolset comes with Hardhat Network, which is a local blockchain network simulator where you can deploy and test your smart contracts before deploying onto mainnets.
$ npx hardhat node
Started HTTP and WebSocket JSON-RPC server at http://127.0.0.1:8545/
On startup, it randomly generate 20 accounts with 10000 ETH
(the library version is v2.12.0
as of writing this blog post):
Accounts
========
Account #0: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 (10000 ETH)
Account #1: ...
Account #2: ...
//...
Account #19: ...
Account #20: ...
When you'd like to change the initial accounts balance, you can configure your hardhat.config.js
to have more/less accounts balance.
Add or edit networks.hardhat.accounts
fields as follows. In the following example configuration, the Hardhat Newtork will create 5 accounts with 10000000 ETH
module.exports = {
networks: {
hardhat: {
accounts: {
count: 5,
accountsBalance: "10000000000000000000000000"
}
},
},
solidity: "0.8.17",
};
Then try starting your local network. Now the output would look like:
$ npx hardhat node
Started HTTP and WebSocket JSON-RPC server at http://127.0.0.1:8545/
Accounts
========
Account #0: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 (10000000 ETH)
Account #1: 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 (10000000 ETH)
Account #2: 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC (10000000 ETH)
Account #3: 0x90F79bf6EB2c4f870365E785982E1f101E93b906 (10000000 ETH)
Account #4: 0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65 (10000000 ETH)