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 callingWithdrawFunds 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.
Step 1: Initiate Withdrawal on the Channel
CallWithdrawFunds 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
destinationis provided, released funds go to that wallet instead of the signer’s
What to Expect
No further action is required after callingWithdrawFunds. The operator
services handle settlement automatically:
indexer-private-channelpolls the channel every 1 second for burn events and writes a pending withdrawal record when yours is detectedoperator-private-channelpolls the database every 1 second for pending records and submitsReleaseFundsto 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
How the Operator Settles (Reference)
After the channel-side burn, a provisioned operator must callReleaseFunds 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 amountuser: recipient wallet on devnetnew_withdrawal_root: updated SMT root after this withdrawaltransaction_nonce: unique nonce for this leafsibling_proofs: 512 bytes (16 x 32-byte sibling hashes for the tree proof)
Verify
After the operator call confirms, check your devnet token balance: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.Channel Lifecycle
Understand participants and the full deposit-to-withdrawal flow in depth.
Authentication & Roles
Add JWT authentication to your integration.
Release Funds Reference
Full ReleaseFunds instruction reference for operator tooling.
Sparse Merkle Tree
Understand how withdrawal proofs prevent double-spend.