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

Was this helpful?

  1. Verify Smart Contract
  2. Verify Smart Contract

Verify through Foundry

PreviousVerify with SocialScan APINextVerify through Hardhat

Last updated 1 year ago

Was this helpful?

SocialScan supports verifying smart contracts through Foundry, please refer to for more information.

You must include the following args

contract_address

Your contract address to verify

contract_name

Your contract name to verify

compiler_version

Compiler version, e.g. v0.8.25+commit.b61c2a91

chain

Put your chain id (Not required)

verifier-url

verifier

Use "blockscout" or "etherscan"

etherscan-api-key

If you use "etherscan" as a verifier, you need to put a random string here

Example

# Compile your smart contract first
forge build

# Verify a flattened contract 
forge verify-contract <contract_address> <contract_name> \
--compiler-version <compiler_version> \
--flatten \
--verifier-url <api_host>/v1/explorer/command_api/contract \
--verifier blockscout

# Verify a contract with JSON standard input
forge verify-contract \
<contract_address> <contract_name> \
--watch \
--compiler-version <compiler_version> \
--constructor-args $(cast abi-encode "constructor(string,string)" "TEST" "ST2") \
--verifier-url <api_host>/v1/explorer/command_api/contract \
--verifier blockscout

# Verify a contract use "etherscan" verifier
forge verify-contract \
<contract_address> <contract_name> \
--chain <chain_id> \
--watch --etherscan-api-key test \
--verifier-url <api_host>/v1/explorer/command_api/contract \
--verifier etherscan

# Expected output
Start verifying contract `<contract_address>` deployed on <chain_name>

Submitting verification for [<contract_name>] <contract_address>.
Submitted contract for verification:
        Response: `Contract successfully verified`
        GUID: `a40a619266ea0d581e6373c52754e4a4ef6333bc8581b9d2a02d6174b3316f39`
        URL: <explorer_host>/address/<contract_address>
Contract verification status:
Response: `OK`
Details: `Pass - Verified`
Contract successfully verified

<api_host>

API Host: <chain_name>/

🗳️
https://book.getfoundry.sh/reference/forge/forge-verify-contract
/v1/explorer/command_api/contract
https://api.socialscan.io/