Skip to main content

Smart contracts source code verification

Verifying contracts makes their source code publicly available on block explorers like Etherscan or Immutable's Explorer.

It's important to note that verifying your contract's code is different from verifying an asset contract with Immutable. See the verification step in our deploy smart contracts guide for details on verifying gaming assets.

Verify on Immutable's Explorer (Blockscout)

To verify your contract on Immutable's Immutable's Explorer follow these steps:

  1. Deploy your smart contract to Immutable's zkEVM mainnet or testent
  2. Go to the following Immutable's Explorer pages for each environment:
  1. Follow Blockscout's verification guide to verify your contract.

Verify on Etherscan

To verify your contract, you will need an Etherscan API key, which you can get from signing up on their website. Then you can add the API key to your Hardhat config file like so:

etherscan: {
apiKey: <etherscan API key>,
},

You can then run the hardhat verify task, passing the address of the contract, the network where it's deployed, and the constructor arguments that were used to deploy it (if any):

npx hardhat verify --network mainnet DEPLOYED_CONTRACT_ADDRESS "Constructor argument 1"

If your contract has multiple constructor arguments like the preset ERC721, you will need to save your constructor arguments to a separate file like arguments.js in the root directory as so:

module.exports = [
'string argument', // string arguments
50, // numerical arguments
{ x: 10, y: 5 }, // struct arguments
'0xabcdef', // bytes arguments
'0x123567', // address arguments
];

The verification command then becomes:

npx hardhat verify --network mainnet DEPLOYED_CONTRACT_ADDRESS --constructor-args arguments.js
💡Other verification guides
See Hardhat docs for more information and other ways to verify your contract.