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: optimismSepoliaOPTIMISM_SEPOLIA_RPC_URL, avalancheFujiAVALANCHE_FUJI_RPC_URL.

Configuration Fields

FieldRequiredDescriptionSource
chainFamilyYesBlockchain VM type: "evm" for Ethereum-compatible chains, "svm" for Solanaconfig/types.ts
chainIdYesEVM chain IDBlockchain's official documentation (preferred) or ChainList
chainSelectorYesCCIP identifier for the networkCCIP Directory
routerYesCCIP Router contract addressCCIP Directory
rmnProxyYesRMN Proxy contract addressCCIP Directory
tokenAdminRegistryYesToken Admin Registry addressCCIP Directory
registryModuleOwnerCustomYesRegistry Module Owner addressCCIP Directory
linkYesLINK token contract addressCCIP Directory
confirmationsNoNumber of block confirmations before considering transaction finalBlockchain's finality characteristics and your risk tolerance
nativeCurrencySymbolNoNative 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.

Get the latest Chainlink content straight to your inbox.