Skip to main content

Verify Smart Contract using Hardhat

Verifying a smart contract allows developers to review your code from within the CeloScan Block Explorer


Before the installation steps you need to have your hardhat project initialized using the command

npx hardhat init

Make sure to have dependencies installed!


Some initial installation and configuration is required.


Use the following command to install

npm i hardhat-celo --save-dev

Hardhat Configuration

Import the plugin in your hardhat.config.js:


Or if you are using TypeScript, in your hardhat.config.ts:

import "hardhat-celo";

Remove / Comment the import for @nomicfoundation/hardhat-toolbox

Add the following configuration to the config object in hardhat.config.js.

networks: {
alfajores: {
// can be replaced with the RPC url of your choice.
url: "",
accounts: [
celo: {
url: "",
accounts: [
etherscan: {
apiKey: {
alfajores: "<CELOSCAN_API_KEY>",

Verifying Contracts

Use the following command (Make sure your contracts are compiled before verification)

Alfajores Testnet

npx hardhat verify <CONTRACT_ADDRESS> <CONSTRUCTOR_ARGS> --network alfajores

Celo Mainnet

npx hardhat verify <CONTRACT_ADDRESS> <CONSTRUCTOR_ARGS> --network celo

Alternatively, You can read an in depth guide about how to deploy and verify contracts on Celo Block Explorer (sourcify) programmatically using the hardhat-deploy plugin here.