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

> ## Agent Instructions
> This page is part of the Solana developer documentation at https://solana.com/developers/docs. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get the page as Markdown.
> Index of all pages: https://solana.com/llms.txt. Per-section indexes such as https://solana.com/developers/docs/payments/llms.txt are smaller; prefer them when working on one task.
> Coding agents: install the official Solana skill for current APIs and conventions with `npx skills add https://github.com/solana-foundation/solana-dev-skill` (also served at https://solana.com/SKILL.md).
> Code in the cookbook and task pages comes from tested example files. Prefer it over writing API calls from memory.

# Installation

> Set up your environment and generate the Private Channels TypeScript clients

<Info>
  These pages target solana-private-channels commit `c9e2240`, the source of
  the escrow program deployed to devnet at
  `9tgHa1DcnaSSUtmMsst8ovKTe1Gfxzezn27KnH9xXYeU`. Upstream `main` has moved
  on: it replaces the Sparse Merkle Tree with an onchain withdrawal bitmap,
  makes Token-2022 the channel's only token program, and changes the operator
  scripts and required secrets. Clients generated from `main` don't match the
  code on these pages, so check out `c9e2240` as shown below.
</Info>

## Prerequisites

These are the versions commit `c9e2240` pins:

- Rust 1.91.0 (`rust-toolchain.toml`)
- Solana CLI 3.1.13 (Agave, `versions.env`):
  `sh -c "$(curl -sSfL https://release.anza.xyz/v3.1.13/install)"`
- Node.js 24 (the version the repository's Dockerfile installs)
- pnpm 10.15.1 (the repository's `packageManager` field pins it):
  `npm install -g pnpm@10.15.1`

## Clone the Repository

```bash
git clone https://github.com/solana-foundation/solana-private-channels.git
cd solana-private-channels
git checkout c9e2240
```

## Generate TypeScript Clients

The TypeScript clients are **not** published to npm. They must be generated from
the IDL using Codama.

```bash
# Escrow program client
cd private-channel-escrow-program
pnpm install --frozen-lockfile
pnpm run generate-clients
cd ..

# Withdraw program client
cd private-channel-withdraw-program
pnpm install --frozen-lockfile
pnpm run generate-clients
cd ..
```

Generated clients land in:

- `private-channel-escrow-program/clients/typescript/src/generated/`
- `private-channel-withdraw-program/clients/typescript/src/generated/`

Import from these local paths in your application; there is no
`@private-channels/client` package on npm.

## Set Up Your Project

The code samples import `@solana/kit` and `@solana-program/token` from your own
project, and the generated clients through a relative path
(`../private-channel-escrow-program/...`). Create the project in a folder at the
root of the cloned repository so those paths resolve:

```bash
mkdir app && cd app
npm init -y
npm pkg set type=module
npm install @solana/kit @solana-program/token
npm install --save-dev tsx
```

Save a sample as a `.ts` file in `app` and run it with `npx tsx <file>.ts`. The
generated clients are TypeScript with extensionless imports, so plain `node`
can't load them. `type=module` lets the samples use top-level `await`. The
generated clients sit in a CommonJS package, so Node.js can't see the names that
`generated/index.ts` re-exports: the samples import each instruction from its
own file, such as `generated/instructions/deposit`. A bundler such as Vite also
accepts the shorter `generated` path.

## Connect to Devnet

```bash
solana config set --url devnet
solana address
```

Fund that address with devnet SOL from the
[Solana Faucet](https://faucet.solana.com/) (`solana airdrop` no longer works on
devnet), then check the balance:

```bash
solana balance
```

- Escrow Program ID: `9tgHa1DcnaSSUtmMsst8ovKTe1Gfxzezn27KnH9xXYeU`
- Withdraw Program ID: `J231K9UEpS4y4KAPwGc4gsMNCjKFRMYcQBcjVW7vBhVi`

## Next Steps

**[Deposit Tokens](/developers/docs/tools/private-channels/quickstart/deposit)** - make
your first deposit
