> 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/deploying-the-smart-contract.md).

# Deploying the Smart Contract

&#x20;         After successfully compiling your contract, you can proceed to deploy it to the **ICB Testnet**.

&#x20;         To do so, update the `ignition/modules/Counter.js` file in your project with the necessary deployment logic:

```js
const { buildModule } = require("@nomicfoundation/hardhat-ignition/modules");

module.exports = buildModule("CounterModule", (m) => {
  const initialNumber = m.getParameter("initialNumber", 0);

  const counter = m.contract("Counter", []);

  if (initialNumber !== 0) {
    m.call(counter, "setNumber", [initialNumber]);
  }

  return { counter };
});
```

&#x20;         You'll also need to have **testnet ICBT** or **ICBX tokens** in your wallet. If you haven't obtained them yet, refer to the [Prerequisites](https://app.gitbook.com/o/jGflGFSUbio8Lp3Wxw6k/s/NGHmFVO7DlELOLs4PSVs/~/changes/81/build-on-icb-network/hardhat/prerequisites/~/page) section. Without sufficient funds, the deployment will not succeed!

&#x20;         Once ready, execute the following command to deploy your Counter contract:

## ICB Mainnet &#x20;

```bash
npx hardhat ignition deploy ./ignition/modules/Counter.js --network ICBMainnet
```

<figure><img src="https://1670530031-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNGHmFVO7DlELOLs4PSVs%2Fuploads%2FUmxhTupe8PAFB2e2GgVw%2FScreenshot%20from%202025-08-21%2000-14-08.png?alt=media&amp;token=a627f0dd-ac17-4a55-b9ee-ee27a47b37bb" alt=""><figcaption></figcaption></figure>

## ICB Testnet

<figure><img src="https://1670530031-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNGHmFVO7DlELOLs4PSVs%2Fuploads%2F4xngDn9C24YKowSMCiOG%2FScreenshot%20from%202025-08-21%2000-12-40.png?alt=media&amp;token=06fb6e4c-bd3d-44d4-918c-31e709c1be78" alt=""><figcaption></figcaption></figure>

&#x20;         The contract will be deployed to either the **ICB Mainnet** or **ICB Testnet**, depending on the network specified in your deployment command.

&#x20;         Once deployed, you can check the status and details of the contract using the appropriate block explorer — [**ICBScan Mainnet** ](https://icbscan.io/)or [**ICBScan Testnet**.](https://testnet.icbscan.io/) Simply search for the contract address returned by your deploy script.

&#x20;         To interact with your contract via the block explorer, it must first be **verified** — either by you or someone else. Since the contract provided above is already verified, you should be able to view and interact with your deployed version right away.
