Zeth - Zerocash on Ethereum
0.8
Reference implementation of the Zeth protocol by Clearmatics
|
#include <merkle_tree_field.hpp>
Public Member Functions | |
merkle_tree_field (const size_t depth) | |
merkle_tree_field (const size_t depth, const std::vector< FieldT > &contents_as_vector) | |
merkle_tree_field (const size_t depth, const std::map< size_t, FieldT > &contents) | |
FieldT | get_value (const size_t address) const |
void | set_value (const size_t address, const FieldT &value) |
FieldT | get_root () const |
std::vector< FieldT > | get_path (const size_t address) const |
void | dump () const |
Public Attributes | |
std::vector< FieldT > | hash_defaults |
std::map< size_t, FieldT > | values |
std::map< size_t, FieldT > | hashes |
size_t | depth |
Merkle Tree whose nodes are field elements
A Merkle tree is maintained as two maps:
values
= Map from addresses to values, andhashes
= Map from addresses to hashes.The second map maintains the intermediate hashes of a Merkle tree built atop the values currently stored in the tree (the implementation admits a very efficient support for sparse trees). Besides offering methods to load and store values, the class offers methods to retrieve the root of the Merkle tree and to obtain the authentication paths for (the value at) a given address.
Definition at line 29 of file merkle_tree_field.hpp.
libzeth::merkle_tree_field< FieldT, HashTreeT >::merkle_tree_field | ( | const size_t | depth | ) |
libzeth::merkle_tree_field< FieldT, HashTreeT >::merkle_tree_field | ( | const size_t | depth, |
const std::vector< FieldT > & | contents_as_vector | ||
) |
libzeth::merkle_tree_field< FieldT, HashTreeT >::merkle_tree_field | ( | const size_t | depth, |
const std::map< size_t, FieldT > & | contents | ||
) |
void libzeth::merkle_tree_field< FieldT, HashTreeT >::dump | ( | ) | const |
std::vector<FieldT> libzeth::merkle_tree_field< FieldT, HashTreeT >::get_path | ( | const size_t | address | ) | const |
FieldT libzeth::merkle_tree_field< FieldT, HashTreeT >::get_root | ( | ) | const |
FieldT libzeth::merkle_tree_field< FieldT, HashTreeT >::get_value | ( | const size_t | address | ) | const |
void libzeth::merkle_tree_field< FieldT, HashTreeT >::set_value | ( | const size_t | address, |
const FieldT & | value | ||
) |
size_t libzeth::merkle_tree_field< FieldT, HashTreeT >::depth |
Definition at line 36 of file merkle_tree_field.hpp.
std::vector<FieldT> libzeth::merkle_tree_field< FieldT, HashTreeT >::hash_defaults |
Definition at line 33 of file merkle_tree_field.hpp.
std::map<size_t, FieldT> libzeth::merkle_tree_field< FieldT, HashTreeT >::hashes |
Definition at line 35 of file merkle_tree_field.hpp.
std::map<size_t, FieldT> libzeth::merkle_tree_field< FieldT, HashTreeT >::values |
Definition at line 34 of file merkle_tree_field.hpp.