Type Alias BatchVerifier

Source
type BatchVerifier = Verifier<SpendAuth, Binding>;
Expand description

The type of the batch verifier.

Aliased Type§

struct BatchVerifier { /* private fields */ }

Implementations

§

impl<S, B> Verifier<S, B>
where S: SpendAuth, B: Binding<Scalar = <S as Sealed<S>>::Scalar, Point = <S as Sealed<S>>::Point>,

pub fn new() -> Verifier<S, B>

Construct a new batch verifier.

pub fn queue<I>(&mut self, item: I)
where I: Into<Item<S, B>>,

Queue an Item for verification.

pub fn verify<R>(self, rng: R) -> Result<(), Error>
where R: RngCore + CryptoRng,

Perform batch verification, returning Ok(()) if all signatures were valid and Err otherwise.

The batch verification equation is:

h_G * ( -[sum(z_i * s_i)]P_G + sum([z_i]R_i) + sum([z_i * c_i]VK_i) ) = 0_G

as given in https://zips.z.cash/protocol/protocol.pdf#reddsabatchvalidate (the terms are split out so that we can use multiscalar multiplication speedups).

where for each signature i,

  • VK_i is the verification key;
  • R_i is the signature’s R value;
  • s_i is the signature’s s value;
  • c_i is the hash of the message and other data;
  • z_i is a random 128-bit Scalar;
  • h_G is the cofactor of the group;
  • P_G is the generator of the subgroup;

Since RedDSA uses different subgroups for different types of signatures, SpendAuth’s and Binding’s, we need to have yet another point and associated scalar accumulator for all the signatures of each type in our batch, but we can still amortize computation nicely in one multiscalar multiplication:

h_G * ( [-sum(z_i * s_i): i_type == SpendAuth]P_SpendAuth + [-sum(z_i * s_i): i_type == Binding]P_Binding + sum([z_i]R_i) + sum([z_i * c_i]VK_i) ) = 0_G

As follows elliptic curve scalar multiplication convention, scalar variables are lowercase and group point variables are uppercase. This does not exactly match the RedDSA notation in the protocol specification §B.1.

Trait Implementations

§

impl<S, B> Default for Verifier<S, B>
where S: SpendAuth, B: Binding<Scalar = <S as Sealed<S>>::Scalar, Point = <S as Sealed<S>>::Point>,

§

fn default() -> Verifier<S, B>

Returns the “default value” for a type. Read more