pub struct BulletproofGens {
    pub gens_capacity: usize,
    pub party_capacity: usize,
    /* private fields */
}
Expand description

The BulletproofGens struct contains all the generators needed for aggregating up to m range proofs of up to n bits each.

Extensible Generator Generation

Instead of constructing a single vector of size m*n, as described in the Bulletproofs paper, we construct each party’s generators separately.

To construct an arbitrary-length chain of generators, we apply SHAKE256 to a domain separator label, and feed each 64 bytes of XOF output into the ristretto255 hash-to-group function. Each of the m parties’ generators are constructed using a different domain separation label, and proving and verification uses the first n elements of the arbitrary-length chain.

This means that the aggregation size (number of parties) is orthogonal to the rangeproof size (number of bits), and allows using the same BulletproofGens object for different proving parameters.

This construction is also forward-compatible with constraint system proofs, which use a much larger slice of the generator chain, and even forward-compatible to multiparty aggregation of constraint system proofs, since the generators are namespaced by their party index.

Fields§

§gens_capacity: usize

The maximum number of usable generators for each party.

§party_capacity: usize

Number of values or parties

Implementations§

source§

impl BulletproofGens

source

pub fn new(gens_capacity: usize, party_capacity: usize) -> Self

Create a new BulletproofGens object.

Inputs
  • gens_capacity is the number of generators to precompute for each party. For rangeproofs, it is sufficient to pass 64, the maximum bitsize of the rangeproofs. For circuit proofs, the capacity must be greater than the number of multipliers, rounded up to the next power of two.

  • party_capacity is the maximum number of parties that can produce an aggregated proof.

source

pub fn share(&self, j: usize) -> BulletproofGensShare<'_>

Returns j-th share of generators, with an appropriate slice of vectors G and H for the j-th range proof.

source

pub fn increase_capacity(&mut self, new_capacity: usize)

Increases the generators’ capacity to the amount specified. If less than or equal to the current capacity, does nothing.

Trait Implementations§

source§

impl Clone for BulletproofGens

source§

fn clone(&self) -> BulletproofGens

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V