Skip to content

[Tools] Provide CLI utility in zeroj-tools for converting .zkey files to sparse mmap store format #39

Open

Description

@satran004

Background & Objective

ZeroJ supports loading proving keys via memory-mapped sparse stores (Groth16PkStore, ADR-0029/ADR-0035/ADR-0036). Converting a standard snarkjs .zkey into ZeroJ’s sparse .bin store format allows instant memory-mapped startup for provers without re-parsing large .zkey files on every run.

Scope & Tasks

  • Add a CLI command in zeroj-tools (e.g. zeroj-tools convert-zkey --in <circuit.zkey> --out <dir> --sparse).
  • Support dense and sparse point encoding outputs.
  • Output verification key metadata and circuit fingerprint for instant pipeline validation.
  • Document usage in docs/groth16-dev-guide.md.

Risk Classification

  • R1: Developer tooling & workflow ergonomics.
  • Reference: docs/zeroj-comprehensive-review-and-readiness-gemini.md (Section 5.2).

Activity

  1. satran004 commented on Aug 18, 2026

    @satran004
    MemberAuthor

    Mostly already done — suggest rescoping to just the CLI wrapper.

    The substantive converter exists: ZkeyPkStoreImporter (zeroj-crypto/.../groth16/ZkeyPkStoreImporter.java), delivered under ADR-0031 M2. From its class doc:

    Streaming importer for large snarkjs Groth16 .zkey files: converts a ceremony proving key directly into a Groth16PkStore directory without materializing point object arrays — the path for MPC ceremony keys at real scale (a 19M-constraint key is ~30 GB, far past ZkeyImporterBLS381's strict in-memory limits).

    It already raw-copies the four G1 sections (the .zkey Montgomery layout is byte-identical to the store's flat-limb layout on little-endian), converts and validates G2, writes VK parts into aux.bin/manifest, and validates in parallel. Groth16PkStore.load(dir) then memory-maps it — which is the "instant memory-mapped startup" this issue asks for.

    What is genuinely missing is only the CLI surface. Note zeroj-tools currently has no CLI at all — three library classes (ZkeyContributor, SnarkjsHashToG2, ChaChaRng), no picocli. The only CLI in the repo is CeremonyCli in zeroj-ceremony.

    So this is blocked on / must be sequenced with #36, which proposed moving CeremonyCli into zeroj-tools. Both issues add a CLI to the same module; pick one entry point.

    Suggested rescope: "Expose the existing ZkeyPkStoreImporter as a zeroj-tools CLI command" — R0/R1, small. Also worth checking task 2 ("dense and sparse point encoding outputs") against what Groth16PkStore already writes before estimating.

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions