https://github.com/roynalnaruto/range_proof
PoC implementation of polynomial commitment scheme based Range Proofs
https://github.com/roynalnaruto/range_proof
polynomial-commitments range-proofs rust-lang zero-knowledge-proofs
Last synced: 4 months ago
JSON representation
PoC implementation of polynomial commitment scheme based Range Proofs
- Host: GitHub
- URL: https://github.com/roynalnaruto/range_proof
- Owner: roynalnaruto
- License: gpl-3.0
- Created: 2020-04-16T03:13:12.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-09-13T22:19:41.000Z (over 2 years ago)
- Last Synced: 2025-04-09T18:54:58.851Z (10 months ago)
- Topics: polynomial-commitments, range-proofs, rust-lang, zero-knowledge-proofs
- Language: Rust
- Size: 34.2 KB
- Stars: 12
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Range Proof
The code in this repository is a implementation of the range proof protocol described [here](https://hackmd.io/@dabo/B1U4kx8XI).
This work is only proof of concept, it is not audited or does not come with any claims.
# Example
* To prove that `z = 100` lies in the range `[0, 2^8)`
* Trusted setup
```rust
use commitment_scheme;
// range: [0, 2^n)
let n = 8usize;
// trusted setup
let (pk, vk) = commitment_scheme::trusted_setup(4usize * n).unwrap();
```
* [Prover] Create range proof
```rust
use algebra::bls12_381::Fr;
use merlin::Transcript;
// number in the above range
let z = Fr::from(100u8);
// merlin transcript will be used to
// transform an interactive protocol
// into a non-interactive protocol
let mut proof_transcript = Transcript::new(b"range_proof");
// generate range proof
let proof = RangeProof::prove(&pk, n, &z, &mut proof_transcript);
```
* [Verifier] Verify range proof
```rust
// verification transcript
let mut verification_transcript = Transcript::new(b"range_proof");
// verify the above range proof
let result = RangeProof::verify(&proof, &vk, n, &mut verification_transcript);
// assert that the result is ok
assert!(result.is_ok());
```
# License
[In detail here](https://github.com/roynalnaruto/range_proof/blob/master/LICENSE.md)