LogoLogo
HomeMetadata APIAPI PROTwitter
Etherscan V2
Etherscan V2
  • Introduction
  • Getting an API Key
  • Rate Limits
  • V1 to V2 API Migration Guide
  • ✨Getting Started
    • Creating an Account
    • Supported Chains
    • Supported Endpoints
  • 🎯API Endpoints
    • Nametags
    • Accounts
    • Contracts
    • Transactions
    • Blocks
    • Logs
    • Geth/Parity Proxy
    • Tokens
    • Gas Tracker
    • Stats
    • L2 Deposits/Withdrawals
    • Usage
  • 🏆API PRO
    • Etherscan API PRO
    • Metadata/Name Tag API
  • 🍳Cookbook
    • Track Uniswap V4 DEX Trades
  • Get An Address's Full Transaction History
  • ✅Contract Verification
    • Verify with Foundry
    • Verify with Hardhat
    • Verify with Remix
  • Common Verification Errors
  • 🤝Support
    • FAQ
    • Legacy V1 Docs
    • Checking Usage
    • Common Error Messages
    • Getting Help
  • Visit Etherscan.io
Powered by GitBook
On this page
  • Install
  • Config
  • Deploy and Verify
  • Verify an Existing Contract
  • Migrating from V1
  1. Contract Verification

Verify with Hardhat

PreviousVerify with FoundryNextVerify with Remix

Last updated 1 day ago

Make sure you've updated to , see migrating notes if you have an existing project

is a smart contracts development tool, perfect if you're familiar with Javascript/Typescript.

If you've yet to setup Hardhat, here's the , the following steps are to setup the verification plugin.

Install

Via npm

npm i @nomicfoundation/hardhat-verify                               

Config

In hardhat.config.ts, import the plugin

import "@nomicfoundation/hardhat-verify";

Add your Etherscan key

config: HardhatUserConfig = {
  solidity: "0.8.28",
  networks: {
    sepolia: {
      url: `https://1rpc.io/sepolia`,
      accounts: [SEPOLIA_PRIVATE_KEY],
    },
  },
   etherscan: {
    apiKey: "YourEtherscanApiKey"
  }
};

Deploy and Verify

npx hardhat ignition deploy ./ignition/modules/Lock.ts --network sepolia --verify

Verify an Existing Contract

npx hardhat verify --network sepolia 0xdCBdBAA8404554502B433106e62728B659aCfE3b

Migrating from V1

This change largely affects the hardhat.config.ts file — good riddance to the long customChains entries for each explorer.

Update your config to a single Etherscan apiKey entry as per above.

API keys from any other explorer (such as BscScan/Basescan/Arbiscan) have been deprecated

This open source integration was shipped by and the Hardhat team

✅
⚠️
@nomicfoundation/hardhat-verify@^2.0.14
Hardhat
official guide
🙌
@antico5