Skip to main content

Verify a smart contract on Monad Explorer using Foundry

Once your contract is deployed to a live network, the next step is to verify its source code on the block explorer.

Verifying a contract means uploading its source code, along with the settings used to compile the code, to a repository (typically maintained by a block explorer). This allows anyone to compile it and compare the generated bytecode with what is deployed on chain. Doing this is extremely important in an open platform like Monad.

In this guide we'll explain how to do this on MonadExplorer using Foundry.

If you are using foundry-monad template, you can simply run the below command:

forge verify-contract \
<contract_address> \
<contract_name> \
--chain 10143 \
--verifier sourcify \
--verifier-url https://sourcify-api-monad.blockvision.org

Example:

forge verify-contract \
0x195B9401D1BF64D4D4FFbEecD10aE8c41bEBA453 \
src/Counter.sol:Counter \
--chain 10143 \
--verifier sourcify \
--verifier-url https://sourcify-api-monad.blockvision.org

On successful verification of smart contract, you should get a similar output in your terminal:

Start verifying contract `0x195B9401D1BF64D4D4FFbEecD10aE8c41bEBA453` deployed on 10143

Submitting verification for [Counter] "0x195B9401D1BF64D4D4FFbEecD10aE8c41bEBA453".
Contract successfully verified

Now check the contract on Monad Explorer.