Verify contract code with Hardhat in Explorer
Last updated
Last updated
This section is a guide on how to verify a smart contract on the B² Network using . Hardhat is a popular smart contract development frameworks. It is used in the B² rollup as a default for deploying and automatically verifying smart contracts.
Run the following command in the command line to install the hardhat-verify plugin: npm install --save-dev @nomicfoundation/hardhat-verify
Compile your smart contract using Hardhat by running the following command: npx hardhat compile
Deploy your smart contract using Hardhat as you normally would.
Run the following command to verify your smart contract: npx hardhat verify --network B2Mainnet CONTRACT_ADDRESS "Constructor argument 1" "Constructor argument 2" ...
Replace CONTRACT_ADDRESS
with the address of your deployed contract. If your contract has constructor arguments, include them after the contract address.
After running the verification command, you will receive a verification request ID. You can use this ID to check the status of your verification on the block explorer.