Cloak is a privacy-preserving exit router on Solana. This repo hosts the whole system, with a strong focus on the Zero-Knowledge layer:
- ZK Notes (UTXO-style): commitments, nullifiers, Merkle proofs
- Withdraw circuit (SP1): inclusion + nullifier + conservation
- On-chain verification: Pinocchio program
shield-pool - Indexer API: append-only Merkle tree & proofs
- Relay: submits withdraw txs (no Jito in MVP)
Required Tools:
- Rust (stable or nightly)
- Solana CLI tools
- SP1 toolchain (for ZK proving)
Installation:
# 1. Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup install nightly
# 2. Install Solana CLI
sh -c "$(curl -sSfL https://release.solana.com/v1.18.4/install)"
export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
# 3. Install SP1 toolchain (REQUIRED for ZK functionality)
curl -L https://sp1.succinct.xyz | bash
source ~/.zshenv # or ~/.bashrc depending on your shell
sp1up
# 4. Install the succinct toolchain
cargo prove install-toolchain
# 5. RISC-V target is automatically installed with SP1
# No manual installation needed - SP1 handles this automatically
# 6. Verify installations
rustc --version
solana --version
cargo prove --versionBuild the project:
git clone <repo-url>
cd cloak
cargo build --releaseSP1 Toolchain Error:
If you see error: override toolchain 'succinct' is not installed, run:
# Install SP1 and the succinct toolchain
curl -L https://sp1.succinct.xyz | bash
source ~/.zshenv # or ~/.bashrc depending on your shell
sp1up
cargo prove install-toolchainRISC-V Target Error:
If you see error: toolchain 'nightly-aarch64-apple-darwin' does not support target 'riscv32im-succinct-zkvm-elf', this is normal! SP1 automatically handles the RISC-V target installation. Just run:
# Build the project - SP1 will handle the RISC-V target automatically
cargo build --releaseBuild Issues:
- Ensure all prerequisites are installed
- Try
cargo cleanbefore rebuilding - Check that
RUSTUP_TOOLCHAINenvironment variable is not set incorrectly
- ZK overview:
docs/docs/zk/README.md - Circuit spec:
docs/docs/zk/circuit-withdraw.md - Encoding contract:
docs/docs/zk/encoding.md - Merkle tree & proofs:
docs/docs/zk/merkle.md - SP1 prover details:
docs/docs/zk/prover-sp1.md - On-chain verifier & program:
docs/docs/zk/onchain-verifier.md - API contracts (Indexer/Relay):
docs/docs/zk/api-contracts.md - Threat model:
docs/docs/zk/threat-model.md - Roadmap:
docs/docs/roadmap.md
Build order (MVP): Merkle+Indexer → Deposit tx/event → SP1 withdraw circuit → On-chain verifier → Relay → Web wiring.
- Run
yarninsidedocs-site/andyarn startto launch the Docusaurus portal backed by the markdown docs indocs/. - Generated site covers architecture, workflows, on-chain programs, services, PoW, tooling, and operations.