# Verify on Other Blockchains (Same Etherscan API Key)

Etherscan API V2 uses one API key for all supported chains. This repo uses `ETHERSCAN_API_KEY` in .env for every chain.

## V2 endpoint

All verification uses: `https://api.etherscan.io/v2/api?chainid=<chainId>&apikey=...`  
The plugin sends the correct chainId from the Hardhat network.

## Networks and verify command

| Network   | Chain ID | Verify --network | Explorer |
|----------|----------|-------------------|----------|
| Mainnet  | 1        | mainnet           | etherscan.io |
| Sepolia  | 11155111 | sepolia           | sepolia.etherscan.io |
| BSC      | 56       | bsc               | bscscan.com |
| Polygon  | 137      | polygon           | polygonscan.com |
| Gnosis   | 100      | gnosis            | gnosisscan.io |
| Optimism | 10       | optimism          | optimistic.etherscan.io |
| Base     | 8453     | base              | basescan.org |
| Arbitrum | 42161    | arbitrum          | arbiscan.io |
| Avalanche| 43114    | avalanche         | snowtrace.io |

Cronos (25) is not in Etherscan V2 supported chains; use Cronoscan if needed.

**Status:** CCIPLogger on **mainnet** is already verified. CCIPLogger on **other chains** (BSC, Polygon, etc.) can be verified after deployment and once addresses are set in .env.

## Prerequisite: deploy and set .env

1. Deploy CCIPLogger to each chain (optional):  
   `./scripts/deployment/deploy-ccip-logger-all-chains.sh`  
   Or per chain: `NETWORK=bsc npx hardhat run scripts/ccip-deployment/deploy-ccip-logger-multichain.js --network bsc`
2. Add to `.env` for each deployed chain:

| Network   | Logger address (.env)     | Router (.env)        |
|-----------|----------------------------|----------------------|
| BSC       | `CCIP_LOGGER_BSC`          | `CCIP_BSC_ROUTER`    |
| Polygon   | `CCIP_LOGGER_POLYGON`      | `CCIP_POLYGON_ROUTER`|
| Gnosis    | `CCIP_LOGGER_GNOSIS`       | `CCIP_GNOSIS_ROUTER` |
| Optimism  | `CCIP_LOGGER_OPTIMISM`     | `CCIP_OPTIMISM_ROUTER` |
| Base      | `CCIP_LOGGER_BASE`         | `CCIP_BASE_ROUTER`   |
| Arbitrum  | `CCIP_LOGGER_ARBITRUM`     | `CCIP_ARBITRUM_ROUTER` |
| Avalanche | `CCIP_LOGGER_AVALANCHE`    | `CCIP_AVALANCHE_ROUTER` |

(Cronos: use `CCIP_LOGGER_CRONOS` and `CCIP_CRONOS_ROUTER` for deployment only; verification is on Cronoscan, not Etherscan V2.)

## Verify CCIPLogger on other chains

**Option A – script (recommended)**  
From repo root (`smom-dbis-138`):

```bash
./scripts/deployment/verify-ccip-logger-other-chains.sh
```

The script reads `CCIP_LOGGER_*` and `CCIP_*_ROUTER` from .env and runs Hardhat verify for each chain that has both set. Requires `ETHERSCAN_API_KEY` and `PRIVATE_KEY` in .env.

**Option B – manual (per chain)**  
Constructor args: `(address router, address authorizedSigner, uint64 expectedSourceChainSelector)` with `authorizedSigner = 0x0000...0000` and source chain selector `138`.

```bash
# Example: BSC (replace with your deployed address and router from .env)
npx hardhat verify --network bsc <CCIP_LOGGER_BSC> "<CCIP_BSC_ROUTER>" "0x0000000000000000000000000000000000000000" 138
```

Same pattern for polygon, gnosis, optimism, base, arbitrum, avalanche. Ref: `deploy-ccip-logger-multichain.js`, docs.etherscan.io/v2-migration.

## Run result (no other-chain deployments yet)

Running `verify-ccip-logger-other-chains.sh` with current .env: **0 verified, 7 skipped** (no `CCIP_LOGGER_BSC`, `CCIP_LOGGER_POLYGON`, etc. in .env). After deploying CCIPLogger to BSC/Polygon/etc. and setting the corresponding `CCIP_LOGGER_*` and `CCIP_*_ROUTER` in .env, re-run the script to verify on those chains.
