Getting Started
Introduction
Cloak SDK is a privacy protocol for Solana that enables stealth addresses, relayer-based sender privacy, and zero-knowledge proofs for hidden payment amounts.
Program: AaJF9TTgTPqRTuXfnQnVvBihpYwYUAYroW984foWyVJWhat are stealth addresses?
Stealth addresses are a cryptographic technique that enables unlinkable payments on public blockchains. Every time someone sends you SOL, the payment goes to a unique, one-time address that only you can detect and spend from.
Unlike regular wallet addresses where your entire transaction history is publicly visible, stealth addresses ensure that no outside observer can determine that two payments went to the same person.
The privacy stack
Cloak v1.0 provides three layers of privacy:
Stealth Addresses
ECDH-derived one-time addresses. The receiver's identity is hidden — no one can link payments to the same recipient.
Relayer Privacy
Submit transactions through a relayer server to hide the sender's wallet address. The relayer pays rent, the user only signs the transfer.
Hidden Amounts
Pedersen commitments with Groth16 zk-SNARK proofs on BN254 hide the payment amount. Verifiers can confirm validity without knowing the value.
How it works
- Receiver generates a stealth meta-address (spending + viewing keypairs) and shares the public portion.
- Sender uses ECDH with the receiver's public meta-address to derive a unique one-time stealth address and an ephemeral keypair.
- Sender transfers SOL to the stealth address and publishes the ephemeral public key on-chain via an Anchor announcement PDA.
- Receiver scans announcement PDAs, uses their viewing key to detect which payments are addressed to them, then derives the spending key to claim the funds.
Quick example
use cloak_sdk::{
StealthMetaAddress, PublicMetaAddress,
StealthPayment, StealthKeypair, Scanner,
};
// Receiver: generate identity
let meta = StealthMetaAddress::generate();
let public_addr = meta.to_public_string();
// Sender: create stealth payment
let recipient = PublicMetaAddress::from_string(&public_addr)?;
let payment = StealthPayment::create(&recipient, 1_000_000_000)?;
// → payment.stealth_address (where to send SOL)
// → payment.ephemeral_pubkey (publish on-chain)
// Receiver: detect and spend
let keypair = StealthKeypair::derive(&meta, &payment.ephemeral_pubkey)?;
let solana_kp = keypair.to_solana_keypair()?;
// Sign transactions with solana_kpOn-chain program
Cloak includes an Anchor program deployed on Solana Devnet with 6 instructions:
| Instruction | Description |
|---|---|
initialize | Create the global announcement counter PDA |
send_stealth | Transfer SOL + create announcement PDA |
send_stealth_relayed | Relayer pays rent, user signs transfer (sender privacy) |
send_stealth_private | Hidden amount with Pedersen commitment + Groth16 proof |
announce | Publish ephemeral key without transferring SOL |
close_announcement | Reclaim rent from processed announcements |