Skip to content

Railgun-Community/mopro

Repository files navigation

@railgun-community/mopro

Mobile Groth16 prover for Railgun's deployed JoinSplit and POI circuits. It runs the proof on-device — witness generation via circom-witnesscalc and proof generation via rapidsnark — and exposes them to React Native over JSI through uniffi-bindgen-react-native (ubrn).

  • iOS & Android, React Native New Architecture (bridgeless).
  • No circuits bundled. Witness graphs and zkeys are delivered at runtime by the RAILGUN engine, so the supported circuit set changes with no native rebuild.

Install

yarn add @railgun-community/mopro

Consuming the package needs no build host. Full iOS/Android setup — pods/gradle, the JSI install lifecycle, and the engine seam — is in INTEGRATION.md.

Usage

Register the prover with the RAILGUN engine; its ArtifactStore delivers the graphs and zkeys and feeds them to the prover:

import { registerRailgunNativeProver } from '@railgun-community/mopro';

registerRailgunNativeProver(getProver());

How graphs reach the prover

This module ships no witness graphs and no zkeys — nothing is embedded or bundled. The wallet's ArtifactDownloader fetches and hash-validates every artifact (POI and JoinSplit witness graphs and ceremony zkeys) from the published artifact-hashes (IPFS CIDs) into the engine's ArtifactStore. The engine then hands the prover the graph and zkey bytes for each proof; the prover consumes only what it is handed.

  • prove_railgun(graph, zkey, inputs_json) — JoinSplit; graph is the runtime .bin.
  • prove_poi(graph, zkey, inputs_json) — POI; identical shape.

Both return engine-format { pi_a, pi_b, pi_c, publicSignals } JSON. pi_b is left in snarkjs order — the engine's formatProof performs the on-chain swap. Every returned proof is self-verified against its own zkey before it is handed back, so a bad graph/zkey/input surfaces as an error here rather than as an invalid on-chain proof.

Layout

Cargo.toml     railgun-community-mopro crate (lib: railgun_community_mopro)
src/           circom.rs (circom-prover wrapper) · railgun.rs (engine seam)
               · error.rs · lib.rs (mopro_ffi::app!())
tests/         golden_vector.rs — proves every staged shape vs the ceremony zkeys
fixtures/      per-shape circuit manifest + integrity hashes
react-native/  ubrn/JSI bindings + the engine-seam adapter

Build from source

Consuming the package needs no build host; rebuilding the native libraries does — a macOS host (iOS + Android) or x86_64-linux (Android only). aarch64-linux cannot link rapidsnark/witnesscalc-adapter. Release procedure is in RELEASE.md.

scripts/build-native.sh        # regenerate bindings + build native libs + pack

Built on

@railgun-community/mopro stands on the work of these projects — thanks to their authors. Full license notices and attribution are in THIRD_PARTY_LICENSES.md.

Component Role
zkmopro/mopro (mopro-ffi, circom-prover) FFI scaffolding + proving orchestration
circom-witnesscalc runtime witness generation
rapidsnark (iden3 / 0KIMS) Groth16 proof generation
GNU MP (GMP) big-integer arithmetic for rapidsnark
arkworks (ark-groth16) alternate Groth16 backend
uniffi-bindgen-react-native React Native / JSI bindings

The prebuilt binaries statically link rapidsnark and GMP (LGPL-3.0). See THIRD_PARTY_LICENSES.md for the LGPL relink notice that applies to redistributed binaries.

License

MIT — see LICENSE. Bundled LGPL-3.0 components are noted above and in THIRD_PARTY_LICENSES.md.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors