Introduction

Collection of TypeScript SDKs for building dapps with Zama's FHEVM (Fully Homomorphic Encryption Virtual Machine), enabling smart contracts to compute on encrypted data with controlled decryption on Ethereum.

Includes three npm packages (@fhevm/sdk, @fhevm/react-sdk, @fhevm/vue-sdk) and working example dapps (Next.js, Vue, Node.js CLI) demonstrating SDK usage with the FHECounter contractarrow-up-right on localhost and Sepolia.

πŸ’‘ Quick Testing Try the live demos on Sepolia testnet:

Or skip to Getting Started to run locally.

🧩 Architecture

FHEVM-SDKS

πŸ“¦ Packages

Core framework-agnostic SDK. Use this if you're building with vanilla JS, custom frameworks, or need Node.js support. Handles FHEVM client initialization, encryption, and decryption.

React provider and hooks for Next.js and React apps. Use this for React projects to reduce boilerplate by ~60-85%. Includes FhevmProvider and set of hooks for encryption and decryption.

Vue composables and plugin for Vue 3 apps. Use this for Vue projects to simplify FHEVM integration. Includes plugin and composables for encryption and decryption.

πŸ“ Repository Structure

This monorepo contains SDKs, examples, and local development infrastructure:

πŸš€ Getting Started

Prerequisites

Node.js v20+, pnpm, MetaMask (for browser examples)

Installation

Network Setup

The example dapps support two network modes. Choose one below:

Localhost Setup

Run examples with a local Hardhat node. Contract addresses are deterministic, so examples work out of the box.

1. Start Hardhat Node

This starts a local Hardhat node on http://127.0.0.1:8545 (Chain ID: 31337) and deploys all FHEVM contracts. The FHECounter contract deploys to 0x5FbDB2315678afecb367f032d93F642f64180aa3.

2. Configure MetaMask

⚠️ Important Disable all other wallet extensions (Coinbase Wallet, Rabby, etc.) before using the examples. Multi-wallet support will be added in future releases.

Add the Hardhat network and import a test account. See MetaMask Localhost Setup for detailed instructions with screenshots.

Sepolia Setup

Run examples on Sepolia testnet with a pre-deployed FHECounter contractarrow-up-right or deploy your own.

πŸ“Œ Pre-deployed Contract Contract address: 0x6134E9810A204661eaB5a189A44BB7F1CB2a4196 Free RPC: https://ethereum-sepolia-rpc.publicnode.com

1. Configure Environment Variables

Create .env.local (Next.js/Vue) or .env (Node.js) from env.example in your chosen example directory:

⚠️ Node.js requires PRIVATE_KEY Unlike browser examples that use MetaMask, Node.js needs a private key for signing transactions.

See .env.example files for optional overrides (custom RPC URL, custom contract address).

2. Configure MetaMask

⚠️ Important Set MetaMask to Sepolia testnet only. Multi-network support will be added in future releases.

Switch MetaMask to Sepolia and ensure you have test ETH. See MetaMask Sepolia Setup for detailed instructions.

3. Deploy Your Own Contract (Optional)

To deploy your own FHECounter contract instead of using the pre-deployed one, see Deploy to Sepolia Guide.

Running Examples

After completing either Localhost Setup or Sepolia Setup, run the examples:

Node.js CLI:

Next.js:

Vue:

πŸ“š Additional Resources

Project Documentation

Official Documentation

Community & Support

πŸ“„ License

This project is licensed under the BSD-3-Clause-Clear License. See the LICENSEarrow-up-right file for details.

Last updated