Introduction
The Privacy Cash SDK provides a TypeScript/JavaScript interface to integrate private transactions into your Solana applications. Built on zero-knowledge proofs, the SDK enables users to shield and withdraw SOL and SPL tokens privately, breaking on-chain transaction links.Key Features
Private Transfers
Shield SOL and SPL tokens into privacy pools using zero-knowledge commitments
Zero-Knowledge Proofs
Generate Groth16 proofs for unlinkable withdrawals
UTXO Model
Manage private balances with a familiar UTXO-based approach
Merkle Trees
Track commitments using efficient sparse Merkle trees
Architecture Overview
The SDK implements a privacy protocol with the following components:UTXO Management
The SDK uses a UTXO (Unspent Transaction Output) model inspired by Tornado Cash Nova. Each UTXO contains:- Amount: The value of the UTXO
- Keypair: A Poseidon-based keypair (not standard Ed25519)
- Private key: Random 31-byte value
- Public key:
PoseidonHash(privateKey)
- Blinding Factor: Random value for commitment hiding
- Mint Address: Token mint (SOL or SPL token)
- Index: Position in the Merkle tree
Commitment Scheme
Commitments are calculated using Poseidon hash:Nullifier Generation
Nullifiers prevent double-spending by marking UTXOs as spent:Zero-Knowledge Proofs
The SDK generates Groth16 proofs that verify:- Merkle proof: UTXO exists in the commitment tree
- Nullifier validity: Prover knows the private key
- Balance conservation: Input amounts equal output amounts plus fees
- External data binding: Transaction metadata is correctly committed
Transaction Flow
Shield (Deposit)
Create UTXOs with encrypted outputs and insert commitments into the Merkle tree. Users send tokens to the program’s token account.
Transfer (Optional)
Generate proofs to spend input UTXOs and create new output UTXOs, all within the privacy pool.
Fee Structure
- Deposit Fee: 0% (Free deposits)
- Withdrawal Fee: 0.35% of withdrawal amount
- Fee Recipient:
AWexibGxNFKTa1b5R5MN4PJr9HWnWRwf8EW9g8cLx3dM
Security Considerations
Supported Networks
- Mainnet:
9fhQBbumKEFuXtMBDw8AaQyAjCorLGJQiS3skWZdQyQD - Devnet: Available for testing
- Localnet: Supported for development
Next Steps
Installation
Install and configure the Privacy Cash SDK
Basic Usage
Learn the core SDK operations
Examples
Explore complete integration examples
API Reference
Browse the full API documentation