MCPcopy Index your code
hub / github.com/Privacy-Cash/privacy-cash

github.com/Privacy-Cash/privacy-cash @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
241 symbols 618 edges 29 files 31 documented · 13%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Privacy Cash

Transfer SOL privately. Private SPL tokens transfer and private swap will soon follow.

The program is fully audited by Accretion, HashCloak, Zigtur and Kriko, and verified onchain (with hash c6f1e5336f2068dc1c1e1c64e92e3d8495b8df79f78011e2620af60aa43090c5).

Overview

This project implements a privacy protocol on Solana that allows users to:

  1. Shield SOL: Deposit SOL into a privacy pool, generating a commitment that is added to a Merkle tree.
  2. Withdraw SOL: Withdraw SOL from the privacy pool to any recipient address using zero-knowledge proofs.

The implementation uses zero-knowledge proofs to ensure that withdrawals cannot be linked to deposits, providing privacy for Solana transactions.

Project Structure

  • program/: Solana on-chain program (smart contract)
  • src/: Rust source code for the program
  • test/: Tests
  • Cargo.toml: Rust dependencies and configuration

Prerequisites

  • Solana CLI 2.1.18 or later
  • Rust 1.79.0 or compatible version
  • Anchor 0.31.1
  • Node.js 16 or later
  • npm or yarn
  • Circom v2.2.2 https://docs.circom.io/getting-started/installation/#installing-dependencies

SDK

If you want to integrate Privacy Cash into your project, use the Privacy Cash SDK here.

Anchor Program

  1. Navigate to the program directory: bash cd anchor

  2. Build the program: bash anchor build

  3. Run unit test: bash cargo test

  4. Run integration test: bash npm run test:sol npm run test:spl npm run test:mint-checked

  5. Deploy the program to devnet: ```bash anchor build -- --features devnet rm target/deploy/zkcash-keypair.json cp zkcash-keypair.json target/deploy/zkcash-keypair.json anchor deploy --provider.cluster devnet

or rm target anchor build --verifiable cp zkcash-keypair.json target/deploy/zkcash-keypair.json anchor deploy --verifiable --provider.cluster devnet

or solana program deploy target/deploy/zkcash.so --program-id zkcash-keypair.json --upgrade-authority ./deploy-keypair.json ```

  1. Deploy to mainnet: ```bash anchor build --verifiable

rm target/deploy/zkcash-keypair.json cp zkcash-keypair.json target/deploy/zkcash-keypair.json

anchor deploy --verifiable --provider.cluster mainnet ```

  1. Transfer the authority to multisig wallet bash solana program set-upgrade-authority 9fhQBbumKEFuXtMBDw8AaQyAjCorLGJQiS3skWZdQyQD \ --new-upgrade-authority AWexibGxNFKTa1b5R5MN4PJr9HWnWRwf8EW9g8cLx3dM \ --upgrade-authority deploy-keypair.json \ --skip-new-upgrade-authority-signer-check \ --url mainnet-beta

Extension points exported contracts — how you extend this code

Proof (Interface)
(no doc)
anchor/tests/lib/prover.ts
ProofResult (Interface)
(no doc)
anchor/tests/lib/prover.ts

Core symbols most depended-on inside this repo

getCommitment
called by 81
anchor/tests/lib/utxo.ts
getExtDataHash
called by 69
anchor/tests/lib/utils.ts
createVersionedTransactionWithALT
called by 67
anchor/tests/lib/test_alt.ts
sendAndConfirmVersionedTransaction
called by 67
anchor/tests/lib/test_alt.ts
root
called by 59
anchor/tests/lib/merkle_tree.ts
prove
called by 59
anchor/tests/lib/prover.ts
getNullifier
called by 59
anchor/tests/lib/utxo.ts
parseProofToBytesArray
called by 57
anchor/tests/lib/prover.ts

Shape

Function 175
Method 33
Class 29
Enum 2
Interface 2

Languages

Rust59%
TypeScript41%

Modules by API surface

anchor/programs/zkcash/tests/unit/utils_test.rs67 symbols
anchor/programs/zkcash/src/lib.rs26 symbols
artifacts/circuits/transaction2_js/witness_calculator.js18 symbols
anchor/programs/zkcash/src/utils.rs18 symbols
anchor/tests/lib/merkle_tree.ts13 symbols
anchor/programs/zkcash/tests/unit/merkle_tree_test.rs12 symbols
anchor/tests/spl_tests.ts10 symbols
anchor/tests/lib/prover.ts10 symbols
anchor/tests/spl_mint_test.ts8 symbols
anchor/tests/sol_tests.ts8 symbols
anchor/tests/lib/test_alt.ts8 symbols
anchor/programs/zkcash/src/groth16.rs8 symbols

For agents

$ claude mcp add privacy-cash \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact