Skip to content

Confidential notes (ZeroJ ADR-0055 M3): points, payroll, sealed-bid auction, solvency deliveries - #9

Closed
satran004 wants to merge 14 commits into
feat/pedersen-private-ballot-and-demosfrom
feat/confidential-notes-m3
Closed

satran004 wants to merge 14 commits into
feat/pedersen-private-ballot-and-demosfrom
feat/confidential-notes-m3

Conversation

@satran004

@satran004 satran004 commented Oct 10, 2026 •

Copy link
Copy Markdown
Member

Summary

ZeroJ ADR-0055 (confidential-note-jubjub-v1, ZeroJ PR #82, merged 1e78c6f) assigns milestone M3 to this repository. This PR delivers it and adds three end-to-end use cases. Each has a Java backend, Plutus V3 validators, Groth16 circuits and a Svelte tab, and each runs on Yaci DevKit.

Stacked on #8. The base branch is feat/pedersen-private-ballot-and-demos, so review only the commits after 7ad844f.

Commit Scope
f9d6f7f Pins ZeroJ 0.1.0-pre13-1e78c6f-SNAPSHOT (local snapshot of ZeroJ main after #82; superseded by db93967)
7ca179e ADR-0007 (confidential notes in the Pedersen demos), ADR-0008 (sealed-bid auction), ADR-0006 revision note
3654128 M2: AuditorRegistry, a one-shot singleton whose possession proofs (DLEQ, Groth16) are verified on-chain at registration and rotation
7420609 M3a–M5: NoteLedger (points: trusted issuance; payroll: proof-enforced issuance), v2 note circuits with D3a limbs, wallet and auditor recovery from chain data, solvency deliveries
f42991c Fixes from the implementation reviews (Claude and Codex)
aee5b92 M6: sealed-bid auction with enforced disclosure (ADR-0008)
a8cc876 Root Gradle wrapper (9.2.0) so the root aggregate tasks and ./gradlew -p <module> … run without a local Gradle
db93967 Pins ZeroJ 0.1.0-pre13-458bfb1-SNAPSHOT, published by ZeroJ's snapshot workflow to https://repo.bloxbean.org/maven/snapshots. Every build lists that repository, restricted to org.zeroj snapshots. Its jars' classes are identical to 1e78c6f's; only the validator order in zeroj-onchain-julc's plutus.json differs, with the same code and hashes.
1532c87 Demo startup: about 25 min → about 2.5 min. bootRun no longer disables the C2 JIT; each cached key file is validated once and shared across demos, with a demo's circuits loaded in parallel; faucet top-ups are serialized (concurrent ones made payroll fail to start)
eb333be Pins ZeroJ 0.1.0-pre13-6a89f8a-SNAPSHOT, the release candidate from ZeroJ main
f7b511e, f361737 Merge #8's build fixes: the ZeroJ 0.1.0-pre13 release pin, Docker demos built from version.properties, and the missing Gradle wrapper jars

Use cases (each has a UI tab and a backend)

  • A. Confidential points (reworked). Notes now carry their deliveries on-chain:

    • an 89 B owner opening and an 89 B auditor opening;
    • two 32-bit elgamal-jubjub-v1 limbs, which the transfer and redeem proofs bind to the commitment (ADR-0055 D3a, the direct layout of spec §8.2).

    Wallets and the auditor recover everything by scanning the chain. The auditor key comes from the registry and can be rotated. Cheats: garbage delivery, under-reported issuance, retired key, stake-variant output, stealing a note.

  • Confidential payroll (new). Issuance is proof-enforced (ADR-0055 Q9(b)): the employer cannot under-report a salary to the tax authority, and the tax view reads every salary ever paid from the mint history.

  • Sealed-bid auction (new). Each bid is encrypted to the auctioneer, with a proof that reserve ≤ bid ≤ deposit, so a bidder cannot refuse to reveal. The auctioneer proves the settlement in zero knowledge: earliest highest bid wins, and losing bids are never published. Payouts are tagged (policy, lot token). Anyone can refund after the deadline.

  • C. Solvency. Each customer entry carries an opening delivery, and the auditor gets the aggregate opening of ΣC.

ADR-0055 M3 exit criteria

  • (a) Address policy. Every output under the ledger's payment credential must be at the exact enterprise address. A stake-variant note is refused in VM tests, on DevKit and in the UI.
  • (b) Limbs. Limbs are produced only by ElGamal.encryptWithOpening, under the key context of a registry key whose possession has been verified. Main code has no use of the reference test's Limb.of. SecretPathSourceTest fails if main code calls the variable-time .scalarMul(.

Try it

With Yaci DevKit running and Java 25, from the repository root:

./gradlew -p pedersen-commitments bootRun -PwithFrontend   # http://localhost:8093

With cached keys, every tab is ready about 2.5 minutes after the server starts: the cached keys are re-validated point by point on each start. The very first start also generates the keys, which takes longer.

Measurements

These are percentages of the protocol's per-transaction limits, for the complete transaction. Each transaction is asserted against ADR-0055's 80% gate. The full tables are in ADR-0007 and ADR-0008.

Transaction Steps (DevKit) Memory (DevKit)
Note transfer 76.8% 16.2%
Note redeem 58.3% 12.7%
Payroll pay run, 2 salaries 72.2% 14.3%
Registry init / rotate 77.8% / 78.3% —
Auction bid 50.9–51.1% 21.6–22.2%
Auction settle, 3 bids 65.8% 25.7%

Test plan

  • ./gradlew buildAllUsecasesNoTests plus account-ownership and reusable-kyc: every module builds against the published snapshot
  • Every module re-tested on the 0.1.0-pre13-6a89f8a-SNAPSHOT release candidate. The 0.1.0-pre13 tag differs from it only in ZeroJ's version line.
  • ./gradlew test (pedersen-commitments): 38 tests, 0 failures (the 5 DevKit tests are skipped without ZEROJ_YACI_E2E)
  • ZEROJ_YACI_E2E=true on Yaci DevKit: PointsNotes, Payroll, Auction, Solvency, CreditGate and DevKitPadding all pass
  • Mutation (guard-revert) runs on the registry and ledger guards; VM mutation suites for NoteLedger, AuditorRegistry and SealedBidAuction
  • Browser walkthrough (Playwright, bootRun -PwithFrontend) of all five tabs. Every honest flow and every cheat behaves as described. The browser console has only the expected 422/403 responses to cheats, and the server logged no errors.

Points needing a maintainer decision / external review

  • Settlement decryption relation (ADR-0008 D4). It reuses ZkElGamal.encrypt(m_i, sk, key = A_i) == (PK, B_i). ZeroJ's specs define no decryption relation, so this composition is our own argument and needs external review.
  • Possession on-chain. Registry possession proofs are verified on-chain (about 78% of the step limit). Governance of who may register an auditor is out of scope.
  • Trust in the auctioneer. The auctioneer sees every bid; it is trusted for confidentiality, not for the outcome.
  • Demo server. It holds all keys and scans on users' behalf. Real wallets would scan for themselves (ADR-0055 D9).
  • ZeroJ pin. It is now the released 0.1.0-pre13, from Maven Central. Its tag (ff124c2) differs from the 6a89f8a snapshot tested here only in ZeroJ's version line.

Do not merge before #8.

🤖 Generated with Claude Code

satran004 and others added 9 commits October 10, 2026 15:28
Local publishToMavenLocal of bloxbean/zeroj main at 1e78c6f, which adds
confidential-note-jubjub-v1 (ADR-0055). Existing pedersen-commitments and
private-voting tests pass unchanged. Move to the public release before merge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…8 sealed-bid auction

ADR-0007 is ZeroJ ADR-0055's milestone M3: on-chain opening delivery and D3a
enforced auditor amounts for the points demo (NoteLedger), an auditor registry
with on-chain-verified, context-bound possession proofs, an exact-address
policy, wallets and auditors that recover notes from chain data, solvency
entries with deliveries, and a confidential payroll with proof-enforced
issuance (ADR-0055 Q9 (b)).

ADR-0008 is a sealed-bid auction whose bids are encrypted to the auctioneer
under elgamal-jubjub-v1 with a bid proof, and settled with a proof that names
the earliest highest bid without publishing the losing ones.

r2 of both responds to a design review (adversarial Claude reviewer F1-F17,
Codex C1-C10; no P0). ADR-0006 gains an r4 note pointing to both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s (ADR-0007 M2)

AuditorRegistry is a singleton key registry: a one-shot REG token minted by
spending a seed, moved forward on rotation under the old and the new
auditor's signatures, so a ledger always reads the current generation
(ZeroJ ADR-0055 spec §8.1). Each entry holds the auditor's elgamal-jubjub-v1
key and confidential-note viewing key, as coordinates bound on-chain to their
encodings, with u != 0. Both Groth16 DLEQ possession proofs are verified
on-chain at Init and Rotate (about 7.8e9 steps), bound to the key type, the
registry and the registrant, so no registered key can freeze notes or be
refused by honest senders, and a copied proof never registers.

Host side: KeyPossession (context-bound proofs, 192-byte compressed codec),
AuditorKeys, RegistryEntry, AdmittedAuditor (the only way to obtain a key
context for limb encryption: ADR-0055 M3 criterion (b)), Registry (Init,
Rotate, current entry), and a minimum-ADA helper.

Tests: VM mutations for every shape, signature, generation, address, token,
encoding and possession rule (each guard checked by reverting it), with a
positive control for the identity key's valid proof; admission refusals
including key-type binding in isolation and cross-registry replay. Reviewed
by Claude and Codex (no P0/P1; findings fixed).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ency (ADR-0007 M3a-M5; ZeroJ ADR-0055 M3)

NoteLedger replaces PointsLedger. A note is Note(owner, u, v, generation,
audit, deliveries): the Pedersen commitment, the registry generation, two
elgamal-jubjub-v1 limb ciphertexts of the amount to the auditor (D3a) and
confidential-note-jubjub-v1 deliveries to the owner and the auditor.

- Address policy (ADR-0055 M3 criterion (a)): every output under the ledger's
  payment credential must be a note at the exact enterprise address, holding
  exactly lovelace and one note token, of the current generation.
- D3a direct layout (spec 8.2): transfer and redeem prove each created note's
  limbs encrypt the amount that opens its commitment, PK_a from exactly one
  registry reference input, distinct handles. Complete transactions in the
  Julc VM: transfer 76.5% of the step limit, redeem 58.0% (DevKit: 76.8%,
  58.3%), within the 80% gate; circuits equal ZeroJ's reference (34,184 and
  18,366 constraints).
- Payroll: proof-enforced issuance (Q9 (b)), NoteIssueProof for one or two
  notes (50.8% / 71.8%); an employer that under-reports has no proof.
- Verification keys are pinned by blake2b(serialiseData(vk)) and carried in
  the redeemer (VkLib); the ledger is deployed as a reference script.
- Wallets (NoteWallet) recover notes from chain data with their viewing key;
  owned-but-unopenable notes are reported, notes readable but owned by others
  are not counted. The auditor (AuditorView) reads every amount with the keys
  of the note's generation and labels it proof-enforced or issuer-claimed.
  Senders encrypt limbs only with ElGamal.encryptWithOpening under an admitted
  registry key (M3 criterion (b)).
- Solvency: each entry carries its customer's delivery and the attestation the
  auditor's aggregate delivery; customers and the auditor check from chain.
- UI: points tab reworked (chain-scanned wallets, auditor panel, rotation,
  garbage-delivery / under-report / retired-key / stake-variant cheats), new
  payroll tab, solvency tab with on-chain openings. CLI walkthrough updated.

Tests: NoteLedger VM mutations (every ADR-0006 P1-P8 and ADR-0055 D3a/D8 case,
stake-variant output, reused handles, stale generation, registry mutations,
under-reported proved issuance), guards checked by reverting them; I12
invalid witnesses; DevKit E2E for points (issue, transfer, redeem, recovery by
owner and auditor, unopenable garbage delivery, rotation with stale limbs
refused); solvency VM and unit tests for deliveries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d solvency (ADR-0007)

- AuditorView: per-note failures are reported instead of aborting the scan;
  origin (proof-enforced / issuer-claimed) counts only ledger inputs holding a
  note token; HTTP failures are not cached; payroll reads issued notes from
  the mint history.
- NoteWallet balances are BigInteger; the retired-key cheat targets the
  current generation; rotation stores the new keys before submitting.
- DevKit: the evaluator's padding is shared out with BigInteger arithmetic
  (a long overflow under-provisioned the registry transactions), capped at
  the protocol maximum; budgets are thread-local.
- Solvency: the auditor check requires a live attestation; non-404 lookup
  failures are errors.
- Tests: the 80% gate is asserted on realistic VM transactions; rogue
  verification keys, receipt-mint negatives, limb-at-2^32, wallet
  readable-not-mine/unopenable, no secret-path scalarMul in main code,
  padding arithmetic, and a payroll DevKit E2E.
- Payroll tab: payslip history panel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…R-0008 M6)

A lot UTxO collects up to three sealed bids. Each bid is an
elgamal-jubjub-v1 encryption to the auctioneer's possession-verified registry
key with a Groth16 proof that reserve <= bid <= deposit, bound to the
bidder's key hash, so a bidder cannot withhold its bid. After the window the
auctioneer proves in zero knowledge that it decrypted every bid and names
the earliest highest one at its price; losing bids are never published.
Payouts are tagged (policy, lot token) and paid to exact enterprise
addresses; after the settlement deadline anyone can refund.

- SealedBidAuction (Julc): open / bid / settle / refund / no-bids, one-shot
  lot token, vks pinned by hash, deployed as a reference script.
- BidProof (7,011 constraints) and SettleProof n = 1..3 (6,950 / 13,330 /
  19,710); the decryption relation reuses ZkElGamal.encrypt with the
  auctioneer's secret (flagged for external review in ADR-0008).
- Circuit negatives, VM mutation tests and a DevKit E2E (late bid, copied
  bid, wrong winner, payouts, refund). Budgets: settle of 3 bids 65.6% VM /
  65.8% DevKit of the step limit.
- Auction tab, service and endpoints; README, demo.sh, rebuilt bundle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The root build.gradle registers the aggregate tasks (buildAllUsecases,
testAllUsecases, ...) but the repository had no root wrapper, so they needed
a locally installed Gradle. The wrapper matches the modules' Gradle 9.2.0;
gradle-wrapper.jar is the official one (sha256 423cb469…e8d9, as published at
services.gradle.org). README: use ./gradlew, and ./gradlew -p <module> for
one module's tasks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hot repository

ZeroJ's bloxbean-snapshot workflow (run 38048405332, main 458bfb1) publishes
commit snapshots to https://repo.bloxbean.org/maven/snapshots. Every usecase
build now lists that repository, restricted to snapshots of the org.zeroj
group, so the pin resolves without a local ZeroJ publish.

458bfb1 differs from the previous pin 1e78c6f only in ZeroJ's snapshot
workflow. The published jars' classes are identical to the 1e78c6f build;
the only resource difference is the order of validators in
zeroj-onchain-julc's plutus.json (same compiled code and hashes).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… stuck "starting")

- bootRun: optimizedLaunch = false. Spring Boot's -XX:TieredStopAtLevel=1
  disabled C2, so ZeroJ's point-by-point validation of the cached keys ran
  several times slower (note-transfer: 531 s vs 125 s). Other modules in this
  repository already set it.
- KeyedCircuit: each cached key file is loaded and validated once per process
  and shared (points/payroll share note-transfer and note-redeem, four demos
  share key-possession); compileAll loads a demo's circuits in parallel.
  Validation itself is unchanged.
- Funding: faucet top-ups are serialized and retried; concurrent demos made
  DevKit refuse one ("Topup failed") and payroll failed to start.
- Starting banner: says cached keys are re-validated on every start.

