pub struct ReciprocalRangeProofProtocol {
pub dim_nd: usize,
pub dim_np: usize,
pub g: ProjectivePoint,
pub g_vec: Vec<ProjectivePoint>,
pub h_vec: Vec<ProjectivePoint>,
pub g_vec_: Vec<ProjectivePoint>,
pub h_vec_: Vec<ProjectivePoint>,
}Expand description
Represents public reciprocal range proof protocol information. Using this information and challenge both prover and verifier can derive the arithmetic circuit.
Fields§
§dim_nd: usizeCount of private proles (size of committed value). Equals to: dim_nm. Also, dim_nv = 1 + dim_nd.
dim_np: usizeCount of public poles (number system base). Equals to: dim_no.
g: ProjectivePointWill be used for the value commitment: commitment = x*g + s*h_vec[0]
g_vec: Vec<ProjectivePoint>Dimension: dim_nm
h_vec: Vec<ProjectivePoint>Will be used for the value commitment: commitment = x*g + s*h_vec[0]
Dimension: dim_nv+9
g_vec_: Vec<ProjectivePoint>Additional points to be used in WNLA.
Dimension: 2^n - dim_nm
h_vec_: Vec<ProjectivePoint>Dimension: 2^n - (dim_nv+9)
Implementations§
Source§impl ReciprocalRangeProofProtocol
impl ReciprocalRangeProofProtocol
Sourcepub fn commit_value(&self, x: &Scalar, s: &Scalar) -> ProjectivePoint
pub fn commit_value(&self, x: &Scalar, s: &Scalar) -> ProjectivePoint
Creates commitment for the private value and blinding: commitment = x*g + s*h_vec[0]
Sourcepub fn commit_poles(&self, r: &[Scalar], s: &Scalar) -> ProjectivePoint
pub fn commit_poles(&self, r: &[Scalar], s: &Scalar) -> ProjectivePoint
Creates commitment for the reciprocals and blinding: commitment = s*h_vec[0] + <r, h_vec[9:]>
Sourcepub fn verify(
&self,
commitment: &ProjectivePoint,
proof: Proof,
t: &mut Transcript,
) -> bool
pub fn verify( &self, commitment: &ProjectivePoint, proof: Proof, t: &mut Transcript, ) -> bool
Verifies zk-proof that committed value lies in [0..dim_np^dim_nd) range.
Sourcepub fn prove<R>(
&self,
commitment: &ProjectivePoint,
witness: Witness,
t: &mut Transcript,
rng: &mut R,
) -> Proof
pub fn prove<R>( &self, commitment: &ProjectivePoint, witness: Witness, t: &mut Transcript, rng: &mut R, ) -> Proof
Creates zk-proof that committed value lies in [0..dim_np^dim_nd) range.
Sourcepub fn make_circuit(
&self,
e: Scalar,
) -> ArithmeticCircuit<impl Fn(PartitionType, usize) -> Option<usize> + '_>
pub fn make_circuit( &self, e: Scalar, ) -> ArithmeticCircuit<impl Fn(PartitionType, usize) -> Option<usize> + '_>
Creates circuit parameters based on provided challenge. For the same challenge will generate same parameters.
Trait Implementations§
Source§impl Clone for ReciprocalRangeProofProtocol
impl Clone for ReciprocalRangeProofProtocol
Source§fn clone(&self) -> ReciprocalRangeProofProtocol
fn clone(&self) -> ReciprocalRangeProofProtocol
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more