> For the complete documentation index, see [llms.txt](https://docs.icb.network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.icb.network/build-on-icb-network/hardhat/configuring-hardhat-for-icb.md).

# Configuring Hardhat for ICB

&#x20;         To deploy smart contracts to the ICB Network, you'll need to update your Hardhat project settings and include the ICB network configuration.

&#x20;         To do this, open your `hardhat.config.ts` file and add the ICB network under the `networks` section:

```js
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

&#x20;         The configuration relies on the **@nomicfoundation/hardhat-toolbox** plugin, which conveniently bundles essential packages and plugins commonly used in Hardhat development.

&#x20;         To install it, run the following command:

```bash
npm install --save-dev @nomicfoundation/hardhat-toolbox
```

## Managing Environment Variables

&#x20;         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.

&#x20;         To install **dotenv**, run the following command:

```bash
npm install --save-dev dotenv
```
