Skip to main content

Crate curvy_prover

Crate curvy_prover 

Source
Expand description

§curvy-prover

Authenticated Curvy witness evaluation and self-verified arkworks Groth16 proving for existing snarkjs artifacts.

CircuitProver combines a deployment’s curvy-graph-v1 artifact and matching .zkey. Prover can instead consume an existing snarkjs .wtns assignment. This crate also publishes the curvy-native-prover executable and can be built as the standalone prover WASM module.

§Install

[dependencies]
curvy-prover = "=0.1.0-rc.3"

§Prove from circuit input JSON

use curvy_prover::CircuitProver;

let zkey = std::fs::read("circuit.zkey")?;
let graph = std::fs::read("circuit.graph.bin")?;
let prover = CircuitProver::from_artifacts(
    &zkey,
    "0000000000000000000000000000000000000000000000000000000000000000",
    &graph,
    "0000000000000000000000000000000000000000000000000000000000000000",
)?;
let proof = prover.prove_json(r#"{"amount":"42"}"#)?;

println!("{}", proof.proof_json);
println!("{}", proof.public_signals_json);

Both artifact hashes are checked before their respective parsers run. Generated proofs are verified internally before being returned.

§Features and execution targets

FeaturePurpose
stdNative standard-library support; enabled by default
parallelRayon and arkworks parallel proving; enabled by default
wasmPortable wasm-bindgen prover API
wasm-threadsShared-memory browser prover with initThreadPool(n)

The native executable accepts CURVY_PROVER_NUM_THREADS=1..64 and defaults to one thread. Library consumers can configure Rayon globally. Threaded WASM hosts choose the worker count by awaiting the generated module’s initThreadPool(n).

See the workspace guide for complete commands, output directories, and threaded-browser requirements.

§Security model

The proving key parser is the committed rs-core implementation vendored from ark-circom without its Wasmer witness calculator. Bulk query points are constructed unchecked for fast startup, so every caller must provide a pinned SHA-256 digest for the zkey before parsing is allowed.

Native builds enable std and Rayon-backed parallel support by default. Portable WASM uses the wasm feature; threaded browser builds use wasm-threads and export initThreadPool(n) so the host selects the worker count explicitly.

Modules§

qap
wtns
Strict snarkjs .wtns reader.
zkey
ZKey Parsing

Structs§

CircuitProver
Authenticated witness graph and proving key for one immutable circuit bundle.
ProofBundle
Prover
Parsed, reusable proving key and constraint matrices for one circuit.

Enums§

ProverError

Functions§

proof_to_snarkjs_json
Serialize a proof with the same coordinate order and shape as snarkjs.
publics_to_json