Installation
Package Manager
bash
npm install @zkprivacy/sdkbash
yarn add @zkprivacy/sdkbash
pnpm add @zkprivacy/sdkBundle Options
The SDK offers two import paths:
Full SDK (~2MB)
For complete wallets with transfer and unshield capabilities:
typescript
import { PrivacyClient, createProver } from '@zkprivacy/sdk';Includes:
PrivacyClient- Full privacy clientProver- ZK proof generation (NoirJS + bb.js)- Shield utilities
- Key management
Shield Only (~150KB)
For deposit widgets that don't need proof generation:
typescript
import { shieldTo } from '@zkprivacy/sdk/shield';Includes:
shieldTo()- Direct depositsencryptNoteForRecipient()- Note encryption- Address utilities
Peer Dependencies
The SDK requires viem for blockchain interaction:
bash
npm install viemTypeScript
The SDK is written in TypeScript and includes type definitions. No additional @types/* packages needed.
json
// tsconfig.json
{
"compilerOptions": {
"moduleResolution": "bundler", // or "node16"
"target": "ES2020"
}
}Framework Setup
Vite
Add WASM support to your Vite config:
typescript
// vite.config.ts
export default defineConfig({
optimizeDeps: {
exclude: ['@aztec/bb.js']
},
assetsInclude: ['**/*.wasm']
});Next.js
For Next.js, you need to handle WASM files:
javascript
// next.config.js
module.exports = {
webpack: (config) => {
config.experiments = { ...config.experiments, asyncWebAssembly: true };
return config;
}
};Node.js
For Node.js scripts, add the WebSocket polyfill:
typescript
import WebSocket from 'ws';
(globalThis as any).WebSocket = WebSocket;Circuit Files
The prover needs circuit artifacts. Host these on your server:
- Download from the deployed app:
https://devtools.zkprivacy.dev/circuits/ - Or build from source:
just build-circuits
Required files:
transfer.json(~500KB)unshield.json(~400KB)
Place in your public/circuits/ folder.
Verify Installation
typescript
import { DEPLOYMENTS } from '@zkprivacy/sdk';
console.log('Pool address:', DEPLOYMENTS.remote.pool);
// Should print: 0x...Next Steps
Continue to Quick Start to create your first private transaction.