This library offers a set of functions for generating and interacting with bn254 KZG commitments and proofs in rust, with the motivation of supporting fraud and validity proof logic in EigenDA rollup integrations.
This repository is organized as a Rust workspace with three main crates:
Provides the fundamental data structures and operations:
Blob: Data representation with conversion methodsPolynomial: Support for both evaluation and coefficient forms- Various arithmetic and helper functions
Implements KZG commitment and proof generation:
KZG: Main struct for creating commitments and generating proofsSRS: Structured Reference String handling- Optimized parallel FFT implementations
Provides verification functions:
- Single proof verification
- Batch verification for improved efficiency
For a complete end-to-end example, see the test_compute_kzg_proof function in prover/tests/kzg_test.rs.
# Build all crates
cargo build
# Run benchmarks
cargo bench- The project is compatible with Rust 1.75 or later
If you encounter issue running tests and it fails with the following error:
error: package `half v2.5.0` cannot be built because it requires rustc 1.81 or newer, while the currently active rustc version is 1.75.0
then run cargo update half --precise 2.4.1 to downgrade this transitive dependency to a lower version that works with our MSRV.
This issue can be permanently solved when this rust RFC is implemented.
Releasing a crate is done by creating a PR (see this example) that bumps the version in Cargo.toml and then manually dispatching the crates-release-prod.yml workflow. This will publish the new version to crates.io.
This code is unaudited and under construction. This is experimental software and is provided on an "as is" and "as available" basis. It may not work as expected and should not be used in production environments.