Skip to content

docs(site): selective disclosure section, commitments & encryption guides, confidential use cases - #88

Merged
satran004 merged 5 commits into
mainfrom
docs/confidential-values-selective-disclosure
Oct 12, 2026
Merged

satran004 merged 5 commits into
mainfrom
docs/confidential-values-selective-disclosure

Conversation

@satran004

@satran004 satran004 commented Oct 11, 2026 •

Copy link
Copy Markdown
Member

Summary

This PR adds beginner-friendly docs for the new commitment and encryption features:

  • Pedersen commitments (ADR-0051)
  • exponential ElGamal (ADR-0052)
  • threshold DKG with HPKE share delivery (ADR-0053/0054)
  • confidential notes (ADR-0055)

It also adds a Selective disclosure section that explains what to use when. It's docs only: just www/, and nothing outside it.

New: Selective disclosure (top-level sidebar section)

  • Choose how to disclose (/selective-disclosure/): an interactive "one salary, six ways" explainer. It shows what Carol, a landlord, the tax authority and the public learn under each option, and includes a Help me choose question tree. A comparison table follows.
  • Six option pages, each with who-learns-what, short code, real-world uses, when not to use it, and pitfalls:
    • Reveal the value (BBS)
    • Prove a rule (Groth16 predicates over signed or committed credentials)
    • Hide a number (Pedersen)
    • Tell chosen readers (confidential notes)
    • Encrypt for an auditor (ElGamal plus a proof)
    • Split the trust (threshold ElGamal)
  • The BBS guide is unchanged apart from one tip pointing to the chooser.

New guides (Guides → Commitments & encryption)

  • Pedersen commitments, ElGamal encryption, Threshold decryption (DKG + HPKE board delivery), Confidential notes.
  • Every complete program and circuit was compiled and run against a 0.1.0-pre13 build (identical to main for these modules). Each page shows the output from that run, and the constraint counts match.

New Learn page

  • Commitments & encryption, explained, with two interactive explainers: the commitment one covers seal, hiding, open, add and prove; the encryption one covers key, encrypt, add, decrypt and split the key.

Use cases

Other updates

  • Status matrix, glossary, modules, API cheatsheet, AI starter pack, gadgets.
  • On-chain Groth16 costs re-measured at 6a89f8a after ADR-0056. CPU is about 22% lower:
    • 1 public input: 2,052,276,435 CPU / 138,837 memory;
    • each extra input adds about 0.14e9 CPU;
    • two inputs went from about 2.8e9 to about 2.2e9.
    • The BBS and PlonK figures were corrected too.
  • <SinceNotice since="0.1.0-pre13" /> marks pages whose APIs are newer than the published release. It disappears automatically once release.json points at a release that is on Maven Central at or after that version, and the AI Markdown exports get the same note.
  • check-api-refs now honours a block's own non-ZeroJ import of a type whose simple name matches a ZeroJ type (java.security.Signature vs EdDSAJubjub.Signature).

Merge order

This PR merges after zeroj-usecases PRs #8, #9 and #10. ZeroJ 0.1.0-pre13 is released, and those PRs now pin it.

  • The Try-it sections link to zeroj-usecases main and use ./demo.sh pedersen / ./demo.sh voting.
  • SinceNotice hides itself once www/release.json is bumped to 0.1.0-pre13. It still says pre12. This PR doesn't bump it; that is the release-step PR, as docs: mark ZeroJ 0.1.0-pre12 as released #72 was for pre12.

Hardened demos (b06e4a4)

The use-case pages describe the demos as hardened by zeroj-usecases #10 (ADR-0009). Changes:

  • Product passport: rebuilt around auditor-issued Pedersen commitments, the locked passport and the four claim circuits. A new explainer lets the reader run the 65,536-value search that broke the old design.
  • NFT gate: v2 nullifier, the sound list and CIP-8 registration.
  • Airdrop: holder-chosen identifier and the pay-once faucet. The page says only nullifiers are unlinkable, because the recipient is public.
  • Proof of reserves: salted leaves and locked attestation tokens.
  • Vouchers: tagged payouts.
  • Remaining limitations stated for solvency, payroll, points, auction, KYC and selective disclosure.
  • Design notes: the docs/usecases/*.md design notes get correction notes.

Every page was checked for accuracy against the hardened code, and the findings are fixed. The ADR-0009 links resolve once #10 merges.

Review fixes (d746b6d)

Responds to the review of b06e4a4:

  1. Binding wording. A blinding that opens C to any amount exists, which is what makes hiding perfect. The explainer now says Alice can't feasibly find a second opening.
  2. Payroll tax view. Salary totals count pay-run notes only, spent ones included, matching AuditorView.issuedNotes(). Transfer, cash-out and change notes are readable but not added. Fixed on the page and in the walkthrough.
  3. Product passport. The complete CarbonClaimProof listing imports java.util.List.
  4. Pedersen maturity. "Ready" covers ZkPedersen only. ZkPedersenCommitment is experimental, matching zeroj-circuit-lib/README.md. Fixed in the guide, the status page and the gadget matrix.

Private voting (d8632c0)

  • The page now describes the encrypted-ballot demo from usecases ADR-0005 as the design. Its circuit is PrivateBallotProof, which compiles to 9,477 constraints with 9 public inputs.
  • A new section, "Why not just hash the vote?", has an interactive explainer. Poseidon(vote, nullifier) is readable by anyone, because the nullifier is public and a vote is 0 or 1, so an observer can hash both choices and compare. Adding a salt stops that, but then nobody can count the votes. Encrypting the ballot fixes both.

Review and evidence

  • Snippet compilation: every complete circuit and main program on the new pages compiled and ran, with matching constraint counts; fragments were checked against the source signatures.
  • Independent reviews: Codex for technical accuracy, and a separate model for accuracy and beginner clarity. No P1 remained. The fixes included:
    • the eligible = 1 requirement in the predicate example;
    • "distinct handles A" for limb randomness;
    • threshold wording: any t + 1 decrypt, and 2t + 1 ≤ n is the fault rule;
    • the A3 wording, aligned with ADR-0055;
    • private voting described as n-of-n;
    • commitments not revealing totals by themselves;
    • delivery honesty not being enforced.
  • Visual QA: every component checked at 1280, 760 and 390 px, in light and dark mode, with layout fixes applied.

Test plan

  • npm run check: 0 errors, 0 warnings, 0 hints; check-api-refs reports 128 Java blocks and no unknown APIs.
  • npm run build plus check-site: 62 HTML pages, 60 Markdown twins and 5 AI artifacts, with links, anchors and repository paths verified.
  • Docs CI on this PR.
  • Maintainer read-through of the Selective disclosure section.

🤖 Generated with Claude Code

satran004 and others added 4 commits October 11, 2026 09:54
…ides, confidential use cases

Document the Pedersen, ElGamal, threshold DKG/HPKE and confidential-note work
(ADR-0051..0055) for beginners, and help readers choose between disclosure options.

- New "Selective disclosure" section: a chooser ("one salary, six ways" with a
  help-me-choose tree) and six option pages (reveal with BBS, prove a rule,
  hide a number, tell chosen readers, encrypt for an auditor, split the trust),
  each with short code and real-world uses. The BBS guide stays as it was, plus
  one pointer to the chooser.
- New guides (Guides > Commitments & encryption): Pedersen commitments, ElGamal
  encryption, threshold decryption (DKG + HPKE share delivery), confidential
  notes. Complete examples were compiled and run against a pre13 build.
- New Learn page "Commitments & encryption, explained" with interactive
  commitment and encryption explainers.
- New use cases with walkthroughs: confidential payroll, sealed-bid auction,
  confidential loyalty points, proof of solvency with hidden balances; private
  voting gains the encrypted-tally section (zeroj-usecases PR #8). The demos
  are on open zeroj-usecases PRs #8/#9 and the pages say so.
- Reference updates: status matrix, glossary, modules, API cheatsheet, AI
  starter pack, gadgets.
- On-chain Groth16 costs re-measured at 6a89f8a after ADR-0056 (1 input:
  2,052,276,435 CPU / 138,837 memory; +0.14e9 per input).
- SinceNotice component marks pages whose APIs are newer than the published
  release; check-api-refs honours non-ZeroJ imports of a same-named type.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Private voting now describes the encrypted-ballot demo (usecases ADR-0005)
as the design: ElGamal ballot, trustee key proofs, homomorphic tally, the
PrivateBallotProof circuit (compiled: 9,477 constraints, 9 public inputs)
and script-parameter pinning. A new "Why not just hash the vote?" section
with BallotPrivacyExplainer shows why Poseidon(vote, nullifier) is readable
by anyone (public nullifier, 0/1 vote), why a salt breaks the tally, and
why encryption fixes both. VotingWalkthrough shows the encrypted ballot.

Assuming zeroj-usecases #8/#9 and ZeroJ 0.1.0-pre13 land first: Try-it
sections point at main and ./demo.sh pedersen, branch/PR-pending notes
and "use a snapshot until release" prose are removed (SinceNotice still
hides itself once release.json reaches pre13), and demo cost notes say
they were measured before #85/#86.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…doesn't hide the vote

Poseidon(vote, nullifier) is decodable by anyone (public nullifier, 0/1
vote). Adds a correction note pointing to the encrypted ballot
(zeroj-usecases ADR-0005), and fixes the claims that the public can't
learn the vote (overview, who-sees-what table, circuit comment, tally
phase, security properties, MACI comparison). The registry analysis is
unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The use-case pages now describe the demos as they behave after the
privacy and binding hardening in zeroj-usecases (ADR-0009):

- Product passport: rewritten around auditor-issued Pedersen vector
  commitments, the locked, auditor-co-signed passport record and the
  four claim circuits; new PassportPrivacyExplainer lets readers run
  the 65,536-value search that broke the old keyed hash.
- NFT gate: circuit v2 nullifier with a holder secret, the sound
  insert-only list, event parameters, CIP-8 registration, and the trust
  shift to the indexer.
- Airdrop: holder-chosen identifier, one credential per person, epoch
  domain tag, recipient-bound payout, pay-once ledger; only nullifiers
  are unlinkable (the recipient is public).
- Proof of reserves: salted leaves, locked proof-checked attestation
  tokens, the browser check against the chain indexer.
- Vouchers (BBS, account recovery): outref-tagged payouts.
- Solvency, payroll, points, auction, KYC, selective disclosure and
  voting: the remaining limitations ADR-0009 states.
Walkthroughs updated to match; design notes in docs/usecases gain
correction notes. Reviewed for accuracy against the hardened code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@satran004

Copy link
Copy Markdown
Member Author

Reviewed PR head b06e4a4. The new documentation is mostly correct, but I recommend fixing these four issues before merging:

  1. [P2] Correct the Pedersen binding explanation.
    CommitmentExplainer.astro:131 says “No blinding makes a different amount match C.” A matching blinding exists for every value; finding an alternative opening is computationally infeasible. Suggested wording: “Alice cannot feasibly find a different opening.” This distinction underlies perfect hiding and computational binding. See Pedersen, §3.

  2. [P2] Clarify which notes count toward salary totals.
    confidential-payroll.mdx:81–83 says to total every note in the ledger's mint history. Transfers also create notes, including change, so following that description would double-count salaries. The implementation's AuditorView.issuedNotes() explicitly excludes transactions that consumed an existing note. Document salary issuance notes only, including subsequently spent ones, excluding transfer/change outputs.

  3. [P2] Add the missing import to the complete product-passport circuit.
    digital-product-passport.mdx:134–140 omits import java.util.List;. Direct compilation fails at both List.of(...) calls. Adding that import fixes compilation; the resulting 2,192 constraints match the page.

  4. [P2] Align Pedersen maturity labels with the module support matrix.
    pedersen.mdx:33 and start/status.md:77 include ZkPedersenCommitment under “Ready”. The module support matrix places that wrapper in the experimental homomorphic API. Keep the Ready label scoped to the established ZkPedersen gadget, or explicitly reconcile the status descriptions.

The main Pedersen guide otherwise correctly covers modulo-l binding, fresh blinding, range bounds, subgroup validation, vector schema binding and authenticated issuance.

Validation: Local site checks and build passed, including the API-reference and link checks. Eight runnable programs produced the documented results, and eight circuit-count checks matched. Direct Java compilation exposed the missing import despite the API checker passing. I did not rerun Yaci E2E tests.

Merge prerequisites: At review time, zeroj-usecases PRs #8, #9 and #10 were still open, and www/release.json still advertised pre12. The merge order described in this PR therefore remains relevant.

…s, DPP import, Pedersen maturity

1. CommitmentExplainer: a blinding that opens C to any other amount exists (perfect hiding);
   binding is computational, so the text now says Alice can't feasibly find a second opening.
2. Confidential payroll (page and walkthrough): salary totals count only the notes a pay run
   minted, spent ones included, as AuditorView.issuedNotes() does. Notes minted by a transfer or
   cash-out (including change) stay readable but are not added, which would double-count.
3. Digital product passport: the complete CarbonClaimProof listing imports java.util.List.
   Compiled verbatim against 0.1.0-pre13: 2,192 constraints, 4 public inputs, as the page says.
4. Pedersen maturity: Ready covers ZkPedersen only. ZkPedersenCommitment is part of the
   experimental homomorphic API, as in zeroj-circuit-lib/README.md (pedersen guide, status page,
   gadget matrix).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@satran004

Copy link
Copy Markdown
Member Author

Author reply · head d746b6d

Thanks. All four findings checked out against the code and specs, and all four are fixed in d746b6d.

# Finding Change Where
1 The binding explanation said no blinding matches a different amount "Try another number. Some blinding would make it match C, but Alice can't feasibly find it: that would mean finding a second opening." The narration also now says a second opening exists but can't feasibly be found. CommitmentExplainer.astro
2 Payroll totals would double-count Step 5 now counts only notes a pay run minted, spent ones included, as AuditorView.issuedNotes() does (it skips mints whose transaction consumed a ledger note). Transfer, cash-out and change notes stay readable but aren't added, because adding them would count a salary twice. The walkthrough's tax box now separates "Salaries: the pay run's notes" from "Also readable: notes made by spending", and its narration matches. confidential-payroll.mdx, PayrollWalkthrough.astro
3 import java.util.List; was missing Added. I compiled the listing as printed against released 0.1.0-pre13: 2,192 constraints, public inputs [schemaDigest, u, v, threshold]. A scan of every complete Java listing on the site found no other missing JDK imports. digital-product-passport.mdx
4 Pedersen maturity labels Ready now covers ZkPedersen only (commit, commitBits, verifyOpening). ZkPedersenCommitment is listed with the experimental homomorphic API, as in the module support matrix. The gadget matrix on the site had the same issue, and it is fixed too. pedersen.mdx, start/status.md, guides/circuits/gadgets.md

Checks:

  • npm run check: 0 errors, 0 warnings, 0 hints. check-api-refs: 128 Java blocks, no unknown APIs.
  • npm run build: check-site verified 62 HTML pages, 60 Markdown twins and 5 AI artifacts.
  • I checked the payroll walkthrough's tax step in the browser at 390 px: it renders, with no horizontal scroll.

Merge prerequisites. ZeroJ 0.1.0-pre13 is now released.

@satran004
satran004 merged commit 43c7b32 into main Oct 12, 2026
@satran004
satran004 deleted the docs/confidential-values-selective-disclosure branch October 12, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant