Skip to main content
A private balance is not a number stored anywhere. It is the sum of the account’s unspent notes in each pool. This page explains where those notes live and what that means for your app’s storage and recovery story.

A note is the money

A note is the tuple (amount, owner key, blinding, mint). The chain stores only its commitment, a Poseidon hash of the tuple. To spend a note, the client must hold the full tuple and the owner’s private key. The SDK derives the blinding of deposits and change from the account’s viewing key, so a scan can rebuild those notes. A note built with plain createUtxo gets a random blinding that is written nowhere on chain. That shapes every integration: the client’s storage is the fast and complete record of what the account owns, and the chain is a slower fallback that covers only the recoverable shapes. Lose the storage and a note built with createUtxo is unspendable by anyone.

With createCloak, the SDK stores them

createCloak picks notes, merges them when a call needs more than two, and keeps what it must remember in storage: Read the balance and the notes behind it:
Back up the notes as one encrypted string, and import them on any device that opens the same account:
secret is 32 bytes or more, or a passphrase of 12 characters or more. See Balances for the full read path.

With the low-level API, you store them

The low-level functions (transact, transfer, partialWithdraw, fullWithdraw, the swap helpers) return the notes they create on result.outputUtxos and keep nothing. Persist them before you report success:
Zero-amount outputs are circuit padding; drop them. The full storage contract, including UtxoWallet, selectUtxos and multi-device reconciliation with verifyUtxos, is in Solana wallet adapter.

What can be recovered from the chain

createCloak builds recoverable deposits and uses recipient discovery for you. With the low-level API, use createRecoverableDepositUtxo for every deposit and pass recipientViewingPublicKey on every send. The spend flows build recoverable change for you. If you call transact directly, build any output you own with createRecoverableChangeUtxo; transact throws on a self-owned output built with createUtxo.

The two-input rule

The circuit spends at most two notes per transaction. A payment larger than any two notes needs merges first. createCloak does this for you. With the low-level API, partialWithdraw and fullWithdraw merge on chain automatically, and if the call fails part way the merged note never reaches your storage. It is not lost, because a scan with the viewing key rebuilds it, but your app does not see it until that scan runs. Cap inputs at two and merge deliberately. See a withdrawal of three or more notes.

Two devices, one account

Two devices holding the same notes can both try to spend one. The second spend fails with DoubleSpend (0x1020). With the low-level API, run verifyUtxos on load and after any failure to drop spent notes.