Skip to content

ADR-0055: confidential notes on Jubjub — DH opening delivery + optional in-circuit consistency proof (twisted ElGamal deferred) #79

Open

Description

@beanbot-gh

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:

  • PointsLedger stores Note(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 r from the shared secret and mask only v. 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_i per 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 a pedersen-jubjub-v1 commitment;
  • 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 and ZkPedersen.assertBalanced are 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. Random e avoids 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 C opens before a note is accepted.

Questions the ADR must settle

  1. 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?
  2. Opening encoding: D1 option (a) or (b), and the binding context (script hash, output reference, note index, reader index).
  3. Ephemeral key: random versus deterministic plus attempt nonce. E ≠ O, canonical, in the subgroup.
  4. Reader set: owner and auditors, their order, validator-enforced auditor requirements, and key registration and rotation (with a proof of possession).
  5. Datum layout and size: about 32 bytes for E plus about 40–64 bytes per reader (estimate), and the min-ADA impact.
  6. Validator obligations (not provided by any proof):
    • ScriptContext binding;
    • owner authorization;
    • replay;
    • binding the datum fields to the proof's public inputs;
    • the auditor-key registry's integrity.
  7. 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).
  8. Secrets on the host. sk_view, e and 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-v1 reference vectors.
  • Negatives:
    • wrong reader key;
    • a tampered E or ciphertext;
    • E = O or 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>.md plus 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

References (to pin at exact versions in the ADR)

Activity

  1. beanbot-gh commented on Oct 5, 2026

    @beanbot-gh
    Author

    Design rationale: why confidential notes with DH opening delivery, rather than twisted ElGamal.

    Why:

    • Our state is note-shaped. Amounts are commitments in script datums, one note per UTxO (PointsLedger: Note(owner, u, v)), and each note is read on its own.
    • For notes, DH delivery beats twisted-ElGamal handles:
      • full 64-bit amounts;
      • the blinding is delivered too, so the recipient can spend;
      • no discrete-log tables.
    • Twisted ElGamal only wins for account-shaped balances (one ciphertext updated in place by many parties, read without scanning history). On Cardano that shape also has UTxO contention, and no current ZeroJ usecase needs it.
    • ZeroJ validators already verify a Groth16 proof per transfer. So an optional in-circuit proof that the delivered opening matches the commitment (D3) is cheap. It makes "unopenable note" impossible and auditor access enforceable.

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions