Why Verify Contracts?
- Transparency: Users can inspect contract source code
- Trust: Verification proves deployed bytecode matches public source
- Interaction: Block explorers provide UI for contract interaction
- Debugging: Easier to debug transactions with verified contracts
- Integration: Required for some integration tools and services
Automated Verification
Using Verification Script
The easiest way to verify all deployed contracts:- Read deployment data from CSV file
- Load verification API keys from configuration
- Verify each contract on its respective block explorer
- Retry failed verifications automatically
- Provide detailed verification summary
Prerequisites for Automated Verification
1
Deployment Results File
Ensure Expected format:
RESULTS_FILE exists with deployment data:2
Configure Verification Keys
Create verification keys file or set environment variable:Option 1: JSON FileOption 2: Environment Variable
verification-keys.json
3
Set Environment Variables
.env
Verification Script Features
Automatic Header Removal- Detects and removes CSV headers before processing
- Retries failed verifications with 5-second delay
- Useful for rate limiting or temporary explorer issues
- Uses chain data for more reliable verification
- Falls back to explorer defaults if not available
- Shows verification progress (e.g., “2 of 5”)
- Provides summary statistics at end
- Automatically includes constructor args from deployment data
- Handles contracts with no constructor args
Manual Verification
Verify Using Forge
Verify a single contract manually:Verification Flags Explained
Constructor Arguments
For contracts with constructor parameters, you need to provide ABI-encoded arguments. HyperProver ConstructorBlock Explorer API Keys
Obtaining API Keys
Get free API keys from block explorers:1
Ethereum (Etherscan)
- Visit Etherscan API
- Create an account
- Generate API key
- Same key works for Sepolia testnet
2
Base (Basescan)
- Visit Basescan API
- Create account (separate from Etherscan)
- Generate API key
3
Optimism
- Visit Optimistic Etherscan
- Create account
- Generate API key
4
Arbitrum
- Visit Arbiscan
- Create account
- Generate API key
Supported Block Explorers
Verification Status
Check Verification Status
Verify a contract was successfully verified:- ✅ Verified contract source code
- Compiler version
- Optimization settings
- Contract ABI
- Constructor arguments
Verification Success Indicators
In Script Output- Green checkmark next to contract
- “Contract Source Code Verified” message
- Readable source code tabs
- Read/Write Contract interface available
Troubleshooting
Already Verified Error
If contract is already verified:- Re-running verification script
- Contracts deployed with same bytecode
Invalid API Key
- Verify API key is correct in
.envor verification keys file - Check API key is for the correct network (Etherscan vs Basescan)
- Ensure API key is activated (check email for verification link)
Constructor Arguments Mismatch
- Extract constructor args from deployment CSV:
- Verify args match deployment transaction
- Check ABI encoding is correct
Rate Limiting
- Wait 5-10 seconds between verifications
- Use
--slowflag in deployment to add delays - Upgrade to premium API key for higher limits
- Verification script includes automatic retry with delay
Compiler Settings Mismatch
foundry.toml matches deployment:
foundry.toml
Verification Timeout
- Increase timeout with
--timeout 300(5 minutes) - Retry verification after a few minutes
- Check if block explorer is experiencing issues
- Use
--watchflag to wait for completion
Contract Not Found
- Wait a few blocks for explorer to index the contract
- Verify contract address is correct
- Check transaction was successful
- Ensure contract was deployed on the correct network
Advanced Verification
Verify with Standard JSON Input
For complex build configurations:Verify via Sourcify
Sourcify provides decentralized contract verification:Multi-Chain Verification Tracking
Track verification across multiple chains:Verification Best Practices
1
Verify Immediately After Deployment
Verify contracts as soon as deployment completes to ensure accuracy.
2
Use Automated Scripts
Use
verifyRoutes.sh for consistent, repeatable verification.3
Keep Deployment Records
Maintain deployment CSV files for verification and auditing.
4
Verify on Multiple Explorers
Verify on both Etherscan-based and Sourcify for broader coverage.
5
Document Verification Links
Share verification links with users and integrators.
Next Steps
Integration Guide
Integrate verified contracts into your application
Testing
Test deployed and verified contracts