Clearmatics Libsnark  0.1
C++ library for zkSNARK proofs
Public Member Functions | Public Attributes | Friends | List of all members
libsnark::r1cs_ppzksnark_proof< ppT > Class Template Reference

#include <r1cs_ppzksnark.hpp>

Collaboration diagram for libsnark::r1cs_ppzksnark_proof< ppT >:
Collaboration graph
[legend]

Public Member Functions

 r1cs_ppzksnark_proof ()
 
 r1cs_ppzksnark_proof (knowledge_commitment< libff::G1< ppT >, libff::G1< ppT >> &&g_A, knowledge_commitment< libff::G2< ppT >, libff::G1< ppT >> &&g_B, knowledge_commitment< libff::G1< ppT >, libff::G1< ppT >> &&g_C, libff::G1< ppT > &&g_H, libff::G1< ppT > &&g_K)
 
size_t G1_size () const
 
size_t G2_size () const
 
size_t size_in_bits () const
 
void print_size () const
 
bool is_well_formed () const
 
bool operator== (const r1cs_ppzksnark_proof< ppT > &other) const
 

Public Attributes

knowledge_commitment< libff::G1< ppT >, libff::G1< ppT > > g_A
 
knowledge_commitment< libff::G2< ppT >, libff::G1< ppT > > g_B
 
knowledge_commitment< libff::G1< ppT >, libff::G1< ppT > > g_C
 
libff::G1< ppT > g_H
 
libff::G1< ppT > g_K
 

Friends

std::ostream & operator (std::ostream &out, const r1cs_ppzksnark_proof< ppT > &proof)
 
std::istream & operator>> (std::istream &in, r1cs_ppzksnark_proof< ppT > &proof)
 

Detailed Description

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

A proof for the R1CS ppzkSNARK.

While the proof has a structure, externally one merely opaquely produces, serializes/deserializes, and verifies proofs. We only expose some information about the structure for statistics purposes.

Definition at line 298 of file r1cs_ppzksnark.hpp.

Constructor & Destructor Documentation

◆ r1cs_ppzksnark_proof() [1/2]

template<typename ppT >
libsnark::r1cs_ppzksnark_proof< ppT >::r1cs_ppzksnark_proof ( )
inline

Definition at line 323 of file r1cs_ppzksnark.hpp.

324  {
325  // invalid proof with valid curve points
326  this->g_A.g = libff::G1<ppT>::one();
327  this->g_A.h = libff::G1<ppT>::one();
328  this->g_B.g = libff::G2<ppT>::one();
329  this->g_B.h = libff::G1<ppT>::one();
330  this->g_C.g = libff::G1<ppT>::one();
331  this->g_C.h = libff::G1<ppT>::one();
332  this->g_H = libff::G1<ppT>::one();
333  this->g_K = libff::G1<ppT>::one();
334  }

◆ r1cs_ppzksnark_proof() [2/2]

template<typename ppT >
libsnark::r1cs_ppzksnark_proof< ppT >::r1cs_ppzksnark_proof ( knowledge_commitment< libff::G1< ppT >, libff::G1< ppT >> &&  g_A,
knowledge_commitment< libff::G2< ppT >, libff::G1< ppT >> &&  g_B,
knowledge_commitment< libff::G1< ppT >, libff::G1< ppT >> &&  g_C,
libff::G1< ppT > &&  g_H,
libff::G1< ppT > &&  g_K 
)
inline

Definition at line 335 of file r1cs_ppzksnark.hpp.

341  : g_A(std::move(g_A))
342  , g_B(std::move(g_B))
343  , g_C(std::move(g_C))
344  , g_H(std::move(g_H))
345  , g_K(std::move(g_K)){};

Member Function Documentation

◆ G1_size()

template<typename ppT >
size_t libsnark::r1cs_ppzksnark_proof< ppT >::G1_size ( ) const
inline

Definition at line 347 of file r1cs_ppzksnark.hpp.

347 { return 7; }
Here is the caller graph for this function:

◆ G2_size()

template<typename ppT >
size_t libsnark::r1cs_ppzksnark_proof< ppT >::G2_size ( ) const
inline

Definition at line 349 of file r1cs_ppzksnark.hpp.

349 { return 1; }
Here is the caller graph for this function:

◆ is_well_formed()

template<typename ppT >
bool libsnark::r1cs_ppzksnark_proof< ppT >::is_well_formed ( ) const
inline

Definition at line 367 of file r1cs_ppzksnark.hpp.

