submit verification proof to verifier services (blockchain explorer, sourcify...
npm install @rocketh/verifierContract verification tool for Rocketh. Submit your deployed contracts for verification on Etherscan, Sourcify, Blockscout, and other verification services.
- ✅ Multi-Platform - Support for Etherscan, Sourcify, and Blockscout
- 🔧 CLI Tool - Easy-to-use command line interface
- 📦 Automatic Metadata - Uses deployment metadata for verification
- ⚙️ Configurable - Custom endpoints, API keys, and options
``bashUsing pnpm
pnpm add @rocketh/verifier
CLI Usage
The package provides a
rocketh-verify CLI command.$3
`bash
Basic usage
rocketh-verify -e mainnet etherscanWith custom options
rocketh-verify -e mainnet etherscan --license MIT --force-licenseWith custom endpoint (for Etherscan-compatible explorers)
rocketh-verify -e polygon etherscan --endpoint https://api.polygonscan.com/api
`$3
`bash
Basic usage
rocketh-verify -e mainnet sourcifyWith custom endpoint
rocketh-verify -e mainnet sourcify --endpoint https://sourcify.dev/server
`$3
`bash
Basic usage
rocketh-verify -e mainnet blockscoutWith custom endpoint
rocketh-verify -e gnosis blockscout --endpoint https://blockscout.com/xdai/mainnet/api
`$3
Export contract metadata for manual verification:
`bash
rocketh-verify -e mainnet metadata --out ./metadata
`CLI Options
$3
| Option | Description |
|--------|-------------|
|
-e, --environment | (Required) Environment/network name |
| -d, --deployments | Deployments folder path |$3
| Option | Description |
|--------|-------------|
|
--endpoint | Custom API endpoint |
| --license | Source code license (e.g., MIT, GPL-3.0) |
| --force-license | Force the specified license |
| --min-interval | Minimum interval between requests (ms) |
| --fix-mispell | Fix misspelled form fields (some APIs) |Environment Variable:
ETHERSCAN_API_KEY$3
| Option | Description |
|--------|-------------|
|
--endpoint | Custom Sourcify endpoint |
| --min-interval | Minimum interval between requests (ms) |$3
| Option | Description |
|--------|-------------|
|
--endpoint | Custom Blockscout API endpoint |
| --min-interval | Minimum interval between requests (ms) |Programmatic Usage
You can also use the verifier programmatically:
`typescript
import { run } from '@rocketh/verifier';await run(resolvedConfig, 'mainnet', {
verifier: {
type: 'etherscan',
apiKey: process.env.ETHERSCAN_API_KEY,
license: 'MIT',
},
deploymentNames: ['MyContract', 'MyToken'], // Optional: specific contracts
minInterval: 1000, // Optional: rate limiting
logErrorOnFailure: true,
});
`API Reference
$3
Runs the verification process.
Parameters:
-
config: ResolvedUserConfig - Resolved Rocketh configuration
- environmentName: string - Name of the environment (e.g., 'mainnet', 'sepolia')
- options: VerificationOptions - Verification options$3
`typescript
interface VerificationOptions {
verifier: EtherscanOptions | SourcifyOptions | BlockscoutOptions;
deploymentNames?: string[]; // Specific contracts to verify
minInterval?: number; // Rate limiting (ms between requests)
logErrorOnFailure?: boolean; // Log errors instead of throwing
}
`$3
`typescript
interface EtherscanOptions {
type: 'etherscan';
endpoint?: string; // Custom API endpoint
apiKey?: string; // Etherscan API key
license?: string; // SPDX license identifier
forceLicense?: boolean; // Override contract license
fixMispell?: boolean; // Fix API form field spelling
}
`$3
`typescript
interface SourcifyOptions {
type: 'sourcify';
endpoint?: string; // Custom Sourcify endpoint
}
`$3
`typescript
interface BlockscoutOptions {
type: 'blockscout';
endpoint?: string; // Custom Blockscout API endpoint
}
`Supported Networks
$3
The verifier automatically detects the correct Etherscan endpoint for common networks:
| Network | Chain ID | Endpoint |
|---------|----------|----------|
| Ethereum Mainnet | 1 | api.etherscan.io |
| Goerli | 5 | api-goerli.etherscan.io |
| Sepolia | 11155111 | api-sepolia.etherscan.io |
| Polygon | 137 | api.polygonscan.com |
| Arbitrum | 42161 | api.arbiscan.io |
| Optimism | 10 | api-optimistic.etherscan.io |
| Base | 8453 | api.basescan.org |
For other networks, use the
--endpoint option.$3
Sourcify supports all EVM chains. The default endpoint is
https://sourcify.dev/server.$3
Blockscout is self-hosted by many chains. Use the
--endpoint option to specify the correct API URL for your chain.Examples
$3
`bash
Set your API key
export ETHERSCAN_API_KEY=your-api-keyVerify all deployed contracts
rocketh-verify -e mainnet etherscan
`$3
`typescript
import { run } from '@rocketh/verifier';await run(config, 'mainnet', {
verifier: {
type: 'etherscan',
apiKey: process.env.ETHERSCAN_API_KEY,
},
deploymentNames: ['Token', 'TokenSale'], // Only verify these
});
`$3
`bash
Verify on Etherscan
rocketh-verify -e mainnet etherscanAlso verify on Sourcify for decentralized verification
rocketh-verify -e mainnet sourcify
`$3
`bash
rocketh-verify -d ./custom-deployments -e mainnet etherscan
`Troubleshooting
$3
This is not an error - it means the contract is already verified on the platform.
$3
Use
--min-interval to add delays between verification requests:`bash
rocketh-verify -e mainnet etherscan --min-interval 5000
`$3
Etherscan requires an API key. Get one at:
- Etherscan
- Polygonscan
- Arbiscan
$3
For Etherscan-compatible explorers, ensure you're using the correct API endpoint:
`bash
rocketh-verify -e bsc etherscan --endpoint https://api.bscscan.com/api
`Related Packages
rocketh - Core deployment environment
- @rocketh/node - Node.js deployment executor
- @rocketh/deploy` - Standard deployment functions