Zeth - Zerocash on Ethereum  0.8
Reference implementation of the Zeth protocol by Clearmatics
proto_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_SERIALIZATION_PROTO_UTILS_HPP__
6 #define __ZETH_SERIALIZATION_PROTO_UTILS_HPP__
7 
8 #include "libzeth/core/bits.hpp"
14 #include "libzeth/core/note.hpp"
15 #include "libzeth/core/utils.hpp"
16 
17 #include <zeth/api/snark_messages.pb.h>
18 #include <zeth/api/zeth_messages.pb.h>
19 
20 // Functions to convert between in-memory and protobuf types. Consistent with
21 // encoding functions for other types, we use the `<type>_to_proto` and
22 // `<type>_from_proto` naming everywhere.a
23 
24 namespace libzeth
25 {
26 
27 zeth_note zeth_note_from_proto(const zeth_proto::ZethNote &note);
28 
29 template<typename ppT>
30 zeth_proto::Group1Point point_g1_affine_to_proto(const libff::G1<ppT> &point);
31 
32 template<typename ppT>
33 libff::G1<ppT> point_g1_affine_from_proto(const zeth_proto::Group1Point &point);
34 
35 template<typename ppT>
36 zeth_proto::Group2Point point_g2_affine_to_proto(const libff::G2<ppT> &point);
37 
38 template<typename ppT>
39 libff::G2<ppT> point_g2_affine_from_proto(const zeth_proto::Group2Point &point);
40 
41 template<typename FieldT, size_t TreeDepth>
42 joinsplit_input<FieldT, TreeDepth> joinsplit_input_from_proto(
43  const zeth_proto::JoinsplitInput &input);
44 
45 template<typename ppT> std::string pp_name();
46 
48 template<typename ppT>
49 void pp_to_proto(zeth_proto::PairingParameters &pp_proto);
50 
51 } // namespace libzeth
52 
54 
55 #endif // __ZETH_SERIALIZATION_PROTO_UTILS_HPP__
utils.hpp
libzeth::pp_to_proto
void pp_to_proto(zeth_proto::PairingParameters &pp_proto)
Populate a protobuf description of some pairing parameters.
libzeth::point_g1_affine_from_proto
libff::G1< ppT > point_g1_affine_from_proto(const zeth_proto::Group1Point &point)
joinsplit_input.hpp
include_libff.hpp
group_element_utils.hpp
libzeth
Definition: binary_operation.hpp:15
proto_utils.tcc
libzeth::point_g2_affine_to_proto
zeth_proto::Group2Point point_g2_affine_to_proto(const libff::G2< ppT > &point)
note.hpp
extended_proof.hpp
libzeth::joinsplit_input_from_proto
joinsplit_input< FieldT, TreeDepth > joinsplit_input_from_proto(const zeth_proto::JoinsplitInput &input)
libzeth::zeth_note_from_proto
zeth_note zeth_note_from_proto(const zeth_proto::ZethNote &note)
Definition: proto_utils.cpp:32
libzeth::point_g1_affine_to_proto
zeth_proto::Group1Point point_g1_affine_to_proto(const libff::G1< ppT > &point)
libzeth::point_g2_affine_from_proto
libff::G2< ppT > point_g2_affine_from_proto(const zeth_proto::Group2Point &point)
bits.hpp
libzeth::pp_name
std::string pp_name()
include_libsnark.hpp