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 using Monad Foundry.Documentation Index
Fetch the complete documentation index at: https://docs.monad.xyz/llms.txt
Use this file to discover all available pages before exploring further.
This guide assumes you have Monad Foundry installed. See the installation instructions if you haven’t set it up yet.
- Mainnet
- Testnet
- Foundry Monad template (Recommended)
- Default Foundry Project
The
foundry-monad template is configured for testnet by default. To use mainnet, update your foundry.toml file:- Change
eth-rpc-url="https://testnet-rpc.monad.xyz"to your mainnet RPC URL - Change
chain_id = 10143to143
foundry-monad template, you can use the commands below based on your preferred block explorer:- MonadVision
- Monadscan
- Socialscan
forge verify-contract \
<contract_address> \
<contract_name> \
--chain 143 \
--verifier sourcify \
--verifier-url https://sourcify-api-monad.blockvision.org/
forge verify-contract \
0x8fEc29BdEd7A618ab6E3CD945456A79163995769 \
Counter \
--chain 143 \
--verifier sourcify \
--verifier-url https://sourcify-api-monad.blockvision.org/
Start verifying contract `0x8fEc29BdEd7A618ab6E3CD945456A79163995769` deployed on monad-mainnet
Attempting to verify on Sourcify. Pass the --etherscan-api-key <API_KEY> to verify on Etherscan, or use the --verifier flag to verify on another provider.
Submitting verification for [Counter] "0x8fEc29BdEd7A618ab6E3CD945456A79163995769".
Contract successfully verified
forge verify-contract \
<contract_address> \
<contract_name> \
--chain 143 \
--verifier etherscan \
--etherscan-api-key YourApiKeyToken \
--watch
forge verify-contract \
0x8fEc29BdEd7A618ab6E3CD945456A79163995769 \
Counter \
--chain 143 \
--verifier etherscan \
--etherscan-api-key YourApiKeyToken \
--watch
Start verifying contract `0x8fEc29BdEd7A618ab6E3CD945456A79163995769` deployed on monad-mainnet
Submitting verification for [src/Counter.sol:Counter] 0x8fEc29BdEd7A618ab6E3CD945456A79163995769.
Submitted contract for verification:
Response: `OK`
GUID: `fhxxx4wsub68jce24ejvhe68fqabgtpmpzheqpdqvencgph1za`
URL: https://monadscan.com/address/0x8fec29bded7a618ab6e3cd945456a79163995769
Contract verification status:
Response: `NOTOK`
Details: `Pending in queue`
Warning: Verification is still pending...; waiting 15 seconds before trying again (7 tries remaining)
Contract verification status:
Response: `OK`
Details: `Pass - Verified`
Contract successfully verified
forge verify-contract \
<contract_address> \
<contract_name> \
--chain 143 \
--watch \
--etherscan-api-key <your_api_key> \
--verifier-url https://api.socialscan.io/monad-mainnet/v1/explorer/command_api/contract \
--verifier etherscan
forge verify-contract \
0x8fEc29BdEd7A618ab6E3CD945456A79163995769 \
Counter \
--chain 143 \
--watch \
--etherscan-api-key test \
--verifier-url https://api.socialscan.io/monad-mainnet/v1/explorer/command_api/contract \
--verifier etherscan
Start verifying contract `0x8fEc29BdEd7A618ab6E3CD945456A79163995769` deployed on monad-mainnet
Submitting verification for [src/Counter.sol:Counter] 0x8fEc29BdEd7A618ab6E3CD945456A79163995769.
Submitted contract for verification:
Response: `Contract successfully verified`
GUID: `33588004868f0677a3c23734da00fc42895a63542f61b1ed0dbfd2eb6893d7f4`
URL: https://monad.socialscan.io/address/0x8fec29bded7a618ab6e3cd945456a79163995769
Contract verification status:
Response: `OK`
Details: `Pass - Verified`
Contract successfully verified
1. Update foundry.toml with Monad Configuration
foundry.toml
[profile.default]
src = "src"
out = "out"
libs = ["lib"]
metadata = true
metadata_hash = "none" # disable ipfs
use_literal_content = true # use source code
# Monad Configuration
eth-rpc-url="https://rpc.monad.xyz"
chain_id = 143
2. Verify the contract using one of the following block explorers:
- MonadVision
- Monadscan
- Socialscan
If you are using MonadVision, you can use
this guide.
In particular, the Verify Contract
page provides a convenient way to verify your contract.
forge verify-contract \
<contract_address> \
<contract_name> \
--chain 143 \
--verifier sourcify \
--verifier-url https://sourcify-api-monad.blockvision.org/
forge verify-contract \
0x8fEc29BdEd7A618ab6E3CD945456A79163995769 \
Counter \
--chain 143 \
--verifier sourcify \
--verifier-url https://sourcify-api-monad.blockvision.org/
Start verifying contract `0x8fEc29BdEd7A618ab6E3CD945456A79163995769` deployed on monad-mainnet
Attempting to verify on Sourcify. Pass the --etherscan-api-key <API_KEY> to verify on Etherscan, or use the --verifier flag to verify on another provider.
Submitting verification for [Counter] "0x8fEc29BdEd7A618ab6E3CD945456A79163995769".
Contract successfully verified
forge verify-contract \
<contract_address> \
<contract_name> \
--chain 143 \
--verifier etherscan \
--etherscan-api-key YourApiKeyToken \
--watch
forge verify-contract \
0x8fEc29BdEd7A618ab6E3CD945456A79163995769 \
Counter \
--chain 143 \
--verifier etherscan \
--etherscan-api-key YourApiKeyToken \
--watch
Start verifying contract `0x8fEc29BdEd7A618ab6E3CD945456A79163995769` deployed on monad-mainnet
Submitting verification for [src/Counter.sol:Counter] 0x8fEc29BdEd7A618ab6E3CD945456A79163995769.
Submitted contract for verification:
Response: `OK`
GUID: `fhxxx4wsub68jce24ejvhe68fqabgtpmpzheqpdqvencgph1za`
URL: https://monadscan.com/address/0x8fec29bded7a618ab6e3cd945456a79163995769
Contract verification status:
Response: `NOTOK`
Details: `Pending in queue`
Warning: Verification is still pending...; waiting 15 seconds before trying again (7 tries remaining)
Contract verification status:
Response: `OK`
Details: `Pass - Verified`
Contract successfully verified
forge verify-contract \
<contract_address> \
<contract_name> \
--chain 143 \
--watch \
--etherscan-api-key <your_api_key> \
--verifier-url https://api.socialscan.io/monad-mainnet/v1/explorer/command_api/contract \
--verifier etherscan
forge verify-contract \
0x8fEc29BdEd7A618ab6E3CD945456A79163995769 \
Counter \
--chain 143 \
--watch \
--etherscan-api-key test \
--verifier-url https://api.socialscan.io/monad-mainnet/v1/explorer/command_api/contract \
--verifier etherscan
Start verifying contract `0x8fEc29BdEd7A618ab6E3CD945456A79163995769` deployed on monad-mainnet
Submitting verification for [src/Counter.sol:Counter] 0x8fEc29BdEd7A618ab6E3CD945456A79163995769.
Submitted contract for verification:
Response: `Contract successfully verified`
GUID: `33588004868f0677a3c23734da00fc42895a63542f61b1ed0dbfd2eb6893d7f4`
URL: https://monad.socialscan.io/address/0x8fec29bded7a618ab6e3cd945456a79163995769
Contract verification status:
Response: `OK`
Details: `Pass - Verified`
Contract successfully verified
- Foundry Monad template (Recommended)
- Default Foundry Project
If you are using Example:On successful verification of smart contract, you should get a similar output in your terminal:Now check the contract on MonadVision.Example:On successful verification of smart contract, you should get a similar output in your terminal:Now check the contract on Monadscan.Example:On successful verification of smart contract, you should get a similar output in your terminal:Now check the contract on Socialscan.
foundry-monad template, you can use the commands below based on your preferred block explorer:- MonadVision
- Monadscan
- Socialscan
forge verify-contract \
<contract_address> \
<contract_name> \
--chain 10143 \
--verifier sourcify \
--verifier-url https://sourcify-api-monad.blockvision.org/
forge verify-contract \
0x8fEc29BdEd7A618ab6E3CD945456A79163995769 \
Counter \
--chain 10143 \
--verifier sourcify \
--verifier-url https://sourcify-api-monad.blockvision.org/
Start verifying contract `0x8fEc29BdEd7A618ab6E3CD945456A79163995769` deployed on monad-testnet
Attempting to verify on Sourcify. Pass the --etherscan-api-key <API_KEY> to verify on Etherscan, or use the --verifier flag to verify on another provider.
Submitting verification for [Counter] "0x8fEc29BdEd7A618ab6E3CD945456A79163995769".
Contract successfully verified
forge verify-contract \
<contract_address> \
<contract_name> \
--chain 10143 \
--verifier etherscan \
--etherscan-api-key YourApiKeyToken \
--watch
forge verify-contract \
0x8fEc29BdEd7A618ab6E3CD945456A79163995769 \
Counter \
--chain 10143 \
--verifier etherscan \
--etherscan-api-key YourApiKeyToken \
--watch
Start verifying contract `0x8fEc29BdEd7A618ab6E3CD945456A79163995769` deployed on monad-testnet
Submitting verification for [src/Counter.sol:Counter] 0x8fEc29BdEd7A618ab6E3CD945456A79163995769.
Submitted contract for verification:
Response: `OK`
GUID: `fhxxx4wsub68jce24ejvhe68fqabgtpmpzheqpdqvencgph1za`
URL: https://testnet.monadscan.com/address/0x8fec29bded7a618ab6e3cd945456a79163995769
Contract verification status:
Response: `NOTOK`
Details: `Pending in queue`
Warning: Verification is still pending...; waiting 15 seconds before trying again (7 tries remaining)
Contract verification status:
Response: `OK`
Details: `Pass - Verified`
Contract successfully verified
forge verify-contract \
<contract_address> \
<contract_name> \
--chain 10143 \
--watch \
--etherscan-api-key <your_api_key> \
--verifier-url https://api.socialscan.io/monad-testnet/v1/explorer/command_api/contract \
--verifier etherscan
forge verify-contract \
0x8fEc29BdEd7A618ab6E3CD945456A79163995769 \
Counter \
--chain 10143 \
--watch \
--etherscan-api-key test \
--verifier-url https://api.socialscan.io/monad-testnet/v1/explorer/command_api/contract \
--verifier etherscan
Start verifying contract `0x8fEc29BdEd7A618ab6E3CD945456A79163995769` deployed on monad-testnet
Submitting verification for [src/Counter.sol:Counter] 0x8fEc29BdEd7A618ab6E3CD945456A79163995769.
Submitted contract for verification:
Response: `Contract successfully verified`
GUID: `33588004868f0677a3c23734da00fc42895a63542f61b1ed0dbfd2eb6893d7f4`
URL: https://api.socialscan.io/monad-testnet/v1/explorer/command_api/address/0x8fec29bded7a618ab6e3cd945456a79163995769
Contract verification status:
Response: `OK`
Details: `Pass - Verified`
Contract successfully verified
If you use
foundry-monad you can skip the configuration step1. Update foundry.toml with Monad Configuration
foundry.toml
[profile.default]
src = "src"
out = "out"
libs = ["lib"]
metadata = true
metadata_hash = "none" # disable ipfs
use_literal_content = true # use source code
# Monad Configuration
eth-rpc-url="https://testnet-rpc.monad.xyz"
chain_id = 10143
2. Verify the contract using one of the following block explorers:
- MonadVision
- Monadscan
- Socialscan
forge verify-contract \
<contract_address> \
<contract_name> \
--chain 10143 \
--verifier sourcify \
--verifier-url https://sourcify-api-monad.blockvision.org/
forge verify-contract \
0x8fEc29BdEd7A618ab6E3CD945456A79163995769 \
Counter \
--chain 10143 \
--verifier sourcify \
--verifier-url https://sourcify-api-monad.blockvision.org/
Start verifying contract `0x8fEc29BdEd7A618ab6E3CD945456A79163995769` deployed on monad-testnet
Attempting to verify on Sourcify. Pass the --etherscan-api-key <API_KEY> to verify on Etherscan, or use the --verifier flag to verify on another provider.
Submitting verification for [Counter] "0x8fEc29BdEd7A618ab6E3CD945456A79163995769".
Contract successfully verified
forge verify-contract \
<contract_address> \
<contract_name> \
--chain 10143 \
--verifier etherscan \
--etherscan-api-key YourApiKeyToken \
--watch
forge verify-contract \
0x8fEc29BdEd7A618ab6E3CD945456A79163995769 \
Counter \
--chain 10143 \
--verifier etherscan \
--etherscan-api-key YourApiKeyToken \
--watch
Start verifying contract `0x8fEc29BdEd7A618ab6E3CD945456A79163995769` deployed on monad-testnet
Submitting verification for [src/Counter.sol:Counter] 0x8fEc29BdEd7A618ab6E3CD945456A79163995769.
Submitted contract for verification:
Response: `OK`
GUID: `fhxxx4wsub68jce24ejvhe68fqabgtpmpzheqpdqvencgph1za`
URL: https://testnet.monadvision.com/address/0x8fec29bded7a618ab6e3cd945456a79163995769
Contract verification status:
Response: `NOTOK`
Details: `Pending in queue`
Warning: Verification is still pending...; waiting 15 seconds before trying again (7 tries remaining)
Contract verification status:
Response: `OK`
Details: `Pass - Verified`
Contract successfully verified
forge verify-contract \
<contract_address> \
<contract_name> \
--chain 10143 \
--watch \
--etherscan-api-key <your_api_key> \
--verifier-url https://api.socialscan.io/monad-testnet/v1/explorer/command_api/contract \
--verifier etherscan
forge verify-contract \
0x8fEc29BdEd7A618ab6E3CD945456A79163995769 \
Counter \
--chain 10143 \
--watch \
--etherscan-api-key test \
--verifier-url https://api.socialscan.io/monad-testnet/v1/explorer/command_api/contract \
--verifier etherscan
Start verifying contract `0x8fEc29BdEd7A618ab6E3CD945456A79163995769` deployed on monad-testnet
Submitting verification for [src/Counter.sol:Counter] 0x8fEc29BdEd7A618ab6E3CD945456A79163995769.
Submitted contract for verification:
Response: `Contract successfully verified`
GUID: `33588004868f0677a3c23734da00fc42895a63542f61b1ed0dbfd2eb6893d7f4`
URL: https://testnet.monadvision.com/address/0x8fec29bded7a618ab6e3cd945456a79163995769
Contract verification status:
Response: `OK`
Details: `Pass - Verified`
Contract successfully verified