368  {
369  return (
370  g_A.g.is_well_formed() && g_A.h.is_well_formed() &&
371  g_B.g.is_well_formed() && g_B.h.is_well_formed() &&
372  g_C.g.is_well_formed() && g_C.h.is_well_formed() &&
373  g_H.is_well_formed() && g_K.is_well_formed());
374  }

◆ operator==()

template<typename ppT >
bool libsnark::r1cs_ppzksnark_proof< ppT >::operator== ( const r1cs_ppzksnark_proof< ppT > &  other) const

◆ print_size()

template<typename ppT >
void libsnark::r1cs_ppzksnark_proof< ppT >::print_size ( ) const
inline

Definition at line 357 of file r1cs_ppzksnark.hpp.

358  {
359  libff::print_indent();
360  printf("* G1 elements in proof: %zu\n", this->G1_size());
361  libff::print_indent();
362  printf("* G2 elements in proof: %zu\n", this->G2_size());
363  libff::print_indent();
364  printf("* Proof size in bits: %zu\n", this->size_in_bits());
365  }

◆ size_in_bits()

template<typename ppT >
size_t libsnark::r1cs_ppzksnark_proof< ppT >::size_in_bits ( ) const
inline

Definition at line 351 of file r1cs_ppzksnark.hpp.

352  {
353  return G1_size() * libff::G1<ppT>::size_in_bits() +
354  G2_size() * libff::G2<ppT>::size_in_bits();
355  }
Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator

template<typename ppT >
std::ostream& operator ( std::ostream &  out,
const r1cs_ppzksnark_proof< ppT > &  proof 
)
friend

◆ operator>>

template<typename ppT >
std::istream& operator>> ( std::istream &  in,
r1cs_ppzksnark_proof< ppT > &  proof 
)
friend

Member Data Documentation

◆ g_A

template<typename ppT >
knowledge_commitment<libff::G1<ppT>, libff::G1<ppT> > libsnark::r1cs_ppzksnark_proof< ppT >::g_A

Definition at line 317 of file r1cs_ppzksnark.hpp.

◆ g_B

template<typename ppT >
knowledge_commitment<libff::G2<ppT>, libff::G1<ppT> > libsnark::r1cs_ppzksnark_proof< ppT >::g_B

Definition at line 318 of file r1cs_ppzksnark.hpp.

◆ g_C

template<typename ppT >
knowledge_commitment<libff::G1<ppT>, libff::G1<ppT> > libsnark::r1cs_ppzksnark_proof< ppT >::g_C

Definition at line 319 of file r1cs_ppzksnark.hpp.

◆ g_H

template<typename ppT >
libff::G1<ppT> libsnark::r1cs_ppzksnark_proof< ppT >::g_H

Definition at line 320 of file r1cs_ppzksnark.hpp.

◆ g_K

template<typename ppT >
libff::G1<ppT> libsnark::r1cs_ppzksnark_proof< ppT >::g_K

Definition at line 321 of file r1cs_ppzksnark.hpp.


The documentation for this class was generated from the following file:
libsnark::knowledge_commitment::g
T1 g
Definition: knowledge_commitment.hpp:36
libsnark::r1cs_ppzksnark_proof::G1_size
size_t G1_size() const
Definition: r1cs_ppzksnark.hpp:347
libsnark::r1cs_ppzksnark_proof::g_B
knowledge_commitment< libff::G2< ppT >, libff::G1< ppT > > g_B
Definition: r1cs_ppzksnark.hpp:318
libsnark::r1cs_ppzksnark_proof::g_C
knowledge_commitment< libff::G1< ppT >, libff::G1< ppT > > g_C
Definition: r1cs_ppzksnark.hpp:319
libsnark::r1cs_ppzksnark_proof::size_in_bits
size_t size_in_bits() const
Definition: r1cs_ppzksnark.hpp:351
libsnark::r1cs_ppzksnark_proof::g_K
libff::G1< ppT > g_K
Definition: r1cs_ppzksnark.hpp:321
libsnark::knowledge_commitment::h
T2 h
Definition: knowledge_commitment.hpp:37
libsnark::r1cs_ppzksnark_proof::g_H
libff::G1< ppT > g_H
Definition: r1cs_ppzksnark.hpp:320
libsnark::r1cs_ppzksnark_proof::g_A
knowledge_commitment< libff::G1< ppT >, libff::G1< ppT > > g_A
Definition: r1cs_ppzksnark.hpp:317
libsnark::r1cs_ppzksnark_proof::G2_size
size_t G2_size() const
Definition: r1cs_ppzksnark.hpp:349