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.

Verify via bbscan.io

The simplest way to verify your source code is via the bbscan.io UI. This process does not require any programming skills.

A Step-by-step Tutorial

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.

Verify via Hardhat verify plugin

To verify contract with hardhat verify plugin, in short, all steps are:

  1. Setup config.
  2. Flatten contract (skip if there's only one solidity file with no external dependencies).
  3. Verify contract by verify plugin.

Step 1. Setup config

First, install the plugin:

npm install --save-dev @nomicfoundation/hardhat-verify

And add the following statement to your hardhat.config.js:


Then, add the following networks, etherscan and sourcify configs to your hardhat.config.js file:

module.exports = {
  networks: {
    bbtestnet: {
      chainId: 6000,
      url: "https://fullnode-testnet.bouncebitapi.com"
    bbmainnet: {
      chainId: 6001,
      url: "https://fullnode-mainnet.bouncebitapi.com/"
  etherscan: {
    enabled: false 
  sourcify: {
    enabled: true,
    apiUrl: "https://sourcify-api.bbscan.io"

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.

#all the Solidity files in your project will be combined
npx hardhat flatten > contracts/flattened.sol 

#or, specifc a path to the contract file to flatten(the file which contains compile target):
npx hardhat flatten contracts/Foo.sol > contracts/flattened.sol

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:

npx hardhat verify --network bbtestnet --contract contracts/flattened.sol:Foo <0xTheContractAddress>

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 :

Successfully verified contract Token on Sourcify.