Chainlink Local Architecture

Chainlink Local is a package that you can import into your development environment (such as Hardhat, Foundry, or Remix IDE) to use Chainlink services locally. It supports two primary modes:

  • Local testing without forking.
  • Local testing with forking.

This enables you to test Chainlink smart contracts and services, such as CCIP, either in a clean local blockchain state or by using a forked state from a live blockchain.

After testing with Chainlink Local, you can deploy your contracts to test networks without any modifications.

Local testing without forking

In this mode, you work with mock contracts on a locally running development blockchain node, such as Hardhat, Anvil (Foundry), or Remix VM.

How it works: Import the Chainlink Local package and deploy a set of Chainlink smart contracts to a blank Hardhat/Anvil network EVM state as part of your tests. You can then deploy your smart contracts and start testing with them. For CCIP, the local router applies the CCIP 2.0 OnRamp and OffRamp message rules, so a test that passes locally does not fail on a fork or in production. Read CCIP 2.0 behavior in Chainlink Local for what is and is not enforced.

Chainlink Local Architecture (Without Forking)

Local testing with forking

In this mode, you work with deployed Chainlink smart contracts using one or more forked blockchains. This setup provides a more realistic testing environment by incorporating the state of a live blockchain.

How it works: In your test scripts, you fork one or more blockchains to create locally running blockchain network(s). Chainlink Local provides the necessary interfaces to interact with the forked Chainlink services and utilities for testing in a forked environment. For example, in CCIP, Chainlink Local provides a utility function that helps you switch from one fork (as the source chain) to another fork (as the destination chain). Fork routing supports every CCIP era: pre-1.6, 1.6 and CCIP 2.0 (CCV-based) lanes, which live testnet lanes run today. Read CCIP 2.0 behavior in Chainlink Local for the fork-mode details.

Chainlink Local Architecture (With Forking)

Get the latest Chainlink content straight to your inbox.