📔
Seitrace
  • Introduction
  • Sei Network
  • EVM <> Wasm interoperability
    • Pointer contracts
    • Associated accounts
    • Associated transactions
  • Insights (APIs)
    • Introduction
    • Activating free trial package
    • Purchasing an Insights Package
    • Create your API keys
    • Insights (APIs) docs
  • BROWSING THE SITE
    • Homepage
    • Search bar
    • Transactions
    • Validators
    • Proposals
    • IBC Relayers
    • Blocks
    • Top Accounts
    • Account details
    • Verified contracts
    • Contract details
  • Assets
    • Fungible tokens
      • Tokens
      • Tokens details
    • Non-fungible tokens (NFT)
      • Collections
      • Collection details
      • NFT details
  • Verify contract
    • Verify contract (EVM)
      • Seitrace UI
      • Hardhat Verification Plugin
      • Custom ABI
      • API for EVM Contract verification
    • Interacting with Smart Contracts
  • Profile
    • My account
    • Watch list and Private Tags
  • Earnings
    • Listing new earnings
  • Coming soon
    • Custom ABI
    • Code ID (Native SEI)
    • Charts & stats
    • Verify Contract (Cosmos)
    • Public tags
    • Token info
  • Contact Us
    • Twitter (X)
Powered by GitBook
On this page
  • Get started
  • Config File
  • Deploy and Verify
  • Confirm Verification on Seitrace
  1. Verify contract
  2. Verify contract (EVM)

Hardhat Verification Plugin

Hardhat is a full-featured development environment for contract compilation, deployment and verification. The Hardhat Verification Plugin supports contract verification on Seitrace.

PreviousSeitrace UINextCustom ABI

Last updated 8 months ago

Get started

  1. Install Hardhat

    If you are starting from scratch, create an npm project by going to an empty folder, running npm init, and following the instructions. Recommend npm 7 or higher.

    Once your project is ready:

    npm instructions

    npm install --save-dev hardhat

    yarn instructions

    yarn add --dev hardhat
  2. Create a project

    Run npx hardhat in your project folder and follow the instructions to create ().

  3. Install plugin

    Install the (requires v3.0.0+).

    npm

    npm install --save-dev @nomiclabs/hardhat-etherscan

    yarn

    yarn add --dev @nomiclabs/hardhat-etherscan
  4. Add plugin reference to config file

    Add the following statement to your hardhat.config.js.

    require("@nomiclabs/hardhat-etherscan");

    If using TypeScript, add this to your hardhat.config.ts. .

    import "@nomiclabs/hardhat-etherscan";

Config File

import dotenv from "dotenv";
import { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";
import "tsconfig-paths/register";
import "@openzeppelin/hardhat-upgrades";

/**
 * Config dotenv first
 */
dotenv.config();

/**
 * Default hardhat configs
 */
const config: HardhatUserConfig = {
  solidity: {
    compilers: [
      {
        version: "0.8.20",
        settings: {
          optimizer: {
            enabled: true,
            runs: 200,
          },
        },
      },
    ],
  },
};

/**
 * Extract env vars
 */
const privateKey = process.env.PRIVATE_KEY || "";

/**
 * If private key is available, attach network configs
 */
if (privateKey) {
  config.networks = {
    sei_arctic_1: {
      url: "https://evm-rpc.arctic-1.seinetwork.io/",
      chainId: 713715,
      accounts: [privateKey],
      gas: "auto",
      gasPrice: "auto",
    },
  };
}

/**
 * Load etherscan key
 */
const seitraceKey = process.env.SEITRACE_KEY || "";

if (seitraceKey) {
  config.etherscan = {
    apiKey: {
      sei_arctic_1: seitraceKey,
    },
    customChains: [
      {
        network: "sei_arctic_1",
        chainId: 713715,
        urls: {
          apiURL: "https://seitrace.com/arctic-1/api",
          browserURL: "https://seitrace.com"
        }
      },
    ],
  };
}

export default config;

apiURL:

Set up env. file

PRIVATE_KEY="4c1a9ffd2dce9ed5b5f464c6b6a38efceb051855d123c9e6aeec751c35762d91"
SEITRACE_KEY="can-be-any-string"
  • PRIVATE_KEY: Wallet private key

  • SEITRACE_KEY: You can also use a random string

Deploy and Verify

Deploy

npx hardhat run .\scripts\<path>\deploy.multicall.ts --network sei_arctic_1

Verify

npx hardhat verify --network sei_arctic_1 <contract_address> "Constructor argument"

example

PS D:\verify-contract> npx hardhat verify --network sei_arctic_1 0xaa338AbfB92e7476596D4cCb98b29700BDcA2a6E "0xc99259dE8f9ec4cd443C0CF5D45D547c513E03be"
Successfully submitted source code for contract
contracts/VuNFT721.sol:VuSEI721 at 0xaa338AbfB92e7476596D4cCb98b29700BDcA2a6E
for verification on the block explorer. Waiting for verification result...

Successfully verified contract VuSEI721 on the block explorer.
https://seitrace.com/address/0xaa338AbfB92e7476596D4cCb98b29700BDcA2a6E#code

Confirm Verification on Seitrace

Your basic (hardhat.config.js or hardhat.config.ts) will be setup to support the network you are working on. In this example we use the Sokol test network and a .js file.

Here we add an RPC url without an API key, however some value is still required. You can use any arbitrary string. .

If you prefer, you can migrate to to use a plugin bundle.

arctic-1:

pacific-1:

atlantic-2:

more info here
hardhat-etherscan plugin
More info on using typescript with hardhat available here
Hardhat config file
More info
hardhat-toolbox
https://seitrace.com/arctic-1/api
https://seitrace.com/pacific-1/api
https://seitrace.com/atlantic-2/api