[][src]Struct bulletproofs::r1cs::Verifier

pub struct Verifier<'a, 'b> { /* fields omitted */ }

An entry point for verifying a R1CS proof.

The lifecycle of a Verifier is as follows. The verifying code provides high-level commitments one by one, Verifier adds them to the transcript and returns the corresponding variables.

After all variables are committed, the verifying code calls finalize_inputs, which consumes Verifier and returns VerifierCS. The verifying code then allocates low-level variables and adds constraints to the VerifierCS.

When all constraints are added, the verifying code calls verify on the instance of the constraint system to check the proof.

Methods

impl<'a, 'b> Verifier<'a, 'b>[src]

pub fn new(
    bp_gens: &'b BulletproofGens,
    pc_gens: &'b PedersenGens,
    transcript: &'a mut Transcript
) -> Self
[src]

Construct an empty constraint system with specified external input variables.

Inputs

The bp_gens and pc_gens are generators for Bulletproofs and for the Pedersen commitments, respectively. The BulletproofGens should have gens_capacity greater than the number of multiplication constraints that will eventually be added into the constraint system.

The transcript parameter is a Merlin proof transcript. The VerifierCS holds onto the &mut Transcript until it consumes itself during [VerifierCS::verify], releasing its borrow of the transcript. This ensures that the transcript cannot be altered except by the VerifierCS before proving is complete.

The commitments parameter is a list of Pedersen commitments to the external variables for the constraint system. All external variables must be passed up-front, so that challenges produced by ConstraintSystem::challenge_scalar are bound to the external variables.

Returns

Returns a tuple (cs, vars).

The first element is the newly constructed constraint system.

The second element is a list of Variables corresponding to the external inputs, which can be used to form constraints.

pub fn commit(&mut self, commitment: CompressedRistretto) -> Variable[src]

Creates commitment to a high-level variable and adds it to the transcript.

Inputs

The commitment parameter is a Pedersen commitment to the external variable for the constraint system. All external variables must be passed up-front, so that challenges produced by ConstraintSystem::challenge_scalar are bound to the external variables.

Returns

Returns a pair of a Pedersen commitment (as a compressed Ristretto point), and a Variable corresponding to it, which can be used to form constraints.

pub fn finalize_inputs(self) -> VerifierCS<'a, 'b>[src]

Consume the Verifier, provide the ConstraintSystem implementation to the closure, and verify the proof against the resulting constraint system.

Auto Trait Implementations

impl<'a, 'b> Send for Verifier<'a, 'b>

impl<'a, 'b> Sync for Verifier<'a, 'b>

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Same for T

type Output = T

Should always be Self