Skip to content

zama-ai/sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

555 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Zama SDK


πŸ“’ Documentation | πŸ’› Community support | πŸ“š FHE resources by Zama

Latest release Latest release last updated License Zama Bounty Program

Dev release Dev release last updated Unit tests E2E tests

About

What is Zama SDK?

Zama SDK is a suite of TypeScript libraries for building privacy-preserving dApps on EVM-compatible blockchains powered by the Zama Confidential Blockchain Protocol. It provides everything you need to interact with confidential smart contracts using Fully Homomorphic Encryption (FHE) β€” from encrypting inputs and decrypting results to managing access control β€” all from familiar TypeScript and React environments.

Zama SDK is designed for developers who want to integrate confidential operations into their applications without learning cryptography:

  • End-to-end encryption: Transaction data and on-chain state remain encrypted at all times.
  • Framework-agnostic core: Works with viem, ethers, or any EVM library.
  • React-ready: First-class React hooks powered by @tanstack/react-query.

Table of contents

Packages

Package Description
@zama-fhe/sdk Core SDK β€” confidential contract operations, FHE relayer, contract call builders, viem/ethers adapters, Web Worker support
@zama-fhe/react-sdk React hooks wrapping the core SDK via @tanstack/react-query, with wagmi sub-path

Main features

  • TypeScript-first: Fully typed APIs with tree-shakeable ESM builds for minimal bundle size.
  • Privacy by design: Encrypt inputs, decrypt outputs, and manage access control for confidential smart contracts.
  • Multi-library support: Adapters for both viem and ethers, so you can use whichever EVM library your project already depends on.
  • React hooks: Dedicated React package with hooks for encrypting, decrypting, reencrypting, and querying confidential state β€” all backed by @tanstack/react-query for caching and suspense.
  • Workers: Offload heavy FHE operations to workers in Web and Node.js environments for non-blocking performance.
  • Wagmi integration: Drop-in wagmi connector support for seamless wallet and provider management in React apps.

↑ Back to top

Working with Zama SDK

Install

# Core SDK (vanilla TypeScript)
pnpm add @zama-fhe/sdk
# or: npm install @zama-fhe/sdk / yarn add @zama-fhe/sdk

# React hooks
pnpm add @zama-fhe/react-sdk @tanstack/react-query
# or: npm install @zama-fhe/react-sdk @tanstack/react-query / yarn add @zama-fhe/react-sdk @tanstack/react-query

Development

Prerequisites: Node.js >= 22, pnpm >= 10

pnpm install                # Install dependencies
pnpm build                  # Build all (sdk first, then react-sdk)
pnpm test                   # Watch mode
pnpm test:run               # Single run
pnpm typecheck              # Type checking
pnpm lint                   # Linting
pnpm format:check           # Formatting check

E2E tests:

pnpm e2e:test               # Run Playwright E2E tests
pnpm e2e:test:ui            # Playwright UI mode

Note: The forge-fhevm submodule and its soldeer dependencies are installed automatically by pnpm install.

See CONTRIBUTING.md for the full contributor guide (branching, PRs, code style, architecture).

Claude Code Setup

This repository includes an opt-in Claude Code configuration in claude-setup/settings.json. It provides:

  • Auto-allowed commands β€” pnpm build, pnpm test, pnpm lint, pnpm typecheck, pnpm format, and git diff variants run without prompting.
  • Denied reads β€” .env files and .next/ are blocked to prevent accidental secret exposure.
  • Ask-before-running β€” destructive commands (rm), remote pushes (git push), and release commands require explicit approval.
  • Post-edit hooks β€” every file write/edit automatically triggers pnpm typecheck, pnpm lint, and pnpm format.
  • Custom skills β€” custom skills required for good development practices to contribute to this repo.

To use it, install Claude Code and run pnpm setup:claude.

Contributing

There are two ways to contribute to Zama SDK:

Becoming an approved contributor involves signing our Contributor License Agreement (CLA). Only approved contributors can send pull requests, so please make sure to get in touch before you do!

License

This software is distributed under the BSD-3-Clause-Clear license. Read this for more details.

Resources

Support

🌟 If you find this project helpful or interesting, please consider giving it a star on GitHub! Your support helps to grow the community and motivates further development.

πŸ’› Community forum on Discourse

↑ Back to top

About

TypeScript SDK for confidential FHE smart contracts on Zama Protocol

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Contributors