Clearmatics Libsnark
0.1
C++ library for zkSNARK proofs
|
#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) |
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.
using libsnark::kzg10< ppT >::commitment = libff::G1<ppT> |
using libsnark::kzg10< ppT >::evaluation_witness = libff::G1<ppT> |
using libsnark::kzg10< ppT >::Field = libff::Fr<ppT> |
|
static |
The Commit function from [KZG10] section 3.2. Commit to a polynomial \phi, using some srs.
|
static |
createwitness from [KZG10] section 3.2. Create a witness for the evaluation of the polynomial phi at i.
|
static |
|
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).
|
static |
Intended only for testing.
|
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.
|
static |
VerifyPoly from the original scheme. Verify that a commitment C (generated with some srs) is a valid commitment for some polynomial phi.