Add CCIP Networks for Cross-Chain Token Tutorials (Hardhat)
Guide Versions
This guide is available in multiple versions. Choose the one that matches your needs.
The smart-contract-examples repository includes default configurations for common CCIP testnet networks. This guide shows how to add support for additional networks.
Add a Network
Add the network configuration to config/networks.ts:
export const configData = {
// ... existing networks
optimismSepolia: {
chainFamily: "evm",
chainId: 11155420,
chainSelector: "5224473277236331295",
router: "0x114A20A10b43D4115e5aeef7345a1A71d2a60C57",
rmnProxy: "0xb40A3109075965cc09E93719e33E748abf680dAe",
tokenAdminRegistry: "0x1d702b1FA12F347f0921C722f9D9166F00DEB67A",
registryModuleOwnerCustom: "0x49c4ba01dc6F5090f9df43Ab8F79449Db91A0CBB",
link: "0xE4aB69C077896252FAFBD49EFD26B5D171A32410",
confirmations: 2,
nativeCurrencySymbol: "ETH",
},
}
Set the RPC URL:
npx env-enc set OPTIMISM_SEPOLIA_RPC_URL
The network is now available in all Hardhat tasks using --network optimismSepolia.
Environment variable naming: The system converts network names from camelCase to SNAKE_CASE and adds _RPC_URL. Examples: optimismSepolia → OPTIMISM_SEPOLIA_RPC_URL, avalancheFuji → AVALANCHE_FUJI_RPC_URL.
Configuration Fields
| Field | Required | Description | Source |
|---|---|---|---|
chainFamily | Yes | Blockchain VM type: "evm" for Ethereum-compatible chains, "svm" for Solana | config/types.ts |
chainId | Yes | EVM chain ID | Blockchain's official documentation (preferred) or ChainList |
chainSelector | Yes | CCIP identifier for the network | CCIP Directory |
router | Yes | CCIP Router contract address | CCIP Directory |
rmnProxy | Yes | RMN Proxy contract address | CCIP Directory |
tokenAdminRegistry | Yes | Token Admin Registry address | CCIP Directory |
registryModuleOwnerCustom | Yes | Registry Module Owner address | CCIP Directory |
link | Yes | LINK token contract address | CCIP Directory |
confirmations | No | Number of block confirmations before considering transaction final | Blockchain's finality characteristics and your risk tolerance |
nativeCurrencySymbol | No | Native gas token symbol (e.g., "ETH", "AVAX", "POL") | Blockchain's official documentation |
Find all CCIP addresses in the CCIP Directory - Testnet or CCIP Directory - Mainnet.
Test
Deploy a token to verify the configuration:
npx hardhat deployToken --name "Test Token" --symbol TEST --network optimismSepolia
Contract Verification (Optional)
Most networks are natively supported. Add --verifycontract when deploying:
npx hardhat deployToken --name "Test Token" --symbol TEST --network optimismSepolia --verifycontract
For networks not in Hardhat's chain descriptors, add to hardhat.config.ts:
chainDescriptors: {
12345: {
name: "New Network",
chainType: "generic",
blockExplorers: {
etherscan: {
name: "NewScan",
url: "https://newscan.io",
apiUrl: "https://api.newscan.io/api",
},
},
},
}
With Etherscan API V2, a single ETHERSCAN_API_KEY works across all Etherscan-compatible networks.