Verify with Hardhat
Hardhat is a smart contracts development tool, perfect if you're familiar with Javascript/Typescript.
If you've yet to setup Hardhat, here's the official guide, 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
API keys from any other explorer (such as BscScan/Basescan/Arbiscan) have been deprecated ⚠️
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.
This open source integration was shipped by @antico5 and the Hardhat team 🙌
Last updated