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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.icb.network/build-on-icb-network/hardhat/configuring-hardhat-for-icb.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
