Foundry Verification
Foundry is a smart contract development toolchain. Foundry manages your dependencies, compiles your project, runs tests, deploys, and lets you interact with the chain from the command line and via Solidity scripts.
Forge is a command-line tool that ships with Foundry. Forge tests, builds, and deploys your smart contracts. Forge supports contract verification out of the box (https://book.getfoundry.sh/reference/forge/forge-verify-contract)
Verify contract
In forge, contracts can be verified at the time of the deployment (e.g. using forge script
), or later, if the contracts are already deployed (e.g. using forge verify-contract
).
Tips:
Specify the
βverifier=blockscout
flag to use the Blockscout verification provider. API key for Blockscout verification is optional.Specify the
--verifier-url=<blockscout_homepage_explorer_url>/api/
flag for connecting to a specific Blockscout instance (e.g.,--verifier-url=https://eth-sepolia.blockscout.com/api/
).You can specify most configuration options (e.g., evm version, disabling optimizations) via the usual Forge configuration (see https://github.com/foundry-rs/foundry/blob/master/config/README.md).
Example (Deploy and verify)
Verify a contract with Blockscout right after deployment (make sure you add "/api/" to the end of the Blockscout homepage explorer URL):
Or if using foundry scripts:
Example (Verify already deployed contract)
Or if using foundry scripts for last executed script run:
Last updated