Verifying Contracts
On subnets.avax.network
To verify a contract using the official subnets.avax.network
explorer, utilize the Verifying Contracts Tool (opens in a new tab) available on avax.network.
Follow these steps for verification:
- Choose Beam for the subnet.
- Input the contract address of the desired contract for verification.
- Select and upload all your contract files.
- Once every file is uploaded, initiate the verification by clicking Submit Verification.
For verifying a contract on the Beam testnet, refer to the Verifying Contracts Tool (Testnet) (opens in a new tab).
From the command line
The Beam explorer uses Sourcify (opens in a new tab) for contract verification. There are plugins and integrations for different smart contract development environments available. For more information, see the Sourcify documentation (opens in a new tab) on contract verification.
Hardhat
If you're using hardhat-deploy (opens in a new tab) to deploy your contracts, verification with Sourcify is supported natively. Simply run this command from your project directory to verify all deployed contracts:
hardhat --network beam sourcify
For any other Hardhat project, you could use the plugin hardhat-sourcify (opens in a new tab) and verify them one by one:
hardhat --network beam verify-sourcify --contract "MyFirstContract" --address 0x12345...
hardhat --network beam verify-sourcify --contract "MySecondContract" --address 0x23456...
For all available options, check out the plugin's documentation (opens in a new tab) or run hardhat help verify-sourcify
.
Foundry
Foundry (opens in a new tab) supports Sourcify out of the box.
- To verify a contract immediately after deploying it, add the
--verify --verification-provider sourcify
flags to your Foundry deploy command. - To verify an existing, already deployed contract, run:
forge verify-contract 0x12345... MyFirstContract --chain-id 4337 --verifier sourcify
Truffle
When deploying contracts with Truffle, you can install truffle-plugin-verify (opens in a new tab) and use it like this:
truffle run verify MyFirstContract MySecondContract --network beam