Why Verify Contracts?
- Transparency - Users can audit contract logic before interacting
- Trust - Verified code proves the deployed bytecode matches the source
- Debugging - Verified contracts show decoded function calls and events
- Integration - Tools like Etherscan can show function interfaces for verified contracts
Verification is especially important for upgradeable contracts, as users need to inspect both proxy and implementation contracts.
EVM Contract Verification
Across supports verification on Etherscan, block explorer APIs, and Sourcify.Foundry Verification (Recommended)
Foundry’s built-in verification is the simplest method:--verify flag automatically submits contract source code to Etherscan after deployment.
Required Environment Variables
Set API keys for block explorer verification:foundry.toml configures endpoints:
Manual Verification
If automatic verification fails, verify manually:Generate standard JSON input
Forge can generate the Solidity standard JSON input required by Etherscan:
Hardhat Verification (Legacy)
For Hardhat deployments, use the Etherscan plugin:--license AGPL-3.0- Specifies the license (contracts use BUSL-1.1 unless excepted)--force-license- Forces license even if it differs from source code comments--solc-input- Uses Solidity standard JSON input for verification
Across contracts are licensed under BUSL-1.1. Individual exceptions may be made by Risk Labs. Contact [email protected] for derivative work licensing.
Verifying Proxy Contracts
UUPS proxies require verifying both proxy and implementation:Sourcify Verification
Sourceify provides decentralized verification:- Chains not supported by Etherscan
- Additional decentralized verification
- IPFS-pinned source code
Solana/SVM Program Verification
Solana usessolana-verify for program verification with reproducible builds.
Prerequisites
Installsolana-verify:
Environment Setup
Verification Process
Verify locally
First, verify that your local build matches the on-chain program:This performs a Docker-based reproducible build and compares the hash to the deployed program.
Generate upload transaction
After local verification succeeds, create a transaction to upload verification data on-chain:This generates a base58-encoded transaction.
Execute via Squads multisig
Import the transaction into Squads:
- Go to Squads → Transactions → Import Transaction
- Paste the base58 transaction
- All required signers approve
- Execute the transaction
Verifying All Programs
Repeat the process for each Across program:Verification Best Practices
For EVM Contracts
- Verify immediately after deployment - Reduces the window where unverified contracts exist
- Use
--verifyflag - Automatic verification during deployment is more reliable - Verify on multiple explorers - Use both Etherscan and Sourcify for redundancy
- Check constructor arguments - Ensure constructor args are correctly encoded
- Verify both proxy and implementation - Don’t forget to verify implementation contracts
- Document verification - Note verification status in deployment records
For Solana Programs
- Use verified builds - Always deploy from
yarn build-svm-solana-verifyfor production - Verify before announcing - Don’t announce deployments until verification is complete
- Document build environment - Note Solana version and build image in deployment docs
- Check PDA funding - Ensure multisig has SOL before attempting on-chain upload
- Verify IDL too - Ensure IDL matches the deployed program
For Solana, reproducible builds are critical. Never deploy programs built locally without Docker verification.
Troubleshooting
Etherscan verification fails
Issue: “Compilation error” or “Bytecode mismatch” Solutions:- Verify compiler version matches (0.8.30)
- Check optimizer settings match
foundry.toml(runs=800, via_ir=true) - Ensure constructor arguments are correctly encoded
- Try manual verification with standard JSON input
Sourcify verification fails
Issue: “Metadata hash mismatch” Solutions:- Ensure you’re using
use_literal_content = trueinfoundry.toml - Rebuild with
forge clean && forge build - Check that all source files match exactly (no local modifications)
Solana verification fails locally
Issue: “Hash mismatch” duringverify-from-repo
Solutions:
- Ensure you built with
yarn build-svm-solana-verify(Docker build) - Check Solana version matches:
$SOLANA_VERSIONmust match deployed program’s SDK version - Verify you’re checking out the correct git commit/tag
- Clear build cache:
rm -rf target/and rebuild
Solana on-chain upload fails
Issue: Transaction fails duringexport-pda-tx execution
Solutions:
- Check multisig vault SOL balance
- Verify
--uploaderaddress is the vault, not the multisig itself - Ensure Squads has permission to spend from vault
- Try with higher compute units if transaction times out
Verification Checklist
Before marking deployment as complete:- Implementation verified on primary block explorer
- Proxy verified (if applicable)
- Sourcify verification submitted (EVM)
- Local verification succeeded (Solana)
- On-chain verification PDA created (Solana)
- OtterSec submission completed (Solana mainnet)
- Verification links documented in deployment records
- Multiple explorers show verified status
Verification Resources
EVM Resources
Solana Resources
Next Steps
- Return to deployment guide to deploy new contracts
- Learn about contract upgrades to update verified contracts
- Explore contract architecture to understand what you’re verifying