Zeth - Zerocash on Ethereum  0.8
Reference implementation of the Zeth protocol by Clearmatics
mpc_utils.hpp
Go to the documentation of this file.
1 // Copyright (c) 2015-2022 Clearmatics Technologies Ltd
2 //
3 // SPDX-License-Identifier: LGPL-3.0+
4 
5 #ifndef __ZETH_MPC_GROTH16_MPC_UTILS_HPP__
6 #define __ZETH_MPC_GROTH16_MPC_UTILS_HPP__
7 
9 
10 #include <vector>
11 
12 // Structures and utility functions related to CRS generation via an
13 // MPC. Following [BoweGM17], the circuit $C$ generating the SRS is
14 // considered to be made up of 3 layers: $C = C_1 L_1 C_2$. The
15 // output from $C_1$ is exactly the powersoftau data. $L_1$
16 // represents the linear combination based on a specific QAP, and
17 // $C_2$ is the output from Phase2 of the MPC.
18 //
19 // References:
20 //
21 // \[BoweGM17]
22 // "Scalable Multi-party Computation for zk-SNARK Parameters in the Random
23 // Beacon Model"
24 // Sean Bowe and Ariel Gabizon and Ian Miers,
25 // IACR Cryptology ePrint Archive 2017,
26 // <http://eprint.iacr.org/2017/1050>
27 
28 namespace libzeth
29 {
30 
31 template<typename ppT> class srs_powersoftau;
32 template<typename ppT> class srs_lagrange_evaluations;
33 
37 template<typename ppT> class srs_mpc_layer_L1
38 {
39 public:
41  libff::G1_vector<ppT> T_tau_powers_g1;
42 
44  libff::G1_vector<ppT> A_g1;
45 
47  libff::G1_vector<ppT> B_g1;
48 
50  libff::G2_vector<ppT> B_g2;
51 
53  libff::G1_vector<ppT> ABC_g1;
54 
56  libff::G1_vector<ppT> &&T_tau_powers_g1,
57  libff::G1_vector<ppT> &&A_g1,
58  libff::G1_vector<ppT> &&B_g1,
59  libff::G2_vector<ppT> &&B_g2,
60  libff::G1_vector<ppT> &&ABC_g1);
61 
62  size_t degree() const;
63 
64  bool is_well_formed() const;
65  void write(std::ostream &out) const;
66  static srs_mpc_layer_L1 read(std::istream &in);
67 };
68 
71 template<typename ppT>
73  const srs_powersoftau<ppT> &pot,
74  const srs_lagrange_evaluations<ppT> &lagrange,
75  const libsnark::qap_instance<libff::Fr<ppT>> &qap);
76 
77 } // namespace libzeth
78 
80 
81 #endif // __ZETH_MPC_GROTH16_MPC_UTILS_HPP__
libzeth::srs_mpc_layer_L1::degree
size_t degree() const
groth16_snark.hpp
libzeth::srs_mpc_layer_L1::B_g2
libff::G2_vector< ppT > B_g2
{ [ B_i(x) ]_2 } i = 0 .. m
Definition: mpc_utils.hpp:50
libzeth::srs_mpc_layer_L1::ABC_g1
libff::G1_vector< ppT > ABC_g1
{ [ beta . A_i(x) + alpha . B_i(x) + C_i(x) ]_1 } i = l+1 ... m
Definition: mpc_utils.hpp:53
libzeth::srs_mpc_layer_L1::write
void write(std::ostream &out) const
libzeth::srs_mpc_layer_L1::B_g1
libff::G1_vector< ppT > B_g1
{ [ B_i(x) ]_1 } i = 0 .. m
Definition: mpc_utils.hpp:47
libzeth
Definition: binary_operation.hpp:15
libzeth::srs_lagrange_evaluations
Definition: mpc_utils.hpp:32
libzeth::srs_mpc_layer_L1
Definition: mpc_utils.hpp:37
libzeth::srs_mpc_layer_L1::srs_mpc_layer_L1
srs_mpc_layer_L1(libff::G1_vector< ppT > &&T_tau_powers_g1, libff::G1_vector< ppT > &&A_g1, libff::G1_vector< ppT > &&B_g1, libff::G2_vector< ppT > &&B_g2, libff::G1_vector< ppT > &&ABC_g1)
libzeth::mpc_compute_linearcombination
srs_mpc_layer_L1< ppT > mpc_compute_linearcombination(const srs_powersoftau< ppT > &pot, const srs_lagrange_evaluations< ppT > &lagrange, const libsnark::qap_instance< libff::Fr< ppT >> &qap)
mpc_utils.tcc
libzeth::srs_mpc_layer_L1::read
static srs_mpc_layer_L1 read(std::istream &in)
libzeth::srs_powersoftau
Definition: mpc_utils.hpp:31
libzeth::srs_mpc_layer_L1::is_well_formed
bool is_well_formed() const
libzeth::srs_mpc_layer_L1::A_g1
libff::G1_vector< ppT > A_g1
{ [ A_i(x) ]_1 } i = 0 .. m
Definition: mpc_utils.hpp:44
libzeth::srs_mpc_layer_L1::T_tau_powers_g1
libff::G1_vector< ppT > T_tau_powers_g1
{ [ t(x) . x^i ]_1 } i = 0 .. n-2
Definition: mpc_utils.hpp:41