LogoLogo
HomeAPI PROTwitter
Etherscan V2
Etherscan V2
  • Introduction
  • Getting an API Key
  • Rate Limits
  • Supported Chains
  • V1 to V2 API Migration Guide
  • 🔍Use Cases
    • Accounting/Taxes
  • 🎯API Endpoints
    • Nametags
    • Accounts
    • Contracts
    • Transactions
    • Blocks
    • Logs
    • Geth/Parity Proxy
    • Tokens
    • Gas Tracker
    • Stats
    • L2 Deposits/Withdrawals
    • Usage
  • 🏆API PRO
    • Etherscan API PRO
  • 🍳Cookbook
    • Track Uniswap V4 DEX Trades
  • Get An Address's Full Transaction History
  • ✅Contract Verification
    • Verify with Foundry
    • Verify with Hardhat
    • Verify with Remix
  • Common Verification Errors
  • 🤝Support
    • FAQ
    • Legacy V1 Docs
    • Checking Usage
    • Common Error Messages
    • Getting Help
  • Visit Etherscan.io
Powered by GitBook
On this page
  1. ✅Contract Verification

Verify with Foundry

PreviousGet An Address's Full Transaction HistoryNextVerify with Hardhat

Last updated 2 months ago

CtrlK
  • Deploy and Verify
  • Verify an Existing Contract
  • Migrating from V1

You must update to the nightly build of Foundry to use this at the moment, via foundryup --install nightly

Foundry is a tool that helps take the heat off smart contract development steps 🔥, including compiling, deploying and finally submitting your contract for verification.

Deploy and Verify

forge create --broadcast --rpc-url https://rpc.sepolia.ethpandaops.io --private-key YourPrivateKey src/ContractFile.sol:ContractName --verify --verifier etherscan --etherscan-api-key YourApiKeyToken

Verify an Existing Contract

forge verify-contract --watch --chain sepolia 0x324eca20b358b18e48f2611f7452560ce3b3c1bb src/ContractFile.sol:ContractName --verifier etherscan --etherscan-api-key YourApiKeyToken

Migrating from V1

API keys from any other explorer (such as BscScan/Basescan/Arbiscan) have been deprecated ⚠️

The easiest way to migrate is to simply pass in your Etherscan key via --etherscan-api-key

For deployment scripts, in foundry.toml you can shorten your settings to this, without needing a different key for each chain.

etherscan_api_key = "VZFDUWB3YGQ1YCDKTCU1D6DDSS6EWI62KV"

[etherscan]
mainnet   = { key = "${ETHERSCAN_API_KEY}" } 

This open source integration was shipped by @iainnash and the Foundry team 🙌