Skip to content

roynalnaruto/range_proof

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Range Proof

The code in this repository is a implementation of the range proof protocol described here.

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
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
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
// 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

About

PoC implementation of polynomial commitment scheme based Range Proofs

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages