Repository navigation
Description
Summary
Write ADR-0055: confidential notes on Jubjub. Each confidential value is a note: a pedersen-jubjub-v1 commitment held in a script output's datum, together with its opening (v, r) delivered on-chain to the note's readers (the owner and optional auditors) by Diffie–Hellman (ECDH) on Jubjub. An optional in-circuit consistency proof shows that the delivered opening matches the commitment.
Twisted ElGamal is deferred. It is kept as a possible later decision, only for account-shaped balances (D4).
How the profiles fit together:
| Need | Tool |
|---|---|
| Notes, each read on its own (points, payments, payroll, solvency entries) | This ADR: Pedersen commitment + DH-delivered opening |
| Trustees jointly decrypt a sum (tallies, voting) | elgamal-jubjub-v1 (ADR-0052) + threshold (ADR-0053) |
| One account-shaped balance that others top up, read from a single ciphertext without scanning history | Twisted ElGamal: deferred (D4) |
Problem
In the ZeroJ Pedersen demos (zeroj-usecases PR #8), amounts are hidden as commitments in datums. But the openings travel off-chain: the README says they are "delivered off-chain … in-process". A recipient (or auditor) therefore cannot recover a note from chain data, and nothing guarantees that a note sent to them is even openable by them.
Our state is note-shaped:
PointsLedgerstoresNote(owner, u, v)as each UTxO's inline datum;- a transfer spends one note and creates new ones.
So each note is read on its own, which is exactly the case DH delivery serves best.
Proposed design (to be pinned and verified in the ADR, not assumed)
D1: the note and its delivery
C = [v]·G + [r]·H (pedersen-jubjub-v1, unchanged)
E = [e]·G (per-note ephemeral key, non-identity)
s_i = [e]·P_i (= [sk_i]·E) (shared secret with reader i)
ct_i = AEAD/mask under KDF(s_i, context) of the opening
datum ⊇ (C, E, {ct_i}) (owner first, then auditors, in a fixed order)
receive: recompute s_i, decrypt, and **require C == [v]·G + [r]·H** before accepting the note
Open choices for the ADR:
- (a) Encrypt
(v, r)explicitly. - (b) Derive
rfrom the shared secret and mask onlyv. Note: with (b), hiding becomes computational, and it complicates multiple readers.
Lean: (a).
D2: readers
- The owner's viewing key, plus auditor keys chosen per application. Auditors get their own
ct_i; the owner's key is never handed out. - The application's validator may require a ciphertext for each registered auditor key.
- Viewing keys are separate from spending and signing keys, and registered with a proof of possession.
- Wallets discover their notes by trial decryption over the script address (one DH per note).
D3: optional in-circuit consistency proof (verifiable delivery)
The transfer's Groth16 proof can additionally show that each ct_i decrypts under P_i to the opening of C.
This closes the residual a plain DH design must accept: an output its recipient cannot open. Closing it needs a circuit, and ZeroJ validators already verify a Groth16 proof on every transfer, so the added cost is circuit-side:
- one fixed-base
[e]·G; - one variable-base
[e]·P_iper reader; - the KDF and cipher.
Estimate: a few thousand constraints per reader, to be measured. On-chain Groth16 cost grows only with the extra public inputs.
Use cases where this matters:
- payroll (no "unreadable salary" notes);
- regulated tokens (the auditor is guaranteed to be able to read every transfer).
It is optional per application.
D4: twisted ElGamal (deferred)
Twisted ElGamal is reconsidered only if a usecase needs an account-shaped balance (one UTxO or map entry updated in place by many parties) that must be readable from a single ciphertext without scanning history.
On Cardano such a shape also has concurrency costs: two senders contend for one UTxO. Notes avoid that, because payments create new outputs and the owner merges them later.
If it is ever needed, the earlier analysis still applies:
- PGC (Chen, Ma, Tang, Au; ePrint 2019/319), keys on base
H, so the commitment half is apedersen-jubjub-v1commitment; - bounded discrete-log decryption, with limbs for large values;
sk⁻¹-based decryption, so ADR-0053's threshold DKG does not apply.
Curve: Jubjub (unchanged reasoning)
- ECDH on Jubjub keeps D3 native in BLS12-381 circuits. With ristretto255 or Curve25519, the same proof would need non-native arithmetic (cf. the ADR-0027 Ed25519 gadget cost).
- Plutus cannot verify ristretto255 today. If Plutus ever gains ristretto255 builtins, revisit Ristretto for interop only.
- The commitment stays
pedersen-jubjub-v1, so ADR-0051's gadgets andZkPedersen.assertBalancedare reused unchanged.
Design lessons to carry into the ADR
- DH over handles for note-shaped (eUTXO) state. Each note is decrypted on its own, so handles add size and bounded decryption without benefit.
- Ephemeral-key uniqueness. With deterministic
e, conflicting rebuilt transactions repeat the key stream (a two-time pad) unless an attempt nonce is mixed in. Randomeavoids this but loses the ability to re-derive outgoing payments from the sender's key (outgoing auditability). The ADR must decide. - Recipient-side check that
Copens before a note is accepted.
Questions the ADR must settle
- KDF and cipher, pinned (R3, do not invent).
- Off-circuit only: a standard construction. For example, Zcash Sapling's Jubjub key agreement + BLAKE2b KDF + ChaCha20-Poly1305 (same curve; pin the Zcash protocol spec version and sections), or HKDF (RFC 5869) + AEAD.
- For D3: a circuit-friendly KDF and cipher (Poseidon-based) with a published, pinned construction and analysis. Candidates to examine: "Encryption with Poseidon" (Khovratovich), and Dusk Network's Jubjub + Poseidon-cipher note encryption. Both still need verifying.
- Does the off-circuit and in-circuit split mean two profiles, or one circuit-friendly profile for both?
- Opening encoding: D1 option (a) or (b), and the binding context (script hash, output reference, note index, reader index).
- Ephemeral key: random versus deterministic plus attempt nonce.
E ≠ O, canonical, in the subgroup. - Reader set: owner and auditors, their order, validator-enforced auditor requirements, and key registration and rotation (with a proof of possession).
- Datum layout and size: about 32 bytes for
Eplus about 40–64 bytes per reader (estimate), and the min-ADA impact. - Validator obligations (not provided by any proof):
ScriptContextbinding;- owner authorization;
- replay;
- binding the datum fields to the proof's public inputs;
- the auditor-key registry's integrity.
- Leaks over time. On-chain ciphertexts persist, so a later viewing-key compromise exposes history, and X25519/Jubjub DH is not post-quantum. Decide on key rotation and generations (cf. ADR-0054: encrypted DKG share delivery (HPKE RFC 9180) — resolve ADR-0053 Q1 #77's per-session-key reasoning).
- Secrets on the host.
sk_view,eand decryption run in the variable-time BigInteger Jubjub code, which is ADR-0039's compatibility/offline class. There is no constant-time claim; state the wallet-side implications.
Verification strategy
- An independent Python reference (Jubjub ECDH + the pinned KDF and cipher) produces the spec vectors. No expected values come from the Java code.
- Published vectors for the pinned primitives, for example Zcash Sapling note-encryption test vectors, if Sapling is chosen.
- Cross-check that the commitments equal the existing
pedersen-jubjub-v1reference vectors. - Negatives:
- wrong reader key;
- a tampered
Eor ciphertext; E = Oor a non-subgroup point;- a repeated ephemeral key or nonce;
- an opening that does not match
C(rejected by the recipient check); - the D3 proof with a mismatched ciphertext.
- Circuit invalid-witness tests for D3, and Groth16 prove/verify with every public input shown to be bound.
- DevKit E2E: migrate the confidential-points demo (and optionally the solvency demo) from off-chain openings to on-chain delivery, with an auditor view.
Suggested milestones
- M0: normative spec
docs/specs/<profile>.mdplus Python vectors. - M1: host API: encrypt and deliver, scan and decrypt, the recipient check, reader keys.
- M2: the D3 circuit relation (an in-circuit KDF and cipher, plus Jubjub ECDH).
- M3: usecase migration on DevKit (points; solvency optional).
- M4: docs and the support matrix (Experimental).
Ordering and dependencies
- Number 0055 (0054 = ADR-0054: encrypted DKG share delivery (HPKE RFC 9180) — resolve ADR-0053 Q1 #77).
- Starts after ADR-0052 M1 (PR feat(elgamal): ADR-0052 ElGamal on Jubjub + ADR-0053 threshold DKG — accepted designs and implementation #76).
- Independent of ADR-0053.
- Shares the "ciphertexts persist on a public board" analysis with ADR-0054: encrypted DKG share delivery (HPKE RFC 9180) — resolve ADR-0053 Q1 #77.
References (to pin at exact versions in the ADR)
- Zcash Protocol Specification: Sapling key agreement, KDF and in-band secret distribution (pin the version and sections).
- RFC 5869 (HKDF); RFC 8439 (ChaCha20-Poly1305).
- D. Khovratovich, "Encryption with Poseidon" (to verify), and the Poseidon parameters ZeroJ already uses.
- Y. Chen, X. Ma, C. Tang, M. H. Au. PGC. ePrint 2019/319, for the deferred D4.
- RFC 9496 (ristretto255), for the alternative considered.
- ZeroJ:
- ADR-0051 and
docs/specs/pedersen-jubjub-v1.md; - ADR-0052 and ADR-0053 (PR feat(elgamal): ADR-0052 ElGamal on Jubjub + ADR-0053 threshold DKG — accepted designs and implementation #76);
- ADR-0039;
- ADR-0037;
- ADR-0027;
- ADR-0054: encrypted DKG share delivery (HPKE RFC 9180) — resolve ADR-0053 Q1 #77.
- ADR-0051 and
Activity
beanbot-gh commentedon Oct 5, 2026
Design rationale: why confidential notes with DH opening delivery, rather than twisted ElGamal.
Why:
PointsLedger:Note(owner, u, v)), and each note is read on its own.The original twisted-ElGamal analysis (PGC mapping with keys on
H, bounded decryption, no threshold) is kept under D4 for if it is ever needed.