Add on-chain BBS selective-disclosure verifier + BbsToCardano codec#21
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds native on-chain BBS selective-disclosure verification to ZeroJ, promoting the gadgets proven out in the
zeroj-usecasesreusable-KYC usecase into the library — following the same reusable-@OnchainLibrary+ off-chain-codec pattern as Groth16 and PlonK.zeroj-onchain-julc — new
bbs.libon-chain gadgetsBbsHashToScalar(@OnchainLibrary) — BBShash_to_scalar(RFC 9380expand_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 BBSProofVerify(T1/T2 recomputation, challenge recomputed on-chain and compared, pairing checke(Abar,W) == e(Bbar,BP2)) for theBLS12381G1-SHA-256suite. 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.BbsToCardanooff-chain codecverifierParams(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).SnarkjsToCardano. Kept inzeroj-bbsso 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,
BbsProofVerifyverifies the proof but binds noScriptContext. 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 inzeroj-usecasesreusable-kyc.Testing
BbsHashToScalarVmTest— Julc-VM differential test againstCfrgBbsCore.hashToScalar(byte-exact across empty/short/multi-block messages).BbsProofVerifyVmTest— fullProofVerifyin the Julc VM against a realzeroj-bbspresentation: accept + tampered-header reject; prints the measured budget.BbsToCardanoTest— params well-formedness + disclosed/hidden split.zeroj-bbs(89 tests incl. CFRG draft-10 fixtures) andzeroj-onchain-julcsuites green — no regressions.🤖 Generated with Claude Code