Verify contract code with Hardhat in B² Explorer
Install plugin
npm install --save-dev @nomicfoundation/hardhat-verifyAnd add the following statement to your hardhat.config.js:
require("@nomicfoundation/hardhat-verify");Or, if you are using TypeScript, add this to your hardhat.config.ts:
import "@nomicfoundation/hardhat-verify";
Config hardhat.config.js or hardhat.config.ts
module.exports = {
solidity: "0.8.28",
networks: {
b2: {
url: "https://rpc.bsquared.network",
chainId: 223,
accounts: "abc",
},
},
etherscan: {
apiKey: {
b2: "no-api-key",
},
customChains: [
{
network: "b2",
chainId: 223,
urls: {
apiURL: "https://12d6a1773a-backend-blockscout.bsquared.network/api/",
browserURL: "https://explorer.bsquared.network",
},
},
],
},
sourcify: {
enabled: false,
},
}Verify
Assuming we have deployed the Locker contract B² Network address details for 0xc1189535d0De120b5DeA3704BEa0e29af0715433 | Blockscout
We can use the following cli to verify
For more features, please refer to
Reference
Last updated