Pattern: Confidential Transfers
Privacy-preserving compliant transfers with encrypted balances and auditor access
Overview
Confidential transfers encrypt token balances and transfer amounts on-chain using ElGamal encryption. Only the account owner and an optional auditor can decrypt the actual values. This enables privacy-preserving compliance — investors can transact without publicly exposing their holdings, while regulators retain audit access.
Uses Token-2022's native ConfidentialTransfer extension. No custom program deployment needed.
Use Cases
- Privacy-preserving securities — hide investor positions from public view
- Regulatory compliance — auditor key gives regulators full visibility
- Institutional transfers — large block trades without front-running risk
- Fund management — portfolio positions hidden from competitors
Implementation
1. Create Mint with Confidential Extension
2. Configure Accounts for Confidential Transfers
Each account that will participate in confidential transfers needs its own ElGamal keypair and must be configured with the extension.
3. Deposit into Confidential Balance
Move tokens from the public balance into the encrypted confidential balance.
4. Confidential Transfer
Transfer encrypted amounts between accounts. The amount is hidden on-chain.
5. Withdraw to Public Balance
Move tokens back from confidential to public balance when needed.
Auditor Key Setup
The auditor ElGamal key is set at mint creation time. The entity holding the auditor secret key can decrypt all confidential transfer amounts for the mint.
Without an auditor key: balances are only visible to account owners. Set auditorElGamalPubkey to enable regulatory oversight.
Key Points
- Balances are encrypted on-chain using ElGamal — only the owner (and auditor) can decrypt
- Transfers use zero-knowledge proofs to validate correctness without revealing amounts
- The public balance and confidential balance are separate — use
deposit()andwithdraw()to move between them applyPendingBalance()must be called after receiving a deposit or transfer- No custom program needed — uses Token-2022's built-in ConfidentialTransfer extension
- The auditor key is optional but recommended for regulatory compliance
- Confidential transfers can be combined with other Sinai Standard hooks (allowlist, tax, hold period) via the Router Hook