> ## Documentation Index
> Fetch the complete documentation index at: https://fhenix-ci-version-drift-check.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

> Install and configure @cofhe/sdk for your project

## Prerequisites

* Node.js 18+
* TypeScript 5+
* viem 2.38.6+

## Install packages

<CodeGroup>
  ```bash npm theme={null}
  npm install @cofhe/sdk@^0.7.1 @fhenixprotocol/cofhe-contracts@^0.2.0
  ```

  ```bash pnpm theme={null}
  pnpm add @cofhe/sdk@^0.7.1 @fhenixprotocol/cofhe-contracts@^0.2.0
  ```

  ```bash yarn theme={null}
  yarn add @cofhe/sdk@^0.7.1 @fhenixprotocol/cofhe-contracts@^0.2.0
  ```
</CodeGroup>

| Package                           | Version  | Purpose                                                    |
| --------------------------------- | -------- | ---------------------------------------------------------- |
| `@cofhe/sdk`                      | `^0.7.1` | Client-side encryption, decryption, and ACP management     |
| `@fhenixprotocol/cofhe-contracts` | `^0.2.0` | `FHE.sol`, the Solidity library imported by your contracts |

<Note>
  `@cofhe/sdk` `0.7.x` pairs with `@fhenixprotocol/cofhe-contracts` `0.2.0`. Keep every `@cofhe/*` package on the same version. They are released together and pin each other exactly. The [compatibility page](/get-started/introduction/compatibility) carries the full table.
</Note>

## For Hardhat projects

If you are using Hardhat for development and testing, also install the plugin:

<CodeGroup>
  ```bash npm theme={null}
  npm install @cofhe/hardhat-plugin@^0.7.1 @cofhe/sdk@^0.7.1 @fhenixprotocol/cofhe-contracts@^0.2.0
  ```

  ```bash pnpm theme={null}
  pnpm add @cofhe/hardhat-plugin@^0.7.1 @cofhe/sdk@^0.7.1 @fhenixprotocol/cofhe-contracts@^0.2.0
  ```

  ```bash yarn theme={null}
  yarn add @cofhe/hardhat-plugin@^0.7.1 @cofhe/sdk@^0.7.1 @fhenixprotocol/cofhe-contracts@^0.2.0
  ```
</CodeGroup>

| Package                           | Version  | Purpose                                                                |
| --------------------------------- | -------- | ---------------------------------------------------------------------- |
| `@cofhe/hardhat-plugin`           | `^0.7.1` | Extends Hardhat with `hre.cofhe`, deploys mock contracts automatically |
| `@cofhe/sdk`                      | `^0.7.1` | Client-side encryption, decryption, and ACP management                 |
| `@fhenixprotocol/cofhe-contracts` | `^0.2.0` | `FHE.sol`, the Solidity library imported by your contracts             |

See the [Hardhat Plugin Getting Started](/client-sdk/hardhat-plugin/getting-started) guide for configuration details.

## For Foundry projects

If you are using Foundry for development and testing, install the Foundry plugin and its peer packages as dev dependencies:

<CodeGroup>
  ```bash npm theme={null}
  npm install -D @cofhe/foundry-plugin@^0.7.1 @cofhe/mock-contracts@^0.7.1 @fhenixprotocol/cofhe-contracts@^0.2.0 @openzeppelin/contracts
  forge install foundry-rs/forge-std
  ```

  ```bash pnpm theme={null}
  pnpm add -D @cofhe/foundry-plugin@^0.7.1 @cofhe/mock-contracts@^0.7.1 @fhenixprotocol/cofhe-contracts@^0.2.0 @openzeppelin/contracts
  forge install foundry-rs/forge-std
  ```

  ```bash yarn theme={null}
  yarn add -D @cofhe/foundry-plugin@^0.7.1 @cofhe/mock-contracts@^0.7.1 @fhenixprotocol/cofhe-contracts@^0.2.0 @openzeppelin/contracts
  forge install foundry-rs/forge-std
  ```
</CodeGroup>

| Package                           | Version  | Purpose                                                                     |
| --------------------------------- | -------- | --------------------------------------------------------------------------- |
| `@cofhe/foundry-plugin`           | `^0.7.1` | `CofheTest` and `CofheClient`, the Solidity test base and per-user SDK shim |
| `@cofhe/mock-contracts`           | `^0.7.1` | Mock CoFHE contracts used by the Foundry plugin                             |
| `@fhenixprotocol/cofhe-contracts` | `^0.2.0` | `FHE.sol`, the Solidity library imported by your contracts                  |

<Note>
  The Foundry plugin uses Solidity-only abstractions, so tests need no `@cofhe/sdk` (JS).
</Note>

See the [Foundry Plugin Getting Started](/client-sdk/foundry-plugin/getting-started) guide for `foundry.toml` and `remappings.txt` setup.

## Runtime entrypoints

Import from the entrypoint that matches your runtime:

```typescript theme={null}
// Browser apps (React, Next.js, etc.)
import { createCofheConfig, createCofheClient } from '@cofhe/sdk/web';

// Node.js scripts, backends, Hardhat tests
import { createCofheConfig, createCofheClient } from '@cofhe/sdk/node';

// Shared types (works in any runtime)
import { Encryptable, FheTypes } from '@cofhe/sdk';
```

## Next steps

* [Quick start](/client-sdk/quick-start/javascript): write your first FHE contract and test.
* [Client setup](/client-sdk/guides/client-setup): configure and connect the SDK client.
