4.3 KiB
4.3 KiB
CCIP Router Setup Guide
Overview
This guide explains how to set up and deploy the Chainlink CCIP Router for cross-chain oracle updates.
Prerequisites
- Chainlink CCIP Router contract deployed on source and target chains
- LINK tokens for paying CCIP fees
- Access to deploy contracts
- Validator keys for signing transactions
Deployment Steps
Step 1: Get CCIP Router Addresses
CCIP Router addresses vary by chain:
- Ethereum Mainnet:
0x80226fc0Ee2b096224EeAc085Bb9a8cba1146f7D - Polygon:
0x3C3D92629A02a8D95D5CB9650fe49C3544f69B43 - Avalanche:
0xF694E193200268f9a4868e4Aa017A0118C9a8177 - Arbitrum:
0x1619DE6B6B20eD217a58d00f37B9d47C7663feca - Optimism:
0x261c05167db67Be2E2dc4a347C4E6B000C677852
For ChainID 138, deploy a custom CCIP Router or use a compatible implementation.
Step 2: Deploy CCIP Router (if needed)
If deploying a custom CCIP Router:
# Deploy CCIP Router
forge script script/DeployCCIPRouter.s.sol --rpc-url $RPC_URL --broadcast
Step 3: Configure Router Address
Update contract configurations:
// In CCIPSender.sol
address public constant CCIP_ROUTER = 0x...; // Your router address
// In CCIPReceiver.sol
constructor(address _router, address _oracleAggregator) {
router = IRouterClient(_router);
// ...
}
Step 4: Set Chain Selectors
Configure chain selectors for target chains:
// Chain selectors
uint64 constant ETHEREUM_MAINNET = 5009297550715157269;
uint64 constant POLYGON = 4051577828743386545;
uint64 constant AVALANCHE = 6433500567565415381;
uint64 constant ARBITRUM = 4949039107694359620;
uint64 constant OPTIMISM = 3734403246176062136;
Step 5: Fund LINK Tokens
Ensure contracts have sufficient LINK tokens for fees:
# Transfer LINK to sender contract
cast send $SENDER_CONTRACT "transfer(address,uint256)" $LINK_TOKEN $AMOUNT --rpc-url $RPC_URL --private-key $PRIVATE_KEY
Step 6: Verify Deployment
# Check router address
cast call $SENDER_CONTRACT "router()" --rpc-url $RPC_URL
# Check chain selector
cast call $SENDER_CONTRACT "targetChainSelector()" --rpc-url $RPC_URL
Configuration Files
Kubernetes Deployment
Deploy CCIP Router service (if running as a service):
# k8s/ccip/router-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: ccip-router
namespace: besu-network
spec:
replicas: 1
selector:
matchLabels:
app: ccip-router
template:
metadata:
labels:
app: ccip-router
spec:
containers:
- name: ccip-router
image: chainlink/ccip-router:v1.0.0
env:
- name: RPC_URL
value: "http://besu-rpc:8545"
- name: PRIVATE_KEY
valueFrom:
secretKeyRef:
name: ccip-router-secrets
key: private_key
Environment Variables
# .env
CCIP_ROUTER_ADDRESS=0x...
TARGET_CHAIN_SELECTOR=5009297550715157269
LINK_TOKEN_ADDRESS=0x...
Testing
Test CCIP Router Connection
# Test router is accessible
cast call $CCIP_ROUTER "getSupportedTokens(uint64)" $CHAIN_SELECTOR --rpc-url $RPC_URL
Test Message Sending
# Send test message
forge script script/TestCCIPSend.s.sol --rpc-url $RPC_URL --broadcast
Monitoring
Monitor CCIP Router health:
- Router availability
- Message processing rate
- Fee consumption
- Error rates
See monitoring/prometheus/alerts/ccip.yml for alerting rules.
Troubleshooting
Router Not Found
- Verify router address is correct
- Check router is deployed on the chain
- Verify network/chain ID matches
Insufficient LINK
- Check LINK balance
- Transfer more LINK tokens
- Monitor fee consumption
Message Delivery Failures
- Check target chain selector
- Verify receiver contract address
- Check target chain router is operational
- Review error logs
Security
- Access Control: Restrict router configuration to authorized addresses
- Fee Limits: Set maximum fee limits to prevent excessive spending
- Rate Limiting: Implement rate limiting for message sending
- Monitoring: Monitor for unusual activity