SocialScan Explorer API
  • Introduction
  • 🎯API ENDPOINTS
    • Accounts
    • Contracts
    • Transactions
    • Blocks
    • Logs
    • Tokens
    • Stats
  • 🗳️Verify Smart Contract
    • Verify Smart Contract
      • Verify with SocialScan UI
      • Verify with SocialScan API
      • Verify through Foundry
      • Verify through Hardhat
  • 🤝SUPPORT
    • FAQ
    • Rate Limits
    • Common Error Messages
    • Getting Help
Powered by GitBook
On this page
  • Setup custom chain config
  • Verify with Hardhat

Was this helpful?

  1. Verify Smart Contract
  2. Verify Smart Contract

Verify through Hardhat

Setup custom chain config

Add the following content to your hardhat.config.js file

chain_name

Unique name slug of your chain

chain_id

Put your chain id

rpc_endpoint

Your chain's rpc endpoint

api_host

socialscan_explorer_url

https://<chain_name>.socialscan.io

require("@nomicfoundation/hardhat-toolbox");
// the account's private key
const PRIVATE_KEY = "<your_private_key>";

/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
  solidity: "0.8.9",
  defaultNetwork: "<chain_name>",
  networks: {
    hardhat: {
    },
    <chain_name>: {
      url: `<rpc_endpoint>`,
      accounts: [PRIVATE_KEY],
    },
  },
  etherscan: {
    customChains: [
      {
        network: "<chain_name>",
        chainId: <chain_id>,
        urls: {
          apiURL: "<api_host>/v1/explorer/command_api/contract",
          browserURL: "<socialscan_explorer_url>",
        },
      },
    ],
    apiKey: {
      <chain_name>: "Put a random string",
    },
  }
};

Verify with Hardhat

Make sure your chain_name is consistent with your config file

# Verify with Hardhat

npx hardhat verify --network <chain_name> <contract_address>

# Expected Output
Successfully submitted source code for contract
<contract_name> at <contract_address>
for verification on the block explorer. Waiting for verification result...

Successfully verified contract Token on the block explorer.
<socialscan_explorer_url>/address/<contract_address>#code
PreviousVerify through FoundryNextFAQ

Last updated 12 months ago

Was this helpful?

API Host: <chain_name>/

🗳️
https://api.socialscan.io/