Protocol
Note encryption
Every output carries a fixed 113-byte ciphertext, emitted on-chain. It has the same shape as Zcash Sapling's in-band encryption, on BabyJubJub.
e ← uniform in [1, l)
E = e · B8
S = e · V (V = recipient viewPub)
okm = HKDF-SHA256(pack(S), salt="sei-private-pay/v1/note-enc",
info = pack(E) ‖ pack(V), L = 44)
key = okm[0..32], nonce = okm[32..44]
pt (64B) = kind ‖ tokenId (1B) ‖ amount (12B) ‖ blinding|linkSecret (32B) ‖ 0x00 × 18
ad = "spp-note-v1" ‖ chainId (32B) ‖ pool (20B) ‖ commitment (32B)
output = 0x01 ‖ pack(E) ‖ ChaCha20-Poly1305(key, nonce, pt, ad)
eis fresh per output, so a key and nonce pair is never reused.- The chain, pool and commitment are in the associated data, so a ciphertext copied to another commitment or deployment fails to open.
- Dummy outputs are encrypted too, so ciphertext count and size reveal nothing.
- Kind
0x01is an ordinary note. Kind0x02is a link note encrypted to the sender, carrying the link secret so the sender can recover unclaimed links.
Scanning
For each ciphertext, the wallet tries its view key. If the tag verifies, it recomputes the commitment from the plaintext and its own ownerPub, and accepts the note only if that equals the on-chain commitment. A forged ciphertext that decrypts can't create a phantom balance.
Sender self-check
Before submitting, the app decrypts each of its own outputs using the exact associated data the chain will emit and recomputes the commitment. Any mismatch aborts before signing (Spec §8.2). It can't catch a sender who encrypts to the wrong view key, which is why an address is always used as one unit.
Test vectors: test-vectors/note-encryption.json, cross-checked against Node's own HKDF and ChaCha20-Poly1305.
Source: apps/web/content/docs/note-encryption.md