Zeth - Zerocash on Ethereum  0.8
Reference implementation of the Zeth protocol by Clearmatics
Public Types | Static Public Member Functions | Static Public Attributes | List of all members
libzeth::groth16_snark< ppT > Class Template Reference

Core types and operations for the GROTH16 snark. More...

#include <groth16_snark.hpp>

Public Types

using proving_key = libsnark::r1cs_gg_ppzksnark_proving_key< ppT >
 
using verification_key = libsnark::r1cs_gg_ppzksnark_verification_key< ppT >
 
using keypair = libsnark::r1cs_gg_ppzksnark_keypair< ppT >
 
using proof = libsnark::r1cs_gg_ppzksnark_proof< ppT >
 

Static Public Member Functions

static keypair generate_setup (const libsnark::protoboard< libff::Fr< ppT >> &pb)
 Run the trusted setup and return the keypair for the circuit. More...
 
static proof generate_proof (const proving_key &proving_key, const libsnark::protoboard< libff::Fr< ppT >> &pb)
 Generate the proof (from the values set to the protoboard) More...
 
static proof generate_proof (const proving_key &proving_key, const libsnark::r1cs_primary_input< libff::Fr< ppT >> &primary_input, const libsnark::r1cs_auxiliary_input< libff::Fr< ppT >> auxiliary_input)
 Generate the proof (from given primary and auxiliary values) More...
 
static bool verify (const libsnark::r1cs_primary_input< libff::Fr< ppT >> &primary_inputs, const proof &proof, const verification_key &verification_key)
 Verify proof. More...
 
static void verification_key_write_json (const verification_key &, std::ostream &)
 Write verification as json. More...
 
static void verification_key_write_bytes (const verification_key &, std::ostream &)
 Write verification key as bytes. More...
 
static void verification_key_read_bytes (verification_key &, std::istream &)
 Read a verification key as bytes. More...
 
static void proving_key_write_bytes (const proving_key &, std::ostream &)
 Write proving key as bytes. More...
 
static void proving_key_read_bytes (proving_key &, std::istream &)
 Read proving key as bytes. More...
 
static void proof_write_json (const proof &, std::ostream &)
 Write proof as json. More...
 
static void proof_write_bytes (const proof &, std::ostream &)
 Write proof as bytes. More...
 
static void proof_read_bytes (proof &, std::istream &)
 Read proof as bytes. More...
 
static void keypair_write_bytes (const keypair &, std::ostream &)
 Write a keypair as bytes. More...
 
static void keypair_read_bytes (keypair &, std::istream &)
 Read a keypair from a stream. More...
 

Static Public Attributes

static const std::string name
 

Detailed Description

template<typename ppT>
class libzeth::groth16_snark< ppT >

Core types and operations for the GROTH16 snark.

Definition at line 15 of file groth16_snark.hpp.

Member Typedef Documentation

◆ keypair

template<typename ppT >
using libzeth::groth16_snark< ppT >::keypair = libsnark::r1cs_gg_ppzksnark_keypair<ppT>

Definition at line 20 of file groth16_snark.hpp.

◆ proof

template<typename ppT >
using libzeth::groth16_snark< ppT >::proof = libsnark::r1cs_gg_ppzksnark_proof<ppT>

Definition at line 21 of file groth16_snark.hpp.

◆ proving_key

template<typename ppT >
using libzeth::groth16_snark< ppT >::proving_key = libsnark::r1cs_gg_ppzksnark_proving_key<ppT>

Definition at line 18 of file groth16_snark.hpp.

◆ verification_key

template<typename ppT >
using libzeth::groth16_snark< ppT >::verification_key = libsnark::r1cs_gg_ppzksnark_verification_key<ppT>

Definition at line 19 of file groth16_snark.hpp.

Member Function Documentation

◆ generate_proof() [1/2]

template<typename ppT >
static proof libzeth::groth16_snark< ppT >::generate_proof ( const proving_key proving_key,
const libsnark::protoboard< libff::Fr< ppT >> &  pb 
)
static

Generate the proof (from the values set to the protoboard)

◆ generate_proof() [2/2]

template<typename ppT >
static proof libzeth::groth16_snark< ppT >::generate_proof ( const proving_key proving_key,
const libsnark::r1cs_primary_input< libff::Fr< ppT >> &  primary_input,
const libsnark::r1cs_auxiliary_input< libff::Fr< ppT >>  auxiliary_input 
)
static

Generate the proof (from given primary and auxiliary values)

◆ generate_setup()

template<typename ppT >
static keypair libzeth::groth16_snark< ppT >::generate_setup ( const libsnark::protoboard< libff::Fr< ppT >> &  pb)
static

Run the trusted setup and return the keypair for the circuit.

◆ keypair_read_bytes()

template<typename ppT >
static void libzeth::groth16_snark< ppT >::keypair_read_bytes ( keypair ,
std::istream &   
)
static

Read a keypair from a stream.

◆ keypair_write_bytes()

template<typename ppT >
static void libzeth::groth16_snark< ppT >::keypair_write_bytes ( const keypair ,
std::ostream &   
)
static

Write a keypair as bytes.

◆ proof_read_bytes()

template<typename ppT >
static void libzeth::groth16_snark< ppT >::proof_read_bytes ( proof ,
std::istream &   
)
static

Read proof as bytes.

◆ proof_write_bytes()

template<typename ppT >
static void libzeth::groth16_snark< ppT >::proof_write_bytes ( const proof ,
std::ostream &   
)
static

Write proof as bytes.

◆ proof_write_json()

template<typename ppT >
static void libzeth::groth16_snark< ppT >::proof_write_json ( const proof ,
std::ostream &   
)
static

Write proof as json.

◆ proving_key_read_bytes()

template<typename ppT >
static void libzeth::groth16_snark< ppT >::proving_key_read_bytes ( proving_key ,
std::istream &   
)
static

Read proving key as bytes.

◆ proving_key_write_bytes()

template<typename ppT >
static void libzeth::groth16_snark< ppT >::proving_key_write_bytes ( const proving_key ,
std::ostream &   
)
static

Write proving key as bytes.

◆ verification_key_read_bytes()

template<typename ppT >
static void libzeth::groth16_snark< ppT >::verification_key_read_bytes ( verification_key ,
std::istream &   
)
static

Read a verification key as bytes.

◆ verification_key_write_bytes()

template<typename ppT >
static void libzeth::groth16_snark< ppT >::verification_key_write_bytes ( const verification_key ,
std::ostream &   
)
static

Write verification key as bytes.

◆ verification_key_write_json()

template<typename ppT >
static void libzeth::groth16_snark< ppT >::verification_key_write_json ( const verification_key ,
std::ostream &   
)
static

Write verification as json.

◆ verify()

template<typename ppT >
static bool libzeth::groth16_snark< ppT >::verify ( const libsnark::r1cs_primary_input< libff::Fr< ppT >> &  primary_inputs,
const proof proof,
const verification_key verification_key 
)
static

Verify proof.

Here is the caller graph for this function:

Member Data Documentation

◆ name

template<typename ppT >
const std::string libzeth::groth16_snark< ppT >::name
static

String name of this snark, corresponding to <SNARK> in the ZETH_SNARK_<SNARK> configuration variable.

Definition at line 25 of file groth16_snark.hpp.


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