Overview
Starkzap supports confidential (privacy-preserving) transfers through the Tongo protocol. Using the Tongo SDK, users can perform confidential transfers (amount is obfuscated) on Starknet. What users can do with confidential:- 🔐 Transfer confidentially - Send to another confidential account by recipient public key; amounts are hidden on-chain
- 📋 Compliance and auditing - Tongo provides flexible auditing mechanisms that enable compliance without sacrificing user privacy. Through viewing keys and ex-post proving, regulators can verify transaction details while preserving confidentiality for all other parties.
- ⚡ Ragequit — Exit full balance and rollover (activate pending balance)
The Tongo private key is separate from the Starknet wallet key. Your app must create and hold a
TongoConfidential instance with the user’s Tongo key and the correct Tongo contract address for the chain.Configuration
Create aTongoConfidential instance with the Tongo contract for your chain, the user’s Tongo private key, and an RPC provider (typically the wallet’s provider).
contractAddress per chain. There is no wallet-level “register confidential”; you pass the TongoConfidential (or any ConfidentialProvider) into the tx builder methods.
TongoConfidential: address and state
Tongo address (for display or sharing):recipientId with others so they can send confidential transfers to this account. It is the public key { x, y } used on-chain:
ConfidentialState shape
Unit conversion (optional)
Convert between public ERC20 amounts and confidential (Tongo) units when you need to display or validate amounts:Funding a confidential account
Convert public ERC20 into confidential balance. The tx builder calls the provider’sfund() method, which returns the approve call (if needed) and the fund call.
Confidential transfer
Send from this confidential account to another confidential account. The recipient is identified by theirrecipientId (public key).
Withdrawing to a public address
Convert confidential balance back to ERC20 and send to a Starknet address.Tongo-specific: ragequit and rollover
Ragequit — Exit the entire confidential balance to a public address in one call. Use when the user wants to close the confidential account or move everything on-chain.Batching with the transaction builder
You can combine confidential operations with transfers, approvals, or other builder methods:| Method | Description |
|---|---|
.confidentialFund(confidential, details) | Fund confidential account (includes approve when needed) |
.confidentialTransfer(confidential, details) | Transfer to another confidential account |
.confidentialWithdraw(confidential, details) | Withdraw to a public Starknet address |
confidential.ragequit(...) / confidential.rollover(...) and add the returned calls with .add(...calls).
Best practices
- Keep the Tongo key separate from the Starknet wallet key; treat it as sensitive user data and protect it accordingly.
- Use the same Tongo contract address as the rest of your app (same chain) so all operations are consistent.
- Check state before withdraw — ensure
state.balance(and pending if needed) is sufficient; usetoPublicUnits/toConfidentialUnitsif you need to show human-readable amounts.
Troubleshooting
Wrong contract or chain
EnsurecontractAddress matches the Tongo deployment for the wallet’s chain. A mismatch can lead to failed transactions or wrong state.
Fund fails or “approve” errors
The provider includes the approve call infund(); if the token or spender is non-standard, you may need to approve manually before calling the builder. Verify the token is the one supported by the Tongo contract.
Recipient format for confidential transfer
to must be a ConfidentialRecipient — the object { x, y } from the recipient’s confidential.recipientId. Do not pass a Starknet address; use the recipient’s Tongo public key.
Next steps
- Bitcoin, Stablecoins, and Tokens — Token presets and amounts
- Transactions — Execution options
- Tx Builder — Batching and builder method list
- API Reference — Full method signatures