Prerequisites
- Node.js 18+
- TypeScript 5+
- Viem 2+
Install packages
npm install @cofhe/sdk@^0.4.0 @fhenixprotocol/cofhe-contracts@^0.1.0
| Package | Version | Purpose |
|---|
@cofhe/sdk | ^0.4.0 | Client-side encryption, decryption, and permit management |
@fhenixprotocol/cofhe-contracts | ^0.1.0 | FHE.sol — the Solidity library imported by your contracts |
@fhenixprotocol/cofhe-contracts@0.1.0 requires @cofhe/sdk version >= 0.4.0.
For Hardhat projects
If you are using Hardhat for development and testing, also install the plugin:
npm install @cofhe/hardhat-plugin@^0.4.0 @cofhe/sdk@^0.4.0 @fhenixprotocol/cofhe-contracts@^0.1.0
| Package | Version | Purpose |
|---|
@cofhe/hardhat-plugin | ^0.4.0 | Extends Hardhat with hre.cofhe, deploys mock contracts automatically |
@cofhe/sdk | ^0.4.0 | Client-side encryption, decryption, and permit management |
@fhenixprotocol/cofhe-contracts | ^0.1.0 | FHE.sol — the Solidity library imported by your contracts |
See the Hardhat Plugin Getting Started guide for configuration details.
Runtime entrypoints
Import from the entrypoint that matches your runtime:
// 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