How to Verify Contracts
Contract verification allows others to view and interact with your contract source code on block explorers. This guide shows you how to verify contracts deployed with hardhat-deploy.
Prerequisites
Install the verification extension:
bash
npm install -D @rocketh/verifierbash
pnpm add -D @rocketh/verifierSupported Services
hardhat-deploy supports verification on:
- Etherscan (and compatible explorers like Polygonscan, BSCScan)
- Sourcify (decentralized verification)
- Blockscout (open-source explorer)
Basic Verification
Etherscan Verification
Set up your API key in environment variables:
bash
# .env
ETHERSCAN_API_KEY=your_etherscan_api_key_hereVerify all deployed contracts:
bash
pnpm rocketh-verify -e sepolia etherscanSourcify Verification
Sourcify doesn't require an API key:
bash
pnpm rocketh-verify -e sepolia sourcifyBlockscout Verification
For custom Blockscout instances:
bash
pnpm rocketh-verify -e sepolia blockscout --endpoint https://eth-sepolia.blockscout.com/api/v2Next Steps
- Export Deployments for Frontend to integrate with web applications