ReciprocalRangeProofProtocol

Struct ReciprocalRangeProofProtocol 

Source
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: usize

Count of private proles (size of committed value). Equals to: dim_nm. Also, dim_nv = 1 + dim_nd.

§dim_np: usize

Count of public poles (number system base). Equals to: dim_no.

§g: ProjectivePoint

Will 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

Source

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]

Source

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:]>

Source

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.

Source

pub fn prove<R>( &self, commitment: &ProjectivePoint, witness: Witness, t: &mut Transcript, rng: &mut R, ) -> Proof
where R: RngCore + CryptoRng,

Creates zk-proof that committed value lies in [0..dim_np^dim_nd) range.

Source

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

Source§

fn clone(&self) -> ReciprocalRangeProofProtocol

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ReciprocalRangeProofProtocol

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.