Verify contract code with Hardhat in Blockscout
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 = {
networks{
b2testnet: {
url: 'https://b2testnet-rpc.bsquared.network',
chainId: 1123,
accounts: {
mnemonic: process.env.MNEMONIC,
path: "m/44'/60'/0'/0",
initialIndex: 0,
count: 20,
},
},
},
etherscan: {
apiKey: {
b2testnet: "abc"
},
customChains: [
{
network: "b2testnet",
chainId: 1123,
urls: {
apiURL: "https://b2-testnet.alt.technology/",
browserURL: "https://testnet-blockscout.bsquared.network/"
}
},
}
]
},Verify
Assuming we have deployed the Counter contract B² Network address details for 0xbcd2B61F456CB5D07bEf2B0eD5f5B9D5ED84C1c6 | Blockscout
We can use the following cli to verify
For more features, please refer to
Reference
Last updated