Add support for generic block explorers
Describe the feature
Originally requested in #6905.
We should add support for generic block explorers that implement the Etherscan v1 API, optionally using an API key. The explorer mentioned in the original request is Oklink, but there may be others as well. A brief investigation is recommended to identify and prioritize the most relevant ones for support.
Search terms
No response
Hi, blockscout-based explorers also need it
Hi @ericlee42, Blockscout-based explorers should already work, as the plugin supports them. Is there a specific scenario that isn’t working as expected?
@schaable I've gotten the solution.
etherscan: {
enabled: false,
},
blockscout: {
enabled: true,
But it's not handy, I have to set etherscan.enabled to false to use blockscout mode.
Can you team add a flag for them, e.g. hardhat verify --blockscout or hardhat verify —verifier=blockscout
Another example is routescan.io that implements the Etherscan API, without a key
Hi @ericlee42, Blockscout-based explorers should already work, as the plugin supports them. Is there a specific scenario that isn’t working as expected?
I am validating in blockscout with customChains. I also specify a dummy apiKey value. My config worked until I upgraded to Hardhat v2.2.5.0 from 2.24.3. Now I get this warning when I verify:
[WARNING] Network and explorer-specific api keys are deprecated in favour of the new Etherscan v2 api. Support for v1 is expected to end by May 31st, 2025. To migrate, please specify a single Etherscan.io api key the apiKey config value.
The verification is successful, but the warning is a bit ugly and confusing. Is there any way to get rid of this warning when verifying in blockscout?
@schaable I've gotten the solution.
etherscan: { enabled: false, }, blockscout: { enabled: true,But it's not handy, I have to set
etherscan.enabledto false to use blockscout mode.Can you team add a flag for them, e.g.
hardhat verify --blockscoutorhardhat verify —verifier=blockscout
Where does this go in your hardhat config? Do you have an example?
@schaable I've gotten the solution.
etherscan: { enabled: false, }, blockscout: { enabled: true,But it's not handy, I have to set
etherscan.enabledto false to use blockscout mode. Can you team add a flag for them, e.g.hardhat verify --blockscoutorhardhat verify —verifier=blockscoutWhere does this go in your hardhat config? Do you have an example?
This is the config for the Hardhat 3 Alpha.
Have you updated to the latest version of hardhat-verify it added support for Etherscan API v2: https://github.com/NomicFoundation/hardhat/releases/tag/%40nomicfoundation%2Fhardhat-verify%402.0.14
@schaable I've gotten the solution.
etherscan: { enabled: false, }, blockscout: { enabled: true,But it's not handy, I have to set
etherscan.enabledto false to use blockscout mode. Can you team add a flag for them, e.g.hardhat verify --blockscoutorhardhat verify —verifier=blockscoutWhere does this go in your hardhat config? Do you have an example?
This is the config for the Hardhat 3 Alpha.
Have you updated to the latest version of
hardhat-verifyit added support for Etherscan API v2: https://github.com/NomicFoundation/hardhat/releases/tag/%40nomicfoundation%2Fhardhat-verify%402.0.14
I'm not on V3, so I guess that config won't fork. I'm on v2.2.5.0. That is the latest version of V2 with latest versions of all @nomicfoundation/hardhat-toolbox plugins. To try to solve the warning issue, I have created a brand new v2.25.0 project.
But I'm verifying against blockscout, not Etherscan. I just want to do that without this warning.
@schaable I've gotten the solution.
etherscan: { enabled: false, }, blockscout: { enabled: true,But it's not handy, I have to set
etherscan.enabledto false to use blockscout mode.Can you team add a flag for them, e.g.
hardhat verify --blockscoutorhardhat verify —verifier=blockscout
You definitely don't need to do that in v3: npx hardhat verify blockscout ... should do the trick.
Resolved by Hardhat 3
PSA: @nomicfoundation/[email protected] now works out of the box with all the chains officially supported by Etherscan, Blockscout, and Sourcify.