Contract Verification
Where To Verify
Blast has a several block explorers to choose from. Which explorer you choose to spend the most time with is a matter of personal preference, but one common question from new builders is where do I verify my contracts?. Out of the available options, blastscan.io and blastexplorer.io are where most people verify their contracts, so that’s what we’d recommend.
The following guide will help you steer clear common issues while verifying your contracts with Foundry and Hardhat.
Do I Need An API Key?
Whether or not you need valid API key depends on (a) which network you’re using and (b) which API you’re targeting. Blastexplorer’s API will let you verify on testnet and mainnet without requiring a valid API key, but blastscan does require one when verifying on mainnet. You can get a blastscan API key by creating a free account here, and navigating to the “API-KEYs” section of your profile.
Explorer | Testnet | Mainnet |
---|---|---|
blastscan.io | no | yes |
blastexplorer.io | no | no |
forge
requires a value for the --etherscan-api-key
option even in cases where a valid API key is not required. Just use a placeholder here.
Verification Endpoints
Once you’ve decided where to verify, ensure that you are making your verification request to the correct API endpoint. In Hardhat, this “verification endpoint” is the apiUrl
specified in config; in Foundry, this is the --verifier-url
you’ll need to provide in your forge command:
blastscan | |
---|---|
Testnet | https://api-sepolia.blastscan.io/api |
Mainnet | https://api.blastscan.io/api |
blastexplorer | |
---|---|
Testnet | https://api.routescan.io/v2/network/testnet/evm/168587773/etherscan |
Mainnet | https://api.routescan.io/v2/network/mainnet/evm/81457/etherscan |
Verification Examples
Foundry
Use these examples, filling in appropriate values as discussed above, to verify your contracts during deployment using forge script
or to verify an existing deployment with forge verify-contract
.
Hardhat
Whether using hardhat-ignition-ethers
or hardhat-verify
, successful verification in Hardhat is primarily a matter of setting up your hardhat.config.ts
or hardhat.config.js
file correctly.
You’ll need to configure the networks
and etherscan
properties as demonstrated below. In order to specify the correct verification endpoint from the table above, you will also need to configure the etherscan.customChains
property.