Contract Verification

Hardhat: Verify Your Contracts with Hardhat-Cronoscan plugin

After you deploy your ERC20 Contract successfully, the next is to verify the source code for your Solidity contracts. The Hardhat-Cronoscan plugin aims to make it easy for smart contract developers to verify the smart contracts on Cronoscan from the Hardhat development environment.
This plugin adds the Cronos network to the verify task provided by Hardhat-Etherscan. With this plugin, the verify task is able to verify Cronos contracts through Cronoscan's service.

Step 1. Install the package

We need the Hardhat plugin for integration with Cronoscan's contract verification service. This plugin needs to be used in conjunction with the Hardhat-Etherscan plugin (v3.1.0 or above).
# Install hardhat-etherscan plugin
npm install --save-dev @nomiclabs/[email protected]^3.1.0
# Install hardhat-cronoscan plugin
npm install --save-dev @cronos-labs/hardhat-cronoscan
And make sure you also have the following dependencies:
npm install ethers dotenv @openzeppelin/contracts
npm install --save-dev solidity-coverage
npm install --save-dev hardhat-gas-reporter

Step 2. Import the plugins

Under Hardhat, add the following statement to your hardhat.config.ts:
import "@nomiclabs/hardhat";
import "@nomiclabs/hardhat-etherscan";
import "@cronos-labs/hardhat-cronoscan";

Step 3. Define your Cronoscan API key

In your project's hardhat.config.js, append to your existing configurations. Replace {YOUR_CRONOSCAN_API_KEY}with your Cronoscan API key.
If you don’t have a Cronoscan API KEY, you will need to create a Cronoscan account first. After you log in to the Cronoscan account, you will be able to generate it at API-KEY page. Cronoscan Testnet shares the same API key as Cronoscan Mainnet, but it is recommended to generate a new one on the Cronoscan portal and replace {YOUR_CRONOSCAN_TESTNET_API_KEY} with it. One Cronoscan allows creating three API KEYs.
Update the settings as below under hardhat.config.ts
const config: HardhatUserConfig = {
solidity: "version",
networks: {
hardhat: {},
cronosTestnet: {
url: "",
chainId: 338,
accounts: ['myPrivateKey'],
gasPrice: 5000000000000,
cronos: {
url: "",
chainId: 25,
accounts: ['myPrivateKey'],
gasPrice: 5000000000000,
etherscan: {
apiKey: {

Step 4. Check the supported network list:

Check the list of supported networks:
npx hardhat verify --list-networks

Step 5. Verify the Smart Contract

Obtain your deployed contract address when you deployed the contract (Step 8 in the previous section).
In your hardhat project, run the verify task as shown below. Replace DEPLOYED_CONTRACT_ADDRESS with your deployed contract address, and the constructor arguments that were used to deploy it (if any):

Verify on Cronos (Mainnet):

npx hardhat verify --network cronos DEPLOYED_CONTRACT_ADDRESS "Constructor argument 1" "Constructor argument 2"

Verify on Cronos Testnet

npx hardhat verify --network cronosTestnet DEPLOYED_CONTRACT_ADDRESS "Constructor argument 1""Constructor argument 2"
npx hardhat verify --network cronosTestnet "0x00e9fd0eaea8325dc31a64e23d91607fdd60d2d1" "My token name" "My token symbol"
You should now be able to see your contact is verified on Cronoscan or Testnet Cronoscan and start to read and write your smart contracts.
Follow this link for a blog post with a more detailed step-by-step tutorial.