Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Rust Rapidsnark
This project provides a Rust adapter for compiling and linking Rapidsnark into a native library for target platforms (e.g., mobile devices). It includes macros and functions to facilitate the integration of proof generation into Rust codebases.
Requirements
Rust toolchain
cargo 1.89.0 (c24e10642 2025-06-23)
Usage
Include the crate in your Cargo.toml:
[]
= "0.1"
[]
= "0.1"
It doesn't include the witness generation functions, you need to use one of the following crates to generate the witness:
For example, building witness with witnesscalc-adapter:
witness!;
let json_input_string = "{\"a\": [\"2\"], \"b\": [\"3\"]}";;
let wtns_buffer = multiplier2_witness.unwrap;
Calculate the proof
Calculate the proof by using the groth16_prover_zkey_file_wrapper function.
It will take a wtns bytes array like the output of witnesscalc or snarkjs.
let zkey_path = "./test-vectors/multiplier2_final.zkey";
let proof = groth16_prover_zkey_file_wrapper.unwrap;
Verify the proof
Verify the proof by using the groth16_verifier_zkey_file_wrapper function.
let vkey = read_to_string?;
let valid = groth16_verify_wrapper?;
Supported platforms
The static libraries are downloaded at build time from the upstream iden3/rapidsnark release, which publishes prebuilt libraries for:
Linux
- x86_64 linux
- arm64 linux
MacOS
- aarch64-apple-darwin
- x86_64-apple-darwin
iOS
- aarch64-apple-ios
- aarch64-apple-ios-sim
Android
- aarch64-linux-android
- x86_64-linux-android
Upstream publishes no x86_64 build of libfr.a and libfq.a for the iOS
simulator, so x86_64-apple-ios needs libraries supplied through
RAPIDSNARK_LIB_DIR. A target outside this list falls back to the generic build
for its architecture, which may not link.
Build configuration
RAPIDSNARK_LIB_DIRlinkslibrapidsnark.a,libfr.a,libfq.aandlibgmp.aout of a directory you provide and skips the download, which is what you want for offline builds or locally compiled rapidsnark.RAPIDSNARK_DOWNLOAD_BASE_URLfetches the pinned release assets from a mirror rather than from GitHub. The assets must be byte identical, since each one is checked against a pinned sha256.
Community
- Website: zkmopro.com
- X account:
- Telegram group:
Acknowledgements
- The project is sponsored by PSE.