Why Verify Your Contract?
- ✅ Users can read your contract source code
- ✅ Builds trust and transparency
- ✅ Enables direct interaction on the explorer
- ✅ Required for many integrations
- ✅ Shows you’re a legitimate project
🎯 Benefits of Verification
Transparency
Users can read your contract code and verify what it does
Trust
Verified contracts are trusted by the community
Direct Interaction
Users can call functions directly on the block explorer
Integration Support
Many services require verified contracts
🔧 Verification Methods
- Hardhat (Recommended)
- Foundry
- Block Explorer (Manual)
- Flattened Source
Verify with Hardhat
The easiest and most reliable method for Hardhat users.Prerequisites
Step 1: Configure hardhat.config.js
hardhat.config.js
Step 2: Get API Key
Visit Block Explorer
Generate API Key
- Go to “My Profile” → “API Keys”
- Click “Add” to create new API key
- Copy the API key
Step 3: Verify Contract
Step 4: Verify Multi-File Contracts
If your contract imports multiple files:✅ Verify Verification Success
After submitting, check if your contract was verified:Visit Contract Page
Check for Green Checkmark
You should see:
- ✅ Green checkmark next to contract address
- “Contract” tab shows source code
- “Read Contract” and “Write Contract” tabs appear
🔧 Troubleshooting
'Compiler version mismatch' error
'Compiler version mismatch' error
The compiler version must match exactly.Solution:
'Bytecode does not match' error
'Bytecode does not match' error
The compiled bytecode doesn’t match the deployed bytecode.Possible reasons:
- Wrong compiler version
- Optimization settings don’t match
- Constructor arguments incorrect
- Wrong source code
'Invalid constructor arguments' error
'Invalid constructor arguments' error
Constructor arguments are not encoded correctly.Solution:
'Too many requests' error
'Too many requests' error
You’ve exceeded the API rate limit.Solution:
- Wait a few minutes before trying again
- If using Hardhat, it might be retrying automatically
- Contact support for higher rate limits
Verification stuck on 'Pending'
Verification stuck on 'Pending'
The verification is queued but taking a long time.Solution:
- Wait 5-10 minutes
- Check the explorer’s status page
- Try manual verification via UI
- Contact support if stuck for > 1 hour
'Already verified' but not showing
'Already verified' but not showing
Contract was verified but source code not visible.Solution:
- Clear browser cache
- Wait a few minutes for indexer to update
- Try accessing in incognito mode
- Contact support if persists
📊 Verification Best Practices
Verify Immediately
Verify your contract right after deployment while settings are fresh
Keep Records
Save compiler settings, constructor args, and verification commands
Test on Testnet
Practice verification on testnet before mainnet
Use Automation
Use Hardhat/Foundry auto-verification to avoid manual errors
📝 Verification Checklist
Before Deployment
- Know your compiler version
- Know your optimization settings
- Have constructor arguments ready
- Have API key from block explorer
During Deployment
- Save contract address
- Save transaction hash
- Save deployment command
- Note block number
🎯 After Verification
Once your contract is verified, users can:Read Source Code
Anyone can view and audit your contract code
Interact Directly
Users can call functions via the block explorer
Verify Security
Security researchers can audit your code
Trust Your Project
Verified contracts build user confidence
💡 Pro Tips
🎯 Next Steps
Integrate with Frontend
Connect your verified contract to a dApp
Deploy Another Contract
Deploy and verify more contracts
Write Documentation
Document your contract functions for users
Get Security Audit
Consider professional audit for production contracts
Contract verified? Now integrate it with your frontend →