Using Hardhat

Guide on deploying a smart contract on DuckChain using Hardhat, a popular framework for deploying and verifying smart contracts.

Initial Setup:

  1. Get some test TON from the DuckChain testnet faucet.

  2. Install Hardhat and its dependencies:

    npm install --save-dev ethers hardhat @nomiclabs/hardhat-waffle ethereum-waffle chai @nomiclabs/hardhat-ethers dotenv
  3. Initialize the project:

    npx hardhat init
  4. Open hardhat.config.js and add the following:

    require("dotenv").config();
    require("@nomicfoundation/hardhat-toolbox");
    
    module.exports = {
      solidity: "0.8.9",
      paths: {
        artifacts: "./src",
      },
      networks: {
        DuckChainTestnet: {
          url: `https://testnet-rpc.duckchain.io`,
          accounts: [process.env.ACCOUNT_PRIVATE_KEY],
        },
      },
    };

Add Contract Code and Deployment Script:

  1. Create Storage.sol in the contracts folder with the following code:

  2. Create a deployment script deploy-storage.js:

  3. Install Hardhat toolbox if not already installed:

  4. Compile and deploy the contract:

Last updated