Skip to content

Add on-chain BBS selective-disclosure verifier + BbsToCardano codec#21

Merged
satran004 merged 2 commits into
mainfrom
feat/bbs_lib
Jul 17, 2026
Merged

Add on-chain BBS selective-disclosure verifier + BbsToCardano codec#21
satran004 merged 2 commits into
mainfrom
feat/bbs_lib

Conversation

@satran004

@satran004 satran004 commented Jul 17, 2026

Copy link
Copy Markdown
Member

Summary

Adds native on-chain BBS selective-disclosure verification to ZeroJ, promoting the gadgets proven out in the zeroj-usecases reusable-KYC usecase into the library — following the same reusable-@OnchainLibrary + off-chain-codec pattern as Groth16 and PlonK.

zeroj-onchain-julc — new bbs.lib on-chain gadgets

  • BbsHashToScalar (@OnchainLibrary) — BBS hash_to_scalar (RFC 9380 expand_message_xmd(SHA-256), len=48, OS2IP mod r). Ciphersuite-generic: any BBS validator composes it for message→scalar mapping and the Fiat–Shamir challenge.
  • BbsProofVerify (@OnchainLibrary) — full BBS ProofVerify (T1/T2 recomputation, challenge recomputed on-chain and compared, pairing check e(Abar,W) == e(Bbar,BP2)) for the BLS12381G1-SHA-256 suite. Unrolled for the 5-message / disclose-{2,3} profile (Plutus has no cheap dynamic loop); measured ~2.44×10⁹ CPU / 0.18M mem — well inside per-tx limits. Arbitrary-disclosure generalization is the tracked follow-up (mirroring PlonK's one-input → bounded-MPI evolution).
  • OnChainFeasibility: BBS/BLS12-381 now EXPERIMENTAL with the measured budget (annotated as measured, not estimated).

zeroj-bbs — new bbs.cardano.BbsToCardano off-chain codec

  • verifierParams(pk, header, messageCount) → issuer verification material for validator @Params (generators, domain, DSTs — deterministic, cacheable).
  • onChainProof(presentation) → redeemer values (proof points, Schnorr responses, revealed messages sorted by index, presentation header).
  • Plain off-chain Java, no Julc/Plutus dependency — the BBS analog of SnarkjsToCardano. Kept in zeroj-bbs so the on-chain module takes no main-scope BBS dependency (test-scope only), preserving the bom-core opt-in boundary.

Crypto-only by design

Like the Groth16/PlonK libs, BbsProofVerify verifies the proof but binds no ScriptContext. Validators protecting value must add policy: disclosed-value checks, payout, and replay-safe binding of the presentation header to the spend. A worked claim validator (voucher-derived header = intrinsic nullifier) lives in zeroj-usecases reusable-kyc.

Testing

  • BbsHashToScalarVmTest — Julc-VM differential test against CfrgBbsCore.hashToScalar (byte-exact across empty/short/multi-block messages).
  • BbsProofVerifyVmTest — full ProofVerify in the Julc VM against a real zeroj-bbs presentation: accept + tampered-header reject; prints the measured budget.
  • BbsToCardanoTest — params well-formedness + disclosed/hidden split.
  • Full zeroj-bbs (89 tests incl. CFRG draft-10 fixtures) and zeroj-onchain-julc suites green — no regressions.
  • Relocation verified byte-exact downstream: the reusable-kyc claim validator compiled against these gadgets has an identical script hash and identical ExUnits, and completed a fresh live lock+claim on Yaci DevKit (ledger-verified BBS presentation).

🤖 Generated with Claude Code

satran004 and others added 2 commits July 17, 2026 17:21
zeroj-onchain-julc — new bbs.lib @onchainlibrary gadgets:
- BbsHashToScalar: reusable hash_to_scalar (expand_message_xmd/SHA-256),
  ciphersuite-generic, composable by any BBS validator.
- BbsProofVerify: native Plutus V3 BBS ProofVerify (T1/T2 + Fiat-Shamir
  challenge + pairing) for the SHA-256 ciphersuite; unrolled for the
  5-message disclose-2 profile (~2.44e9 CPU / 0.18M mem). Arbitrary-disclosure
  generalization tracked as follow-up.
- VM differential tests against zeroj-bbs (hash-to-scalar + full ProofVerify).
- OnChainFeasibility: BBS/BLS12-381 now EXPERIMENTAL with measured budget.

zeroj-bbs — new bbs.cardano.BbsToCardano off-chain codec:
- verifierParams(pk, header, messageCount) -> validator @Param bytes.
- onChainProof(presentation) -> flattened redeemer (points/scalars/disclosed).
- Plain off-chain Java (no Julc/Plutus dep); the BBS analog of SnarkjsToCardano.

READMEs updated with BBS on-chain usage.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016vZWZJopkv4GH17ZRv3nBp
@satran004
satran004 merged commit bee6039 into main Jul 17, 2026
9 checks passed
@satran004
satran004 deleted the feat/bbs_lib branch July 17, 2026 14:11
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