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.

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).

Chainlink Local Architecture (With Forking)

Get the latest Chainlink content straight to your inbox.