Measured on DevKit: all five demos ready 144 s after Tomcat started (was
~24 min for payroll); payroll and points pay/issue/transfer still prove and
verify with the shared keys.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
satran004 and others added 3 commits October 10, 2026 22:41
…what any script accepts

Measured on Yaci DevKit (mainnet protocol parameters), before -> after:
auction bid 1.184 -> 0.897 ADA, settle (3 bids) 1.377 -> 1.028, open
0.745 -> 0.512, refund 0.678 -> 0.526; note transfer 1.415 -> 1.163,
redeem 1.167 -> 0.984; payroll pay run 1.345 -> 1.111; registry init
1.381 -> 1.216.

- Key carrier (ADR-0007 r3): the Groth16 verification keys move from
  every proof redeemer to the inline datum of an output at the script's
  own address without a reference script (deployed once, separately,
  because script plus keys exceed the transaction size limit). VkLib
  reads key i from the reference input at the script's payment
  credential; the hash check against the pinned parameter is unchanged.
  The transaction is 1.1-1.6 KB smaller. New VM mutations: no carrier,
  a carrier of another script, a wrong or rogue key in the carrier.
- Constant-cost datum access: typed views (LotFields, EntryFields,
  CustomerFields) replace loop-based field(d, i); fixed-length checks in
  isNoteDatum and isLot are unrolled. Same accepted shapes; auction
  memory about -50%, registry -28%, notes -10 to -29%.
- Evaluator margin 25% -> 5% (evaluation is deterministic; the margin
  is paid on every transaction).
- CostProfiler (tests, ZEROJ_PROFILE=true): per-line cost of each
  validator's honest transaction, from Julc's source-mapped trace.

All VM mutation suites and every DevKit E2E pass. The verifier's double
point decompression is ZeroJ #84 (PR bloxbean/zeroj#85).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…er lags

The carrier transaction spends the payer's change from the reference-script
deployment confirmed just before it; a stale UTxO view made it fail once on
DevKit (payroll E2E). It is retried up to four times, and the E2E tests now
print the deployment's failure reason.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The snapshot of ZeroJ main 6a89f8a (PRs #85/#86, on-chain verifier
decompression, on top of everything since pre12), published to the
BloxBean snapshot repository by the snapshot workflow, run 38113510199.

Verified on this branch: ./gradlew test in all 14 modules (139 tests,
0 failures) and every DevKit E2E (private-voting, pedersen-commitments
x6, proof-of-reserves, reusable-kyc, both PlonK examples, the
account-ownership prove/verify flow) green.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
satran004 and others added 2 commits October 12, 2026 18:43
…onfidential-notes-m3

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

# Conflicts:
#	version.properties
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
satran004 added a commit that referenced this pull request Oct 12, 2026
…mo-privacy-hardening

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
satran004 added a commit that referenced this pull request Oct 12, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@satran004 satran004 closed this Nov 22, 2026
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