Skip to main content
After deploying your contract, verify it on the block explorer to make the source code publicly available and enable users to interact with it.

Block Explorers

Testnet (DuKong)

Mainnet

Using Hardhat

Hardhat Verify Plugin

Install the verification plugin:
npm install --save-dev @nomicfoundation/hardhat-verify
Add to hardhat.config.js:
require("@nomicfoundation/hardhat-verify");

module.exports = {
  // ... other config
  etherscan: {
    apiKey: {
      mantra_testnet: "your-api-key", // Not always required
    },
    customChains: [
      {
        network: "mantra_testnet",
        chainId: 5887,
        urls: {
          apiURL: "https://explorer.dukong.io/api",
          browserURL: "https://explorer.dukong.io"
        }
      }
    ]
  }
};
Verify your contract:
npx hardhat verify --network mantra_testnet <CONTRACT_ADDRESS> <CONSTRUCTOR_ARGS>

Using Foundry

Forge Verify

forge verify-contract <CONTRACT_ADDRESS> \
  src/MyContract.sol:MyContract \
  --chain-id 5887 \
  --etherscan-api-key <API_KEY> \
  --constructor-args <CONSTRUCTOR_ARGS>

Manual Verification

  1. Go to the block explorer
  2. Navigate to your contract address
  3. Click “Verify and Publish”
  4. Fill in the verification form:
    • Compiler version
    • Optimization settings
    • Source code
    • Constructor arguments (if any)

Verification Requirements

  • Contract source code
  • Compiler version used
  • Optimization settings
  • Constructor arguments (if applicable)
  • Contract address

Next Steps