This repository contains the source code of the paper VeRange: Verification-efficient Zero-knowledge Range Arguments with Transparent Setup for Blockchain Applications and More at eprint.
Note that the code is for research only.
There are two main branches:
- Java Implementation: A maven project of range arguments and polynomial commitment arguments. The implementation of all range arguments are in the Branch
java/src/main/java/zkpBIC: Implement the Bounded Integer Commitments of range arguments of the BIC21.BPPP: Implement the Bulletproofs++ optimized version.PolynomialCommitment: Implement the polynomial commitments adopted from BCC+16 .VeRange-Type1: Implement the Type-1 range arguments.VeRange-Type2: Implement the Type-2 range arguments.VeRange-Type2B: Implement the Type-2B range arguments.VeRange-Type3: Implement the Type-3 range arguments.VeRange-Type4: Implement the Type-4 range arguments.
- Solidity Implementation: A Truffle project of range arguments. The implementation of all range arguments are in the Branch
solidity/contracts, with the same file names as mentioned above.
-
VeRangeJava
- Navigate to Branch
java/src/test/java/ZKP.
- Navigate to Branch
-
VeRangeSolidity
- Navigate to Branch
solidity/test.
- Navigate to Branch
- Branches, not folders: The main development work happens on other Git branches. The
javabranch houses a Maven-based Java implementation underjava/src/main/java/zkp, and thesoliditybranch holds Solidity smart-contract code undersolidity/contracts. - Multiple range-argument variants: On these branches you’ll find different variants such as BIC, Bulletproofs++, and various “VeRange-Type*” implementations.
- Testing locations: Java tests are under
java/src/test/java/ZKP, while Solidity tests live insolidity/test. - Research-only: The
READMEemphasizes that the code is provided for research purposes and references the associated paper eprint.
The main branch now includes the Rust workspace refactor (crates/) in addition to cross-branch Java and Solidity references.
If your goal is to build or understand the code:
- Explore each branch. Check out
javaorsolidityto inspect the source directories mentioned in the README. - Read the associated paper to understand the cryptographic background and how the range arguments work.
- Use Cargo for Rust. The Rust code is organized as a multi-crate workspace and tested via
cargo test.
This branch now includes a Rust SDK and proof implementation under the workspace crates:
crates/verange-corecrates/verange-poly-commitcrates/verange-proofcrates/verange-sdk
Implemented proof systems in Rust include:
type1type2type2ptype3type4_batch
See README-rust-sdk.md for SDK usage, Type2P binary-format details, and Type4 parameter requirements.
Useful commands:
- Run all Rust tests:
cargo test --workspace - Run proof crate tests only:
cargo test -p verange-proof - Run proof-mode separation tests:
cargo test -p verange-proof --test mode_tests - Run proof fuzz-like robustness tests:
cargo test -p verange-proof --test fuzz_like_tests - Run proof crate clippy gate:
cargo clippy -p verange-proof --all-targets --no-deps -- -D warnings -W clippy::all -A clippy::needless_range_loop -A clippy::too_many_arguments - Run SDK API tests only:
cargo test -p verange-sdk sdk_api_tests - Run SDK all-types example:
cargo run -p verange-sdk --example sdk_all_types - Run SDK proof-metrics logger:
cargo run -p verange-sdk --example proof_metrics -- logs/proof_metrics.log