How to Verify Smart Contracts
Last updated
Last updated
A contract source code could be verify after successfully deployed to BounceBit network , At the moment , to verify the source code ,it supports BounceBit explorer(bbscan.io) and hardhat verify plugin.
The simplest way to verify your source code is via the bbscan.io UI. This process does not require any programming skills.
Step 1. Head to bbscan.io, select the network for the contract to verify (support both for Testnet and Mainnet):
Step 2. Navigate to the 'Verify Contract' page through the submenu of Blockchain tab on the menu bar.
Step 3. Insert the contract Address and upload metadata.json file, then click the verify contract button at bottom of the page. The verification process may fail if there are any mismatches between the smart contract and the upload files.
Step 4. You will then be able to view the verification results. The outcome can either be a success or a failure. The verification process may fail if there are any mismatches between the smart contract and the uploaded files.
Step 5. Verified contract details could be viewed by clicking the View the Contract, or navigate to the contract detail page by searching the contract address.
To verify contract with hardhat verify plugin, in short, all steps are:
Setup config.
Flatten contract (skip if there's only one solidity file with no external dependencies).
Verify contract by verify plugin.
Step 1. Setup config
First, install the plugin:
Shell
And add the following statement to your hardhat.config.js
:
JavaScript
Then, add the following networks, etherscan and sourcify configs to your hardhat.config.js
file:
JavaScript
Step 2. Flatten contract
If the contract contains more than one file, or it imports external dependencies, Hardhat comes with a built-in flatten task that lets you combine the source code of multiple Solidity files so the contract could be verify by hardhat-verify plugin.
Shell
The flattened contract need to be successful compiled in your contract project by hardhat. Then we are ready for the next step.
Step3. Verify contract
Run the command:
Shell
Run npx hardhat help verify
more details about verify plugin
The verification process takes seconds to minutes. If contract is successfully verified, you should see :
Done!