Protocol

Keys and disclosure

Your confidential balance is readable by exactly one key, and it is not the key you sign transactions with. It is derived on your device, stored nowhere else, and the only way another party ever reads your amounts is if you hand them the means.

Two keys, one wallet

A confidential account involves two independent pieces of cryptography that people routinely conflate. The wallet keypair authorises instructions. The ElGamal keypair encrypts and decrypts amounts. They are different curves used for different jobs, and neither can do the other one's work.

The ElGamal public key is written into the token account's confidential transfer extension, where anyone can read it. That is intended: a sender needs it to encrypt an amount to you, and the proof program needs it to check the ciphertexts a transfer carries. The secret half never appears in a transaction, an account or a log.

Signing keypaired25519, held by your wallet. Authorises instructions, pays fees, proves ownership. It never decrypts anything.
ElGamal keypairOver curve25519. The public half sits in the account and is readable by anyone. The secret half decrypts your balance and is an input to the proofs a transfer carries.
Symmetric keyAn AES-style key, derived the same way, that encrypts the decryptable balance the owner keeps beside the ciphertext.
What the protocol holdsNone of it. There is no server-side key store, no escrow and no recovery path.

How the key is derived

The ElGamal secret is not generated at random and then saved somewhere. It is derived deterministically from a signature your wallet produces over a fixed, domain-separated message. The signature bytes are hashed into a scalar, and that scalar is the secret. The same wallet signing the same message tomorrow, on a different machine, in a different browser, produces the same key.

sig = wallet.sign(DERIVATION_MESSAGE)

elgamal_secret = hash_to_scalar(sig)
symmetric_key  = kdf(sig)

That property is the whole design. Your seed phrase is already a backup of your ability to decrypt, because the key is a function of it: no second secret to write down, no export file to lose, no state that has to survive a cleared browser. Implementations typically bind the message to the token account as well, so one wallet derives a distinct key per confidential account.

Two things follow, and the second one is uncomfortable. The first is that the protocol cannot help you: it never receives the key, so it cannot escrow, reset, freeze or subpoena it. The second is that the signature over that message is the key. Anyone who persuades your wallet to produce it can derive your decryption capability. The prompt looks harmless because it moves no funds, which is exactly what makes it dangerous.

Signing is not spending, but it can be disclosing
Read what you sign. A message signature that transfers nothing can still hand over the ability to read every amount in your account, and unlike a malicious transfer it leaves no trace on chain.

Derivation assumes your wallet signs deterministically. Ed25519 as Solana specifies it derives its nonce from the key and the message, so the same input yields the same signature. A wallet that randomised its signatures would derive a different key on every attempt, and the balance encrypted under the first would stop being readable.

The decryptable balance

ElGamal ciphertexts are additively homomorphic, which is what lets the token program credit an incoming transfer to your account while you are offline and without anything being decrypted. The cost of that property is that turning a ciphertext back into a number is real work.

So the account stores the same figure twice. Once as the ElGamal ciphertext, which the program can do arithmetic on. Once as the decryptable_available_balance, the same number encrypted under your symmetric key, which only you can read but can read instantly. Opening the app and seeing a balance is one symmetric decryption, not a search.

The owner supplies a fresh decryptable balance with every instruction that changes the available balance. The program cannot check that this blob agrees with the ciphertext, because it cannot read either one. A client that writes the wrong value hurts only the owner, and the fix is to decrypt the ElGamal side the slow way and replace it.

The credit counter is public
Incoming transfers wait in a pending balance until you apply them, and the account's count of those credits is readable on chain. An observer sees no amount, but sees how many transfers arrived and when you applied them.

Why balances use limbs

The scheme is exponential ElGamal: the amount is carried in the exponent, which is what makes ciphertexts addable. Decryption recovers a group element, and extracting the number from it means solving a discrete logarithm. There is no formula. You search.

The search is bounded, because the plaintext is an amount in a known range and a square-root method walks that range far faster than a naive scan. A narrow range is ordinary work on a laptop. A full 64-bit range is not something you do while a user waits.

So amounts are not handled as one large integer. A balance and a transfer amount are split into limbs, each narrow enough to recover, and the verifier arithmetic recombines them. That is why a transfer carries several ciphertexts rather than one, and why the largest representable confidential amount is below a full u64. Read the exact limb widths out of the implementation rather than assuming them.

