Skip to main content

Chainlink CCIP Integration

Chainlink’s Cross-Chain Interoperability Protocol (CCIP) provides a decentralized, secure method for relaying intent fulfillment proofs between blockchains. The CCIPProver leverages Chainlink’s oracle network for reliable cross-chain messaging.

Overview

CCIP offers several advantages for cross-chain proving:
  • Decentralized Security: Multi-oracle verification with Risk Management Network
  • Reliability: Guaranteed message delivery with automatic retries
  • Wide Network Support: Available on 15+ EVM chains
  • Message Tracking: Built-in explorer for monitoring cross-chain transactions
  • Active-Active Architecture: No single point of failure

Contract Architecture

Contract Location: contracts/prover/CCIPProver.sol

Constructor Parameters

address
required
The CCIP Router contract address for the current chain. Find addresses in CCIP documentation.
address
required
The Portal contract address on this chain.
bytes32[]
required
Array of whitelisted prover addresses on other chains. Use bytes32 format for cross-VM compatibility.
uint256
Minimum gas limit for cross-chain execution. Pass 0 to use the default 200,000 gas.

Proving Flow

1

Fulfill intent on destination chain

A solver fulfills an intent on the destination chain via the Portal contract.
2

Call prove() on CCIPProver

The prover or solver calls prove() on the destination chain’s CCIPProver with payment for CCIP fees.
3

CCIP delivers message

Chainlink’s oracle network validates and delivers the message to the source chain.
4

ccipReceive processes proof

The source chain’s CCIPProver receives the message via ccipReceive() and creates a proof record.
5

Withdraw rewards

The solver can now call withdraw() on the source chain Portal to claim their rewards.

Chain Selectors vs Chain IDs

CCIP uses chain selectors, not standard chain IDs. Always use the correct selector when calling prove().

Common Chain Selectors

Always verify selectors in the official CCIP documentation as they may change.

Data Parameter Structure

The data parameter encodes information needed for cross-chain message delivery:
address
required
The CCIPProver contract address on the source chain where the proof will be delivered.
uint256
required
Gas limit for proof processing on the source chain. Automatically enforced to be at least MIN_GAS_LIMIT. Maximum is 3,000,000 gas.

Fee Calculation

CCIP fees depend on:
  • Destination chain: Different chains have different costs
  • Gas limit: Higher execution limits cost more
  • Message size: Larger proofs (up to 30KB) increase fees
  • Network congestion: Dynamic pricing based on demand
Always add a fee buffer (5-10%) to account for gas price fluctuations between fee calculation and transaction execution.

Message Limits

CCIP has strict message limits that must be respected:
  • Maximum payload size: 30 KB (30,720 bytes)
  • Maximum gas limit: 3,000,000 gas
  • Minimum gas limit: 200,000 gas (configurable via minGasLimit)
If you need to prove many intents at once, batch them carefully to stay within the 30KB limit.

CCIP Router Addresses

Each chain has its own CCIP Router contract. Here are key mainnet addresses:
Testnet router addresses are different. Check the CCIP documentation for current addresses.

Deployment Example

Monitoring and Debugging

CCIP Explorer

Track your cross-chain messages using the CCIP Explorer:
  1. Copy the transaction hash from your prove() call
  2. Enter it in the CCIP Explorer
  3. View message status: Pending, Success, or Failed
  4. See execution details and any error messages

Common Issues

Cause: Gas prices increased between fee calculation and transaction execution.Solution: Always add a 5-10% buffer to the calculated fee.
Cause: Gas limit too low or invalid proof data.Solution: Increase gas limit in the data parameter or verify proof encoding.
Cause: The destination chain prover is not in the source chain’s whitelist.Solution: Add the prover address to the whitelist via contract upgrade or constructor.
Cause: Using chain ID instead of CCIP chain selector.Solution: Verify you’re using the correct CCIP chain selector from the table above.

Security Considerations

  1. Decentralized Oracles: CCIP uses multiple independent oracles for message verification
  2. Risk Management Network: Additional security layer monitors for anomalies
  3. Whitelist Enforcement: Only approved provers can submit proofs
  4. Router Authorization: Only the CCIP Router can call ccipReceive()
  5. Gas Limit Validation: Enforces minimum gas to prevent execution failures

Best Practices

  • Fee Estimation: Always query fees with fetchFee() before proving
  • Fee Buffer: Add 5-10% buffer for gas price volatility
  • Batch Proofs: Combine multiple proofs to save on fixed CCIP costs
  • Monitor Status: Use CCIP Explorer to track message delivery
  • Test First: Verify on testnets before mainnet deployment
  • Whitelist Management: Keep prover whitelists synchronized across chains

Integration Example

Complete example of integrating CCIP proving into your solver:

External Resources