Skip to content
This page documents the Sparse Merkle Tree design at solana-private-channels commit c9e2240, the source of the program deployed to devnet (see Installation). Since commit 46a8e24 (2026-09-09), upstream main uses an onchain withdrawal bitmap instead, and clients generated from main don’t include the SMT parameters or ResetSmtRoot.

​Overview

Withdrawing from Private Channels is a two-step process. First, the user burns their channel-side token balance by calling WithdrawFunds on the Withdraw Program. Second, an operator calls ReleaseFunds on the Escrow Program (devnet, in this walkthrough) with a valid Sparse Merkle Tree exclusion proof to release the funds. The SMT proof ensures each withdrawal nonce can only be used once, preventing double-spend.
Overview diagramOverview diagram

​Step 1: Initiate Withdrawal on the Channel

Call WithdrawFunds on the Withdraw Program to burn your channel-side balance. Use the Async variant, which auto-derives the tokenAccount PDA and is the recommended form for production use:
userSigner must be a TransactionSendingSigner, such as a wallet signer from @solana/kit-plugin-wallet. With an ordinary KeyPairSigner, assertIsTransactionMessageWithSingleSendingSigner throws No TransactionSendingSigner was identified and nothing is sent. For keypair scripts, replace the last two calls with signTransactionMessageWithSigners plus sendAndConfirmTransactionFactory, or use client.sendTransaction([...]).
  • Withdraw Program ID: J231K9UEpS4y4KAPwGc4gsMNCjKFRMYcQBcjVW7vBhVi
  • Submit this transaction to the gateway (http://localhost:8899), not to a public Solana RPC
  • If destination is provided, released funds go to that wallet instead of the signer’s

​What to Expect

No further action is required after calling WithdrawFunds. The operator services handle settlement automatically:
  1. indexer-private-channel polls the channel every 1 second for burn events and writes a pending withdrawal record when yours is detected
  2. operator-private-channel polls the database every 1 second for pending records and submits ReleaseFunds to the Escrow Program on Solana devnet with the required SMT exclusion proof; it polls for devnet confirmation up to 5 times at 400 ms intervals before retrying
Funds typically appear in your devnet wallet within a few seconds under normal conditions.

​How the Operator Settles (Reference)

After the channel-side burn, a provisioned operator must call ReleaseFunds on the Escrow Program with a valid SMT exclusion proof; the operator cannot release funds without proving the withdrawal nonce has not been used before. This step is handled automatically by operator-private-channel; you do not need to call it yourself. The operator provides:
  • amount: must match the burned amount
  • user: recipient wallet on devnet
  • new_withdrawal_root: updated SMT root after this withdrawal
  • transaction_nonce: unique nonce for this leaf
  • sibling_proofs: 512 bytes (16 x 32-byte sibling hashes for the tree proof)

​Verify

After the operator call confirms, check your devnet token balance:
Or via RPC:

​You’ve Completed the Quickstart

You’ve run the full Private Channels cycle on devnet: deposited SPL tokens into the escrow, sent an offchain transfer through the gateway, and withdrawn funds back to your devnet wallet.