Get Started
1) Install Hardhat
If you are starting from scratch, create an npm project by going to an empty folder, runningnpm init, and following the instructions. Recommend npm 7 or higher.
Once your project is ready:
npm instructions
2) Create a project
Runnpx hardhat in your project folder and follow the instructions to create (more info here).
3) Install plugin
Install the hardhat-verify plugin npm@hh2 tag above — plain npm install @nomicfoundation/hardhat-verify now installs v3 (Hardhat 3), which uses a different config format entirely.
4) Add plugin reference to config file
Add the following statement to yourhardhat.config.js.
hardhat.config.ts. More info on using typescript with hardhat available here.
Config File and Unsupported Networks
Your basic Hardhat config file (hardhat.config.js or hardhat.config.ts) will be setup to support the network you are working on. In this example we use the Optimism Sepolia test network and a .ts file.
Here we add an RPC url without an API key, however some value is still required. You can use any arbitrary string. More info.
In order to use Blockscout explorer for the verification, you have to specify the explorer details under a customChains object. It includes:
chainId- Network chain IDapiURL- Block explorer API URLbrowserURL- Block explorer URL
Find an extensive list of ChainIDs at https://chainlist.org/.
customChains must match the network name in the apiKey object.
Verifying on multiple chains?
If you deploy to more than one network, you don’t need a separate config block per chain. Define your chains once in an array and generatenetworks, etherscan.apiKey, and customChains from it:
Run
npx hardhat verify --list-networks at any time to confirm which network identifiers are registered in your config.Deploy and Verify
For deployment we will use Hardhat Ignition - built-in Hardhat deployment system.Deploy
Verify
The plugin requires you to include constructor arguments with the verify task and ensures that they correspond to expected ABI signature. However, Blockscout ignores those arguments, so you may specify any values that correspond to the ABI.CHAINS array — just swap --network optimism-sepolia for --network base, --network arbitrum-one, etc.
Automatically verified contracts
Sometimes the contract may be automatically verified via Ethereum Bytecode Database service. In that case you may see the following response:--force flag*.
It prevents Hardhat from checking if the contract is already verified, and force it to send verification request anyway. Notice, that it is helpful only if the contract was automatically verified partially. That way, a new verification sources would be saved. If the contract was fully verified already, that just returns an error.
- The flag is available starting from
@nomicfoundation/hardhat-verify@2.0.7
Confirm Verification on BlockScout
Go to your BlockScout instance and paste the contract address into the search bar.



Video example
Community video created by Carlos Rodriguez for the Soneium Minato testnet, but can be applicable to any chain.FAQ
I am using an OpenZeppelin upgrades plugin implementation and receive an error on proxy contract verification. What should I do?
I am using an OpenZeppelin upgrades plugin implementation and receive an error on proxy contract verification. What should I do?
Although you receive an error, the contracts should be verified during the previous steps and you can ignore. Check in the explorer to make sure the contracts have been verified.
Do I need a real API key for each chain?
Do I need a real API key for each chain?
No. Blockscout doesn’t require a valid API key for verification through this per-instance route — any non-empty string works. Each network still needs its own entry in the
apiKey object, since the network name in customChains must match a key in apiKey.Why not use the Pro API or Blockscout's native verification API here?
Why not use the Pro API or Blockscout's native verification API here?
Blockscout’s separate native verification API (REST endpoints under
/api/v2/smart-contracts/{address}/verification/via/...) is structurally incompatible with hardhat-verify, which only knows how to build Etherscan-shaped requests — so it can’t be dropped into this plugin without a custom script. Per-instance is the confirmed working path until one of those is sorted out with Nomic Foundation.Resources
Learn more about plugin configs, troubleshooting etc. at https://hardhat.org/hardhat-runner/plugins/nomicfoundation-hardhat-verify