Demo Project
A complete example project demonstrating how to use the Privacy Cash EVM SDK in a Next.js frontend: https://github.com/Privacy-Cash/base-sdk-demo-interfaceInstallation
Requires Node.js 20+. The SDK is written in TypeScript and includes type definitions.
Wallet Provider Setup
Wrap your app with Wagmi and RainbowKit providers configured for the supported EVM mainnets:Deriving Encryption Key
Before a user can interact with Privacy Cash, they must sign an off-chain message. This signature is used to derive their private encryption key and UTXO keypair — neither key ever leaves the client.Circuit Key File
Place thecircuit2.zkey file in your Next.js public/ folder. Pass the base path (without extension) to each SDK function:
Selecting a Network
Pass the active EVM network to SDK calls. Base is the default whennetwork is omitted, but explicit selection keeps multi-chain apps predictable.
Common Issues
- Signature re-prompt on every page refresh — Store the signature in
localStoragekeyed by address as shown above. walletClienttemporarily undefined — Useconnector.getProvider()as a fallback whenuseWalletClient()is unavailable during initial mount.- Wrong chain data — Pass
network: BASE_NETWORKornetwork: ETH_NETWORKto each SDK call after checking the connected wallet chain.
