Skip to main content

v2 SDK — @zk-privacy/core, @zk-privacy/web, @zk-privacy/node

TypeScript SDK published as @zk-privacy/core, @zk-privacy/web, and @zk-privacy/node. Not the same line as v1 (@zk-privacy/eb-sdk).

Getting started

  1. Installnpm packages and peer deps (Noir JS + bb.js).
  2. createWebClient (@zk-privacy/web) or createNodeClient (@zk-privacy/node) — returns a ZkpClient (with lazyLoad: false, the factory awaits preload() first).
  3. client.wallet({ spendingKey, account }) — or { spendingKey, walletClient } for injected signers — gives a ZkpWallet.

Example with the Node adapter (bundled circuits):

import { createNodeClient } from '@zk-privacy/node';

const client = await createNodeClient({ chainId: 8453 });
const wallet = client.wallet({ spendingKey, account });
await wallet.public.toConcealed({ amount:});

For createWebClient, follow the same pattern after installing and configuring the client for your environment.

Money flows (wallet)

  • Public → concealed: wallet.public.toConcealed({ amount, … })
  • Concealed → public: wallet.public.toPublic(amount, …) or wallet.toPublic(…)
  • Concealed → concealed: wallet.toConcealed({ to, amount, … })

Use wallet.public.getBalance() / getBalances() for visible ERC-20 balances on the token contract(s). swap on the wallet still throws until implemented.

Documentation map

TopicDescription
InstallationPackages and peers
ZkpClientConfig, lifecycle, wallet(), chain & relayer basics
ZkpWalletBalances, public ↔ concealed, transfers, history, stealth accessor
Advanced (low-level)Full exports, relayer details, ZkpClient internals

v1 remains under v1.