Configuring Hardhat for ICB
To deploy smart contracts to the ICB Network, you'll need to update your Hardhat project settings and include the ICB network configuration.
To do this, open your hardhat.config.ts
file and add the ICB network under the networks
section:
require("@nomicfoundation/hardhat-toolbox");
require("dotenv").config();
module.exports = {
solidity: {
version: "0.8.20",
settings: {
optimizer: {
enabled: true,
runs: 1000,
},
evmVersion: "paris",
},
},
networks: {
ICBTestnet: {
url: "https://rpc1-testnet.icbnetwork.info",
chainId: 73114,
accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : [],
},
ICBMainnet: {
url: "https://rpc2-mainnet.icbnetwork.info",
chainId: 73115,
accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : [],
},
},
};
Installing Hardhat Toolbox
The configuration relies on the @nomicfoundation/hardhat-toolbox plugin, which conveniently bundles essential packages and plugins commonly used in Hardhat development.
To install it, run the following command:
npm install --save-dev @nomicfoundation/hardhat-toolbox
Managing Environment Variables
The configuration also utilizes the dotenv package to securely load the PRIVATE_KEY
environment variable from a .env
file into process.env.PRIVATE_KEY
. This approach helps keep your private keys out of your source code and version control.
To install dotenv, run the following command:
npm install --save-dev dotenv
Last updated