EncryptionExponential ElGamal over curve25519
DecryptionRecovering a bounded discrete logarithm, one limb at a time
Fast pathRead the decryptable balance: a single symmetric decryption
Slow pathSearch each limb. Used for recovery, audit, and whenever the decryptable balance is missing or stale.
Practical ceilingBelow a full u64, because every limb has to stay inside a searchable range

Viewing keys and selective disclosure

Proving a balance to one party without publishing it is a routine requirement. An auditor wants your year-end position, a lender wants to see collateral, an exchange wants evidence the funds exist. There are three ways to satisfy them and they are not equally sharp.

  • The ElGamal secret. The blunt instrument. Whoever holds it can read every amount encrypted under that key, in both directions in time, for as long as the account uses it. It is a standing capability, not a one-off answer.
  • The symmetric key. Narrower. It opens the decryptable available balance and nothing else, so the holder sees what you have but not the ciphertexts of individual transfers. Still standing, still irrevocable while that key is in use.
  • An equality proof. The sharp one. Publish the plaintext amount to that party together with a proof that it matches the ciphertext in the account. The native ZkElGamalProof program verifies statements of this shape, so the counterparty checks the number against the chain without gaining any ability to read anything else, now or later.

All three originate with the holder. There is no global disclosure switch, no administrative key that reveals everyone, and nothing for a third party to compel out of the protocol, because the protocol never had it. That is the sense in which this is not a backdoor, and equally the sense in which it protects you from nothing once you act: a key you hand over is a copy, not a loan. The recipient can pass it on, lose it or be compelled to produce it, and you will not know. Prefer the proof wherever the other party will accept it.

The auditor key on a mint

The extension allows a mint to carry an optional auditor ElGamal public key. When one is configured, every confidential transfer of that token must include an additional ciphertext of the amount encrypted to the auditor, and the proof program checks that it encrypts the same value. The auditor can then decrypt transfer amounts for that mint without holding anyone's personal key.

The structural fact that matters is where this setting lives. It is a property of the mint, stored in the mint account and readable by anyone, including by you before you create an account or accept the token. It cannot be switched on for one holder quietly, and no wallet or frontend can do it to you. The decision point is whether you hold that token.

Two caveats. An auditor key covers transfer amounts rather than your balance, though a full transfer history plus the public deposits and withdrawals usually pins a balance down anyway. And the authority that configures the mint can generally change the key later, so a live configuration authority means the auditing can change under you.

Check the mint, not the app
Whether a mint has an auditor key, and whether the authority that can set one still exists, is public on chain. Read both before opting in. Neither is a per-user setting you can override afterwards.

Key loss and rotation

If you lose your wallet seed, you lose the ability to derive the ElGamal key, and the balance ciphertexts become unreadable. There is no reset, no recovery email and no support path that ends differently. This is the same bargain as self-custody generally, and it is the direct cost of the protocol never holding your key.

What you do not lose by handing out a viewing key is the funds. Reading and spending are separate: moving a balance needs the owner's signature as well as the proofs, so a party with your ElGamal secret can watch but cannot take. That asymmetry only matters for keys you share deliberately, because anyone holding the seed has both.

Restoring, then, is restoring the wallet. The one dependency is that the restored wallet must produce the same signature over the same message. A device that refuses to sign plain messages, or a wallet that derives a different account from the same seed, leaves you holding funds you cannot read.

Rotation and its limits

No instruction re-encrypts an existing balance under a new key in place. Rotating means draining the confidential side back to the public balance, proving it is empty, configuring the account with the new key, and depositing again. Two of those steps cross the public boundary with the amount in the clear, which is itself information.

Rotation also does less than people expect. The chain keeps the old ciphertexts, so whoever holds the old key keeps the history they could already read. Rotation changes who reads what happens next, and nothing about what already happened. And because keys here are derived rather than chosen, a new key means a new derivation input, a different message or a different wallet, which is now a thing you have to remember. That reintroduces the second secret the scheme exists to avoid.

Rotation protects the future, never the past
Treat a disclosed key as permanently disclosed for everything it has already seen. If that is not acceptable, the answer is to use an equality proof instead of handing over a key in the first place.

For what all of this does and does not protect against once the keys are correct, read the threat model.