Skip to main content

ConfidentialClient

The ConfidentialClient wraps Token-2022’s Confidential Transfer extension, providing account configuration, deposits, withdrawals, and balance management with encrypted balances.

Account Configuration

Before an account can send or receive confidential transfers, it must be configured with an ElGamal keypair:
This:
  1. Derives deterministic ElGamal and AES keys from the owner keypair + mint
  2. Generates a pubkey validity proof (via WASM)
  3. Submits the configuration transaction

Deposit

Move tokens from the public balance into the confidential balance:

Apply Pending Balance

Incoming confidential transfers accumulate in a pending balance. Apply them to the available balance:
After receiving MAX_PENDING_BALANCE_CREDIT_COUNTER (65,536) incoming transfers, you must apply the pending balance before receiving more.

Withdraw

Move tokens from the confidential balance back to the public balance:

Balance Queries

getConfidentialAccountState(tokenAccount)

getDecryptableBalance(tokenAccount, ownerKeypair, mint)

Decrypt the current available confidential balance:

Credit Controls

enableConfidentialCredits(tokenAccount)

Allow the account to receive confidential transfers.

disableConfidentialCredits(tokenAccount)

Block incoming confidential transfers.

enableNonConfidentialCredits(tokenAccount)

Allow the account to receive non-confidential (public) transfers.

disableNonConfidentialCredits(tokenAccount)

Block incoming non-confidential transfers.

Cryptographic Functions

These standalone functions are also exported for advanced usage:

Key Derivation

Keys are derived deterministically from the owner keypair and mint address, so they can be re-derived without storage.

Encryption & Decryption

Proof Generation

Amount Limits

Confidential transfers are limited to amounts representable in 48 bits: max_amount=2481=281,474,976,710,655\text{max\_amount} = 2^{48} - 1 = 281{,}474{,}976{,}710{,}655 With 6 decimals, this is approximately 281 billion tokens — more than sufficient for any practical use.
Last modified on February 8, 2026