Skip to main content

Sample Project

https://github.com/Privacy-Cash/privacy-cash-evm-sdk/blob/main/example/

Installation

Requires Node.js 20+. The SDK is written in TypeScript and includes type definitions.

Signing In

The SDK uses a wallet signature to derive your private encryption key and UTXO keypair. Ask the user to sign a fixed message:
The resulting signature and address strings are passed directly to each SDK function. Pass the selected network to read from and submit to the correct EVM deployment.

Sending Transactions

deposit() requires a txSender callback that signs and submits the raw transaction:

Interacting with Privacy Cash

Once the above steps are done, you can check balance, make deposits and withdrawals.

Supported Networks

Privacy Cash EVM currently supports mainnet deployments only:
If network is omitted, the SDK reads NEXT_PUBLIC_CHAIN_ID and falls back to Base (8453).

Key Path

All functions accept a keyBasePath parameter pointing to the circuit zkey file (without extension):
For Next.js projects, place the .zkey file in the public/ folder:

Warnings

Privacy Cash SDK requires consistent signature generation, otherwise the deposited tokens might be lost forever since the encrypted UTXO can’t be decrypted. Please make sure deriveKeys() generates the same result for the same params passed in. Most wallets returns the same result, but some non major wallets might generate different result.