# Using Chainlink Local to Test CCIP in Your Hardhat Project
Source: https://docs.chain.link/chainlink-local/build/ccip/hardhat

> For the complete documentation index, see [llms.txt](/llms.txt).

> **NOTE: Integrate Chainlink Local into your project**
>
> ### npm
>
> If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM
> package](https://www.npmjs.com/package/@chainlink/local):
>
> ```shell
> npm install @chainlink/local@0.3.1
> ```
>
> ### yarn
>
> If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM
> package](https://www.npmjs.com/package/@chainlink/local):
>
> ```shell
> yarn add @chainlink/local@0.3.1
> ```
>
> ### foundry
>
> If you use [Foundry](https://book.getfoundry.sh/):
>
> ```shell
> forge install smartcontractkit/chainlink-local@v0.3.1
> ```
>
> and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file
>
> ### RemixIDE
>
> Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package:
>
> ```solidity
> import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol";
> ```

There are three guides to help you test Chainlink CCIP 2.0 in your Hardhat project using Chainlink Local - two for local mode and one for forked environments. The guides use the [CCIP Hardhat Starter Kit](https://github.com/smartcontractkit/ccip-starter-kit-hardhat) (Hardhat 3), whose CCIP 2.0 examples (`Example01`-`Example10`) run as Hardhat tasks and Ignition modules on the Ethereum Sepolia → Polygon Amoy lane.

Read [CCIP 2.0 behavior in Chainlink Local](/chainlink-local/learn/ccip-v2-local) to understand what the simulator enforces in each mode, or the [CCIP starter kit examples map](/chainlink-local/learn/starter-kit-examples) for an index of every kit example.

## Guides

### Using Chainlink Local Simulator in your Hardhat project

This [guide](/chainlink-local/build/ccip/hardhat/local-simulator) helps you set up and run CCIP 2.0 in a localhost environment within your Hardhat project. It provides step-by-step instructions on :

- Cloning the
  [CCIP Hardhat Starter Kit](https://github.com/smartcontractkit/ccip-starter-kit-hardhat)
- Installing necessary dependencies
- Running tests for token transfers between two accounts using `ExtraArgsV3` with Fast Transfers

Using the local simulator without forking is ideal for initial development and testing in an isolated environment.

### Sending data to a receiver with CCV config

This [guide](/chainlink-local/build/ccip/hardhat/data-messages-receiver-ccv-config) covers the receiver-side finality rules in local mode: a data-only message to a `BasicMessageReceiverWithCCVs` contract, where the local router enforces the receiver's minimum block depth for Fast Transfers.

### Using Chainlink Local Simulator in your Hardhat project with forked environments

This [guide](/chainlink-local/build/ccip/hardhat/local-simulator-fork) extends your testing capabilities by demonstrating how to use the Chainlink Local Simulator in a forked environment. It includes instructions on:

- Setting up forks of real blockchain networks (Ethereum Sepolia and Polygon Amoy, a live CCIP 2.0 lane)
- Routing messages across forks with the Hardhat 3 JavaScript fork helper for every CCIP era
- Running the CCT fork tests (token and pool deployment, registration, Faster Than Finality gates)

Using the local simulator with forked environments is ideal for testing in a more realistic yet controlled setting.