Expand description
§Privacy Cash Rust SDK
Pure Rust SDK for Privacy Cash on Solana. Privacy-preserving transactions using Zero-Knowledge Proofs.
§Features
- Private Transactions: Send SOL and SPL tokens with complete privacy
- Pure Rust ZK Proofs: Native Groth16 proof generation
- Multi-Token Support: SOL, USDC, USDT, and more
- Partner Fee Integration: Earn fees by integrating into your platform
§Quick Start - ONE Function
use privacy_cash::send_privately;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Send 0.1 SOL privately - ONE function does everything!
let result = send_privately(
"your_base58_private_key", // Private key
"recipient_pubkey", // Recipient address
0.1, // Amount to send
"sol", // Token: "sol", "usdc", "usdt"
None, // Optional RPC URL
).await?;
println!("Deposit TX: {}", result.deposit_signature);
println!("Withdraw TX: {}", result.withdraw_signature);
println!("Amount received: {}", result.amount_received);
Ok(())
}Re-exports§
pub use client::PrivacyCash;pub use config::Config;pub use config::SupportedToken;pub use error::PrivacyCashError;pub use error::Result;pub use keypair::ZkKeypair;pub use utxo::Utxo;pub use utxo::Balance;pub use utxo::SplBalance;pub use constants::*;
Modules§
- client
- Main Privacy Cash client
- config
- Configuration fetching from the relayer API
- constants
- Constants used throughout the Privacy Cash SDK
- deposit
- Deposit functionality for native SOL
- deposit_
spl - Deposit functionality for SPL tokens
- encryption
- Encryption service for UTXO data
- error
- Error types for Privacy Cash SDK
- get_
utxos - UTXO fetching and management for native SOL
- get_
utxos_ spl - UTXO fetching and management for SPL tokens
- keypair
- ZK Keypair for Privacy Cash
- merkle_
tree - Merkle tree implementation using Poseidon hashing
- poseidon
- Poseidon hash implementation compatible with ark-ff 0.4 (for Solana SDK compatibility)
- prover
- ZK Proof generation for Privacy Cash
- prover_
rust - Pure Rust ZK Proof Generation using ark-circom
- storage
- Local storage for caching UTXOs and offsets
- utils
- Utility functions for Privacy Cash SDK
- utxo
- UTXO (Unspent Transaction Output) model for Privacy Cash
- withdraw
- Withdrawal functionality for native SOL
- withdraw_
spl - Withdrawal functionality for SPL tokens
Structs§
- Keypair
- A vanilla Ed25519 key pair
- Pubkey
- The address of a Solana account.
- Send
Privately Result - Result of a send_privately operation
Traits§
- Signer
- The
Signertrait declares operations that all digital signature providers must support. It is the primary interface by which signers are specified inTransactionsigning interfaces
Functions§
- send_
privately - 🚀 SEND PRIVATELY - The ONE function you need!