Verifying Contracts
On subnets.avax.network
To verify a contract using the official subnets.avax.network
explorer, utilize the Verifying Contracts Tool 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).
From the command line
The Beam explorer uses Sourcify for contract verification. There are plugins and integrations for different smart contract development environments available. For more information, see the Sourcify documentation on contract verification.
Hardhat
If you’re using hardhat-deploy 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 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 or run hardhat help verify-sourcify
.
Foundry
Foundry 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 and use it like this:
truffle run verify MyFirstContract MySecondContract --network beam