> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cloak.ag/llms.txt
> Use this file to discover all available pages before exploring further.

# Introduction

> Add private balances, private payments and private withdrawals to a Solana app with the Cloak SDK

Cloak is a privacy layer for Solana. Users shield SOL, USDC, USDT or BRS into a shielded pool, pay each
other without revealing amounts or parties, and withdraw to any address. Zero-knowledge proofs,
generated on the user's device, are what the on-chain program verifies. No one, Cloak included, can
move funds without them.

You integrate Cloak through one TypeScript package, `@cloak.dev/sdk`, in a browser app, a Next.js
app, a Node.js backend or a script.

```bash theme={null}
npm install @cloak.dev/sdk@^0.2.20 @solana/kit
```

```ts theme={null}
import { createCloak } from "@cloak.dev/sdk";

const cloak = await createCloak({ wallet, rpc: process.env.SOLANA_RPC_URL });

await cloak.shield({ from: "solana", token: "USDC", amount: "10" }); // into the private balance
await cloak.send({ to: "cloak_…", token: "USDC", amount: "4" }); // private payment
await cloak.withdraw({ to: "<a Solana address>", token: "USDC", amount: "5" }); // back to public
```

## Choose your path

> [card] [Quickstart](https://docs.cloak.ag/get-started/quickstart.md)
>
> Install, open an account from a wallet, and shield, send and withdraw in five minutes.

> [card] [Your first private transaction](https://docs.cloak.ag/get-started/first-private-transaction.md)
>
> A step-by-step browser walkthrough with the output you should expect at each step.

> [card] [Wallet integrations](https://docs.cloak.ag/wallets/overview.md)
>
> Phantom and Wallet Standard, the wallet adapter, Privy, smart wallets, EVM and hardware wallets.

> [card] [Backend integration](https://docs.cloak.ag/sdk/backend-integration.md)
>
> Run Cloak from a server: business mode, encrypted storage and idempotent payouts.

## What you can build

| Use case | Start with |
| - | - |
| A private balance inside a wallet or app | [Deposit](https://docs.cloak.ag/guides/deposit.md), [Balances](https://docs.cloak.ag/guides/balances.md) |
| Private payments between users | [Private transfers](https://docs.cloak.ag/guides/private-transfers.md) |
| Payroll and batch payouts | [Payroll](https://docs.cloak.ag/guides/payroll.md) |
| Shareable money links and payment requests | [Payment links](https://docs.cloak.ag/guides/payment-links.md) |
| Private swaps | [Private swaps](https://docs.cloak.ag/guides/private-swaps.md) |
| Funding from Base, Polygon or Sui, and paying out to them or Tron | [Cross-chain](https://docs.cloak.ag/guides/cross-chain.md) |
| Auditable history for a user or an auditor | [Transaction history](https://docs.cloak.ag/guides/transaction-history.md), [Viewing keys](https://docs.cloak.ag/guides/viewing-keys.md) |

## Two layers

The SDK has two layers. Most apps only need the first.

* **[`createCloak`](https://docs.cloak.ag/sdk/create-cloak)**: one call per action. It opens the user's account from one
  wallet signature, then shields, sends, withdraws, quotes, reads the balance and makes payment
  links. It picks and merges notes, adds the fee on a withdrawal, keeps what it must remember, and
  finishes what an earlier run left open.
* **[The low-level API](https://docs.cloak.ag/sdk/low-level-api.md)**: the free functions `createCloak` is built on
  (`transact`, `transfer`, `partialWithdraw`, `fullWithdraw`, `swapWithChange`). Use them for private
  swaps, for your own note storage, for batch signing, or for full control over proofs and
  submission.

## Before you start

* **Mainnet only.** Cloak runs on Solana mainnet. There is no devnet or testnet deployment, so test
  with small amounts: the smallest SOL deposit is 0.01 SOL, and the smallest USDC or USDT deposit is
  1\.
* **Bring your own RPC.** Cloak hosts no Solana RPC. Use a mainnet endpoint from any provider. See
  [Network and RPC](https://docs.cloak.ag/resources/network-and-rpc.md).
* **Node 22 or later**, or a browser bundler. Proofs run on the client, in workers.

## How the pieces fit

| Piece | Role |
| - | - |
| `@cloak.dev/sdk` | Builds notes and proofs, signs requests, submits, scans and stores. Everything private happens here |
| Shield Pool program | Verifies proofs on chain, rejects double spends, enforces fees. The final authority on what is valid |
| Circuits bundle | The proving artifacts from the trusted-setup ceremony. The SDK checks their hashes before every proof |
| Your RPC | Your Solana endpoint. Cloak never inspects or proxies it |

[How Cloak works](https://docs.cloak.ag/concepts/how-cloak-works.md) explains the flow end to end.

> [!NOTE]
>
> Building for end users rather than integrating? The [Guide](https://docs.cloak.ag/guide/what-is-cloak.md) tab explains the
> Cloak app in plain language.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.