Skip to main content
The smallest complete integration: one file, run with tsx. It opens the account from a key the script holds, then shields, sends privately and withdraws.

Prerequisites

  • Node 22 or later.
  • A mainnet RPC URL.
  • A Solana keypair file holding a few USDC and a little SOL. Use a wallet you can afford to experiment with: Cloak has no test network.

Setup

The script

index.ts

Run it

Expected output

The account and quote lines below were observed on mainnet on 2026-11-30 with a fresh key. Your address differs, and the fee follows the pool’s live config.
The first shield also downloads and verifies the circuit files, so it takes longer than the rest. With nothing shielded yet, a withdrawal fails fast with CloakError [balance.insufficient] and moves nothing.

Next