Verify on BaseScan
Verification uploads your Solidity source to BaseScan, letting anyone read the code and interact with the contract through BaseScan's Read/Write UI.
Why verify
Verified contracts show:
- Source code, formatted and searchable
- Read Contract tab — call view functions from the browser, no code needed
- Write Contract tab — send transactions via MetaMask on BaseScan directly
- Contract ABI publicly exposed for integrations
For a permissionless civil registry, verification is essentially mandatory — it's the difference between "public infrastructure" and "opaque addresses."
Get an Etherscan API key
The Etherscan V2 API unifies all 60+ chains (Ethereum, Base, Arbitrum, Optimism, etc.) under one key.
- Go to etherscan.io/myapikey
- Create a free account and a new API key
- Add to your
.env:
ETHERSCAN_API_KEY=YourKeyHereVerify
node --env-file=.env scripts/verify.mjsThe script reads addresses from deployments.json, compiles each contract with the exact same settings as the deploy (viaIR, optimizer, paris EVM), and submits via Etherscan V2 API.
Output shows submission → polling → result for each contract:
Verifying AgentRegistry at 0xe8a0...C54...
submitted — GUID: abc123
waiting.
✓ VERIFIED: https://sepolia.basescan.org/address/0xe8a0...C54#code
Verifying AgentMemory at 0x3057...0d47...
submitted — GUID: def456
waiting.
✓ VERIFIED: ...Typical time: 15-60 seconds per contract.
Override addresses
Override what's in deployments.json:
AGENT_REGISTRY_ADDRESS=0x... \
AGENT_MEMORY_ADDRESS=0x... \
AGENT_REPUTATION_ADDRESS=0x... \
CHAIN_ID=84532 \
node --env-file=.env scripts/verify.mjsCompile settings must match exactly
Verification compares the submitted source + compile settings against the deployed bytecode. If they produce different bytes, verification fails with a "bytecode mismatch" error.
The script uses these settings (matching compile.mjs):
- Compiler:
v0.8.24+commit.e11b9ed9 viaIR: true- Optimizer:
enabled: true, runs: 200 - EVM version:
paris
If you changed your compile config, update verify.mjs to match, or verify manually on BaseScan.
Manual verification (fallback)
If the script fails for any reason:
- Go to sepolia.basescan.org/verifyContract
- Enter the address
- Compiler type: Solidity (Standard JSON Input)
- Paste the exact JSON that
compile.mjsuses (or copy fromscripts/verify.mjs— thebuildStandardJsonfunction produces it) - Submit
For more depth on the V2 API: docs.etherscan.io/etherscan-v2.
What's next
- Reference: Contract functions — now that the source is public, here's what each function does