1 unstable release
| new 0.0.1 | Feb 12, 2026 |
|---|
#5 in #static-archive
20KB
353 lines
rust-gnark
Rust bindings for the gnark Groth16 BN254 proving system.
Usage
[dependencies]
rust-gnark = "0.0.1"
use rust_gnark::{init, groth16_prove, groth16_verify};
init()?;
let result = groth16_prove("circuit.r1cs", "circuit.pk", r#"{"X": "3", "Y": "35"}"#)?;
let valid = groth16_verify("circuit.r1cs", "circuit.vk", &result)?;
No Go toolchain required -- prebuilt static libraries are bundled in the published crate.
Supported targets
| Target | Platform |
|---|---|
aarch64-apple-ios |
iOS device |
aarch64-apple-ios-sim |
iOS simulator (ARM64) |
x86_64-apple-ios |
iOS simulator (x86_64) |
aarch64-apple-darwin |
macOS (Apple Silicon) |
x86_64-apple-darwin |
macOS (Intel) |
aarch64-linux-android |
Android (ARM64) |
x86_64-linux-android |
Android (x86_64) |
x86_64-unknown-linux-gnu |
Linux (x86_64) |
aarch64-unknown-linux-gnu |
Linux (ARM64) |
WASM is not supported (c-archive does not target WASM).
Development
Requires Go 1.24+ to compile the Go wrapper from source:
cargo test --all
Cross-compilation is auto-detected from the Rust TARGET, or set manually:
RUST_GNARK_GO_ENVS="GOOS=ios;GOARCH=arm64;CC=/path/to/cc" cargo build
License
MIT
lib.rs:
Rust bindings for gnark Groth16 BN254 prover/verifier.
This crate provides safe Rust wrappers around the gnark Go library, compiled
via CGO into a static C archive. The bindings are auto-generated by bindgen
from the C header produced by go build -buildmode=c-archive.
Supported platforms
- aarch64-apple-ios
- aarch64-apple-ios-sim
- x86_64-apple-ios
- aarch64-apple-darwin
- x86_64-apple-darwin
- aarch64-linux-android
- x86_64-linux-android
- x86_64-unknown-linux-gnu
- aarch64-unknown-linux-gnu
Note
WASM is not supported because c-archive does not target WASM.
Dependencies
~0–2.4MB
~46K SLoC