Bitgert Blockchain Documentation
  • BRISE Chain Documentation
    • Getting Started
    • Become a validator
    • Contributing
    • BRISE Chain Explorers
    • Genesis File
    • Consensus
    • Introduction
  • Wallets
  • For Developers
    • Network Status Monitoring Guideline
    • Proxy Contract
    • Local Brise Chain Network
    • Deploy NFT
    • RPC
    • BRISE Chain Relayer
    • BRISE Chain Full Node Documentation
    • Wallet Providers
    • Verify Proxy Contract
    • Hardhat Verify
    • Truffle Verify
    • Deploy on Truffle
    • Deploy on Remix IDE
    • Smart Contract Tools
    • Create Wallet
Powered by GitBook
On this page
  • Verify with Hardhat
  • Install the plugin
  • Configure the plugin in buidler.config.js
  • Verify
  1. For Developers

Hardhat Verify

PreviousVerify Proxy ContractNextTruffle Verify

Last updated 1 year ago

Verify with Hardhat

Hardhat has an Etherscan plugin:

Note: Hardhat was previously Buidler.

Install the plugin

npm install --save-dev @nomiclabs/hardhat-etherscan

Configure the plugin in buidler.config.js

  • Add require("@nomiclabs/hardhat-etherscan");

  • Add Bscscan API key

Warning

keep secret and don’t commit to version control)

Go to register and get API key:

  • Set compiler version to match what was deployed

// hardhat.config.js
const { mnemonic, bscscanApiKey } = require('./secrets.json');

require('@nomiclabs/hardhat-ethers');
require("@nomiclabs/hardhat-etherscan");
/**
 * @type import('hardhat/config').HardhatUserConfig
 */
module.exports = {

  networks: {
    testnet: {
      url: `https://testnet-rpc.brisescan.com`,
      accounts: {mnemonic: mnemonic}
    },
    mainnet: {
      url: `https://nc-dataseed.brisescan.com/`,
      accounts: {mnemonic: mnemonic}
    }
  },

  etherscan: {
    // Your API key for Etherscan
    // Obtain one at https://testnet-explorer.brisescan.com/
    apiKey: bscscanApiKey
  },
  solidity: "0.5.12"
};

Verify

Warning

Remove any unnecessary contracts and clear the artifacts otherwise these will also be part of the verified contract.

Run the following command:

npx buidler verify --network mainnet DEPLOYED_CONTRACT_ADDRESS "Constructor argument 1"
  • Example

$ npx hardhat  verify --network testnet 0xbF39886B4F91F5170934191b0d96Dd277147FBB2
Nothing to compile
Compiling 1 file with 0.5.16
Successfully submitted source code for contract
contracts/BRC20Token.sol:BRC20Token at 0xbF39886B4F91F5170934191b0d96Dd277147FBB2
for verification on Etherscan. Waiting for verification result...

Successfully verified contract BRC20Token on Etherscan.
https://testnet-explorer.brisescan.com/address/0xbF39886B4F91F5170934191b0d96Dd277147FBB2#code

Hardhat Etherscan plugin
https://testnet-explorer.brisescan.com/myapikey