Clearmatics Libsnark  0.1
C++ library for zkSNARK proofs
Classes | Public Types | Static Public Member Functions | List of all members
libsnark::kzg10< ppT > Class Template Reference

#include <kzg10.hpp>

Classes

class  srs
 

Public Types

using Field = libff::Fr< ppT >
 
using commitment = libff::G1< ppT >
 
using evaluation_witness = libff::G1< ppT >
 A witness for the evaluation of a polynomial at some point. More...
 

Static Public Member Functions

static srs setup_from_secret (size_t max_degree, const Field &alpha)
 Intended only for testing. More...
 
static srs setup (size_t max_degree)
 
static commitment commit (const srs &srs, const polynomial< Field > &phi)
 
static bool verify_poly (const srs &srs, commitment C, const polynomial< Field > &phi)
 
static Field evaluate_polynomial (const polynomial< Field > &phi, Field i)
 
static evaluation_witness create_evaluation_witness (const polynomial< Field > &phi, const Field &i, const Field &evaluation, const srs &srs)
 
static bool verify_evaluation (const Field &i, const Field &evaluation, const srs &srs, const evaluation_witness &witness, const commitment &C)
 

Detailed Description

template<typename ppT>
class libsnark::kzg10< ppT >

Implementation of the scheme described in [KZG10]. The interface and types diverge slightly from [KZG10] in some places (in order to use the generic interface defined above). These differences are noted explicitly in the relevant places.

Definition at line 30 of file kzg10.hpp.

Member Typedef Documentation

◆ commitment

template<typename ppT >
using libsnark::kzg10< ppT >::commitment = libff::G1<ppT>

Definition at line 51 of file kzg10.hpp.

◆ evaluation_witness

template<typename ppT >
using libsnark::kzg10< ppT >::evaluation_witness = libff::G1<ppT>

A witness for the evaluation of a polynomial at some point.

Definition at line 54 of file kzg10.hpp.

◆ Field

template<typename ppT >
using libsnark::kzg10< ppT >::Field = libff::Fr<ppT>

Definition at line 33 of file kzg10.hpp.

Member Function Documentation

◆ commit()

template<typename ppT >
static commitment libsnark::kzg10< ppT >::commit ( const srs srs,
const polynomial< Field > &  phi 
)
static

The Commit function from [KZG10] section 3.2. Commit to a polynomial \phi, using some srs.

◆ create_evaluation_witness()

template<typename ppT >
static evaluation_witness libsnark::kzg10< ppT >::create_evaluation_witness ( const polynomial< Field > &  phi,
const Field i,
const Field evaluation,
const srs srs 
)
static

createwitness from [KZG10] section 3.2. Create a witness for the evaluation of the polynomial phi at i.

◆ evaluate_polynomial()

template<typename ppT >
static Field libsnark::kzg10< ppT >::evaluate_polynomial ( const polynomial< Field > &  phi,
Field  i 
)
static

◆ setup()

template<typename ppT >
static srs libsnark::kzg10< ppT >::setup ( size_t  max_degree)
static

Create a PK. A more secure way to do this is through a simple multi-party computation. max_degree is the maximum degree polynomial which can be used with the generated srs (denoted t in [KZG10] section 3.2).

◆ setup_from_secret()

template<typename ppT >
static srs libsnark::kzg10< ppT >::setup_from_secret ( size_t  max_degree,
const Field alpha 
)
static

Intended only for testing.

◆ verify_evaluation()

template<typename ppT >
static bool libsnark::kzg10< ppT >::verify_evaluation ( const Field i,
const Field evaluation,
const srs srs,
const evaluation_witness witness,
const commitment C 
)
static

VerifyEval from [KZG10] section 3.2. Given an srs, a commitment to a polynomial, a claimed evaluation of the polynomial, and a witness for that evaluation, check that the evaluation is indeed valid for the committed polynomial.

◆ verify_poly()

template<typename ppT >
static bool libsnark::kzg10< ppT >::verify_poly ( const srs srs,
commitment  C,
const polynomial< Field > &  phi 
)
static

VerifyPoly from the original scheme. Verify that a commitment C (generated with some srs) is a valid commitment for some polynomial phi.


The documentation for this class was generated from the following file: