Installation
npm Registry Setup
The SDK is published to GitHub Packages. You'll receive a GitHub Personal Access Token with read:packages scope from the team.
1. Configure npm
Create or edit ~/.npmrc with the token you were provided:
//npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKEN
@zk-privacy:registry=https://npm.pkg.github.com
2. Install SDK
npm install @zk-privacy/eb-sdk @zk-privacy/eb-contracts
Package Overview
| Package | Description |
|---|---|
@zk-privacy/eb-sdk | Core SDK - encryption, proofs, wallet management |
@zk-privacy/eb-contracts | Contract ABIs and deployment addresses |
CDN Assets
The SDK automatically loads heavy assets from CDN:
| Asset | URL | Size |
|---|---|---|
| WASM Solver | cdn.zkprivacy.dev/wasm/v1/ | ~25 MB |
| Tier Tables | cdn.zkprivacy.dev/tiers/v1/ | ~27 MB |
| Circuits | cdn.zkprivacy.dev/circuits/v1/ | ~1 MB |
These are loaded lazily on first use.
TypeScript Support
The SDK is written in TypeScript and includes full type definitions:
import type {
EBClient,
EBWallet,
ElGamalCiphertext,
Point
} from '@zk-privacy/eb-sdk';
Browser Support
The SDK works in modern browsers with:
- WebAssembly support
- BigInt support
- ES2022+ features
For older browsers, use appropriate polyfills.
React Native
For mobile apps, install the mobile SDK package:
npm install @zk-privacy/eb-mobile @zk-privacy/eb-sdk
iOS Setup
Add to your ios/Podfile:
pod 'EBMobileProver', :podspec => 'https://cdn.zkprivacy.dev/ios/EBMobileProver.podspec'
pod 'EBMobileSolver', :podspec => 'https://cdn.zkprivacy.dev/ios/EBMobileSolver.podspec'
Then run:
cd ios && pod install
Usage
import { EBClient, setupMobileEB } from '@zk-privacy/eb-mobile';
await setupMobileEB();
const client = await createClient({ chainId: 8453 });
The mobile SDK automatically uses native prover and solver instead of WASM for better performance.
See the @zk-privacy/eb-mobile package README for architecture details.
Lazy Loading (Faster Startup)
createClient applies lazy loading by default — it returns instantly and assets load on first use:
const client = await createClient({
chainId: 8453,
onAssetLoading: (asset, progress) => {
showSpinner(`Loading ${asset}... ${progress}%`);
},
});
Preload API
Anticipatory loading for better UX:
client.preload('solver');
client.preload('prover');
client.preload('all');
Next Steps
- Quick Start - Build your first transaction
- API Reference - Full SDK documentation