[][src]Struct bulletproofs::r1cs::prover::Prover

pub struct Prover<'a, 'b> {
    m: u64,
    cs: ProverCS<'a, 'b>,
}

An entry point for creating a R1CS proof.

The lifecycle of a Prover is as follows. The proving code commits high-level variables and their blinding factors (v, v_blinding), Prover generates commitments, adds them to the transcript and returns the corresponding variables.

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

When all constraints are added, the proving code calls prove on the instance of the constraint system and receives the complete proof.

Fields

m: u64

Number of high-level variables

cs: ProverCS<'a, 'b>

Constraint system implementation

Methods

impl<'a, 'b> Prover<'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 ProverCS holds onto the &mut Transcript until it consumes itself during ProverCS::prove, releasing its borrow of the transcript. This ensures that the transcript cannot be altered except by the ProverCS before proving is complete.

Returns

Returns a new Prover instance.

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

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

Inputs

The v and v_blinding parameters are openings to the commitment to the external variable for the constraint system. Passing the opening (the value together with the blinding factor) makes it possible to reference pre-existing commitments in 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) -> ProverCS<'a, 'b>[src]

Consume the Prover, provide the ConstraintSystem implementation to the closure, and produce a proof.

Auto Trait Implementations

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

impl<'a, 'b> Sync for Prover<'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