> ## 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.

# Cloak SDKs

> Pick your language — Cloak ships first-party SDKs for TypeScript and Rust

Cloak ships two first-party SDKs targeting the same on-chain protocol. Pick the one that matches your stack:

<CardGroup cols={2}>
  <Card title="TypeScript SDK" icon="js" href="/sdk/quickstart">
    `@cloak.dev/sdk` — browser + Node.js SDK with a high-level `CloakSDK` class,
    wallet-adapter integration, built-in scanner and note storage.
    Integrates with `@solana/web3.js` and `@solana/kit`.
  </Card>

  <Card title="Rust SDK" icon="rust" href="/sdk/rust/introduction">
    `cloak-sdk` — engine-first Rust crate. One `transact()` entrypoint,
    one `TransactOptions` struct, full protocol pipeline end-to-end.
  </Card>
</CardGroup>

## Which one should I use?

| If you're building…              | Use        |
| -------------------------------- | ---------- |
| A web frontend or browser wallet | TypeScript |
| A Next.js / Node.js backend      | TypeScript |
| A Rust backend, service, or CLI  | Rust       |
| A Solana program client          | Rust       |

Both SDKs speak the same protocol and produce the same 264-byte public inputs. Migrating between them is straightforward once you understand the shared primitives.

## Shared runtime defaults

| Setting            | Value                                                          |
| ------------------ | -------------------------------------------------------------- |
| Program ID         | `zh1eLd6rSphLejbFfJEneUwzHRfMKxgzrgkfwA6qRkW`                  |
| Default relay URL  | `https://api.cloak.ag`                                         |
| Circuits base URL  | `https://storage.googleapis.com/cloak-circuits/circuits/0.1.0` |
| Merkle tree height | 32                                                             |
| Circuit arity      | 2 inputs / 2 outputs                                           |
| Proof format       | 256-byte Groth16 (pinocchio)                                   |
| Public inputs      | 264 bytes                                                      |

The **relay URL** points at Cloak's hosted submission endpoint that the SDK uses to land transactions on-chain. The default is correct for mainnet — only override `relayUrl` if you're targeting a different deployment (e.g. devnet).

## Shared concepts

Before you write code, skim the language-agnostic primer:

* [Core concepts](/sdk/core-concepts) — commitments, Merkle tree, nullifiers, fees, stale-root retries, viewing keys.
* [Transaction flows](/platform/transaction-flows) — how deposit/transfer/withdraw/swap actually hit the chain.
* [Viewing keys and compliance](/architecture/viewing-keys-compliance) — the chain-note compliance rail.

## TypeScript SDK

Start here for web3.js and Solana Kit integrations:

* [Quickstart](/sdk/quickstart) — minimal end-to-end SOL send.
* [Code examples](/sdk/examples) — send, swap, payroll, history.
* [API reference](/sdk/api-reference) — full `CloakSDK` class surface.

Install:

```bash theme={null}
npm install @cloak.dev/sdk @solana/web3.js
```

## Rust SDK

Start here for server-side and CLI integrations:

* [Introduction](/sdk/rust/introduction) — install, minimal setup, and scope.
* [Quickstart](/sdk/rust/quickstart) — first direct-path deposit.
* [API reference](/sdk/rust/api-reference) — `TransactOptions`, `TransactResult`, `Relay`, and related types.

Install:

```toml theme={null}
[dependencies]
cloak-sdk = { git = "https://github.com/cloak-ag/rustsdk" }
```
