> 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="/files/hErKrFIkH5z5BwwlrgKu" alt=""><figcaption></figcaption></figure>

## ICB Testnet

<figure><img src="/files/34mQ6Yer8MC3a32s3oSk" 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.
