bootstrap or apply, you can use the verify command to verify the source code on block explorers like Etherscan or Blockscout. The command uses the forge verify-contract binary, which automatically handles constructor argument detection and source code verification.
Usage
You can call theverify command like this:
CLI Arguments
--l1-rpc-url
Defines the RPC URL of the L1 chain to deploy to (currently only supports mainnet and sepolia).
--input-file
The full filepath to the input file. This can be either:
- A simple JSON file with contract name/address pairs (output from
bootstrap superchain|implementations) - A complete
state.jsonfile (output fromapply)
--contract-name flag is passed, all contracts in the input file will be verified.
Example:
--contract-name (optional)
Specifies a single contract name, matching a contract key within the input file, to verify. If not provided, all contracts in the input file will be verified.
--artifacts-locator
The locator to forge-artifacts containing the output of the forge build command (i.e. compiled bytecode and solidity source code). This can be a local path (with a file:// prefix), remote URL (with a http:// or https:// prefix), or standard contracts tag (with a tag://op-contracts/v prefix).
--verifier
The block explorer(s) to use for verification. Supports multiple verifiers separated by commas.
Options:
etherscan(default): Uses Etherscan for mainnet/sepoliablockscout: Uses default Blockscout URLs for mainnet/sepoliacustom: For custom Etherscan v2-compatible instances (requires--verifier-url)
- Single verifier:
--verifier etherscan - Multiple verifiers:
--verifier etherscan,blockscout(verifies on both)
--verifier-url
The verifier API URL. Usage varies by verifier type:
etherscan: Ignored (automatically determined from chain ID)blockscout: Optional (defaults to standard Blockscout URLs for mainnet/sepolia)custom: Required. Example:https://etherscanv2.compat-api.example.com/api
Output
Output logs will be printed to the console and look something like the following. If the final results shownumFailed=0, all contracts were verified successfully.
Automatic Verification
You can automatically verify contracts after deployment by using the--verify flag with apply or bootstrap commands:
Multi-Verifier Deployment
You can verify on multiple block explorers simultaneously:- Deploy the superchain contracts
- Verify on Etherscan (using the API key)
- Verify on Blockscout (no API key required)
- Report combined results from both verifiers
Supported Contract Bundles
The verify command now supports all contract bundles:- Superchain contracts (from
bootstrap superchain) - Implementations contracts (from
bootstrap implementations) - OpChain contracts (from
apply- including all chain-specific contracts)
state.json file from apply, the verifier automatically extracts and verifies contracts from all deployment stages.