Monero
Loading...
Searching...
No Matches
cryptonote_format_utils.h
Go to the documentation of this file.
1// Copyright (c) 2014-2022, The Monero Project
2//
3// All rights reserved.
4//
5// Redistribution and use in source and binary forms, with or without modification, are
6// permitted provided that the following conditions are met:
7//
8// 1. Redistributions of source code must retain the above copyright notice, this list of
9// conditions and the following disclaimer.
10//
11// 2. Redistributions in binary form must reproduce the above copyright notice, this list
12// of conditions and the following disclaimer in the documentation and/or other
13// materials provided with the distribution.
14//
15// 3. Neither the name of the copyright holder nor the names of its contributors may be
16// used to endorse or promote products derived from this software without specific
17// prior written permission.
18//
19// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
20// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
22// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
27// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28//
29// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
30
31#pragma once
32#include "blobdatatype.h"
34#include "tx_extra.h"
35#include "account.h"
36#include "subaddress_index.h"
37#include "include_base_utils.h"
38#include "crypto/crypto.h"
39#include "crypto/hash.h"
40#include <unordered_map>
41#include <boost/multiprecision/cpp_int.hpp>
42
43namespace epee
44{
45 class wipeable_string;
46}
47
48namespace cryptonote
49{
50 //---------------------------------------------------------------
51 void get_transaction_prefix_hash(const transaction_prefix& tx, crypto::hash& h, hw::device &hwdev);
52 crypto::hash get_transaction_prefix_hash(const transaction_prefix& tx, hw::device &hwdev);
53 void get_transaction_prefix_hash(const transaction_prefix& tx, crypto::hash& h);
54 crypto::hash get_transaction_prefix_hash(const transaction_prefix& tx);
55 bool parse_and_validate_tx_prefix_from_blob(const blobdata_ref& tx_blob, transaction_prefix& tx);
56 bool parse_and_validate_tx_from_blob(const blobdata_ref& tx_blob, transaction& tx, crypto::hash& tx_hash, crypto::hash& tx_prefix_hash);
57 bool parse_and_validate_tx_from_blob(const blobdata_ref& tx_blob, transaction& tx, crypto::hash& tx_hash);
58 bool parse_and_validate_tx_from_blob(const blobdata_ref& tx_blob, transaction& tx);
59 bool parse_and_validate_tx_base_from_blob(const blobdata_ref& tx_blob, transaction& tx);
60 bool is_v1_tx(const blobdata_ref& tx_blob);
61 bool is_v1_tx(const blobdata& tx_blob);
62
63 template<typename T>
64 bool find_tx_extra_field_by_type(const std::vector<tx_extra_field>& tx_extra_fields, T& field, size_t index = 0)
65 {
66 auto it = std::find_if(tx_extra_fields.begin(), tx_extra_fields.end(), [&index](const tx_extra_field& f) { return typeid(T) == f.type() && !index--; });
67 if(tx_extra_fields.end() == it)
68 return false;
69
70 field = boost::get<T>(*it);
71 return true;
72 }
73
74 bool parse_tx_extra(const std::vector<uint8_t>& tx_extra, std::vector<tx_extra_field>& tx_extra_fields);
75 bool sort_tx_extra(const std::vector<uint8_t>& tx_extra, std::vector<uint8_t> &sorted_tx_extra, bool allow_partial = false);
76 crypto::public_key get_tx_pub_key_from_extra(const std::vector<uint8_t>& tx_extra, size_t pk_index = 0);
77 crypto::public_key get_tx_pub_key_from_extra(const transaction_prefix& tx, size_t pk_index = 0);
78 crypto::public_key get_tx_pub_key_from_extra(const transaction& tx, size_t pk_index = 0);
79 bool add_tx_pub_key_to_extra(transaction& tx, const crypto::public_key& tx_pub_key);
80 bool add_tx_pub_key_to_extra(transaction_prefix& tx, const crypto::public_key& tx_pub_key);
81 bool add_tx_pub_key_to_extra(std::vector<uint8_t>& tx_extra, const crypto::public_key& tx_pub_key);
82 std::vector<crypto::public_key> get_additional_tx_pub_keys_from_extra(const std::vector<uint8_t>& tx_extra);
83 std::vector<crypto::public_key> get_additional_tx_pub_keys_from_extra(const transaction_prefix& tx);
84 bool add_additional_tx_pub_keys_to_extra(std::vector<uint8_t>& tx_extra, const std::vector<crypto::public_key>& additional_pub_keys);
85 bool add_extra_nonce_to_tx_extra(std::vector<uint8_t>& tx_extra, const blobdata& extra_nonce);
86 bool add_mm_merkle_root_to_tx_extra(std::vector<uint8_t>& tx_extra, const crypto::hash& mm_merkle_root, size_t mm_merkle_tree_depth);
87 bool remove_field_from_tx_extra(std::vector<uint8_t>& tx_extra, const std::type_info &type);
88 void set_payment_id_to_tx_extra_nonce(blobdata& extra_nonce, const crypto::hash& payment_id);
89 void set_encrypted_payment_id_to_tx_extra_nonce(blobdata& extra_nonce, const crypto::hash8& payment_id);
90 bool get_payment_id_from_tx_extra_nonce(const blobdata& extra_nonce, crypto::hash& payment_id);
91 bool get_encrypted_payment_id_from_tx_extra_nonce(const blobdata& extra_nonce, crypto::hash8& payment_id);
92 void set_tx_out(const uint64_t amount, const crypto::public_key& output_public_key, const bool use_view_tags, const crypto::view_tag& view_tag, tx_out& out);
93 bool check_output_types(const transaction& tx, const uint8_t hf_version);
94 bool out_can_be_to_acc(const boost::optional<crypto::view_tag>& view_tag_opt, const crypto::key_derivation& derivation, const size_t output_index, hw::device *hwdev = nullptr);
95 bool is_out_to_acc(const account_keys& acc, const crypto::public_key& output_public_key, const crypto::public_key& tx_pub_key, const std::vector<crypto::public_key>& additional_tx_public_keys, size_t output_index, const boost::optional<crypto::view_tag>& view_tag_opt = boost::optional<crypto::view_tag>());
97 {
100 };
101 boost::optional<subaddress_receive_info> is_out_to_acc_precomp(const std::unordered_map<crypto::public_key, subaddress_index>& subaddresses, const crypto::public_key& out_key, const crypto::key_derivation& derivation, const std::vector<crypto::key_derivation>& additional_derivations, size_t output_index, hw::device &hwdev, const boost::optional<crypto::view_tag>& view_tag_opt = boost::optional<crypto::view_tag>());
102 bool lookup_acc_outs(const account_keys& acc, const transaction& tx, const crypto::public_key& tx_pub_key, const std::vector<crypto::public_key>& additional_tx_public_keys, std::vector<size_t>& outs, uint64_t& money_transfered);
103 bool lookup_acc_outs(const account_keys& acc, const transaction& tx, std::vector<size_t>& outs, uint64_t& money_transfered);
104 bool get_tx_fee(const transaction& tx, uint64_t & fee);
106 bool generate_key_image_helper(const account_keys& ack, const std::unordered_map<crypto::public_key, subaddress_index>& subaddresses, const crypto::public_key& out_key, const crypto::public_key& tx_public_key, const std::vector<crypto::public_key>& additional_tx_public_keys, size_t real_output_index, keypair& in_ephemeral, crypto::key_image& ki, hw::device &hwdev);
107 bool generate_key_image_helper_precomp(const account_keys& ack, const crypto::public_key& out_key, const crypto::key_derivation& recv_derivation, size_t real_output_index, const subaddress_index& received_index, keypair& in_ephemeral, crypto::key_image& ki, hw::device &hwdev);
108 void get_blob_hash(const blobdata& blob, crypto::hash& res);
109 void get_blob_hash(const blobdata_ref& blob, crypto::hash& res);
112 std::string short_hash_str(const crypto::hash& h);
113
116 bool get_transaction_hash(const transaction& t, crypto::hash& res, size_t& blob_size);
117 bool get_transaction_hash(const transaction& t, crypto::hash& res, size_t* blob_size);
120 bool calculate_transaction_hash(const transaction& t, crypto::hash& res, size_t* blob_size);
121 crypto::hash get_pruned_transaction_hash(const transaction& t, const crypto::hash &pruned_data_hash);
122
124 bool calculate_block_hash(const block& b, crypto::hash& res, const blobdata_ref *blob = NULL);
125 bool get_block_hash(const block& b, crypto::hash& res);
127 bool parse_and_validate_block_from_blob(const blobdata_ref& b_blob, block& b, crypto::hash *block_hash);
129 bool parse_and_validate_block_from_blob(const blobdata_ref& b_blob, block& b, crypto::hash &block_hash);
130 bool get_inputs_money_amount(const transaction& tx, uint64_t& money);
132 bool get_output_public_key(const cryptonote::tx_out& out, crypto::public_key& output_public_key);
133 boost::optional<crypto::view_tag> get_output_view_tag(const cryptonote::tx_out& out);
135 bool check_outs_valid(const transaction& tx);
136 bool parse_amount(uint64_t& amount, const std::string& str_amount);
138 uint64_t get_transaction_weight(const transaction &tx, size_t blob_size);
140
145 std::vector<uint64_t> relative_output_offsets_to_absolute(const std::vector<uint64_t>& off);
146 std::vector<uint64_t> absolute_output_offsets_to_relative(const std::vector<uint64_t>& off);
147 void set_default_decimal_point(unsigned int decimal_point = CRYPTONOTE_DISPLAY_DECIMAL_POINT);
148 unsigned int get_default_decimal_point();
149 std::string get_unit(unsigned int decimal_point = -1);
150 std::string print_money(uint64_t amount, unsigned int decimal_point = -1);
151 std::string print_money(const boost::multiprecision::uint128_t &amount, unsigned int decimal_point = -1);
152 uint64_t round_money_up(uint64_t amount, unsigned significant_digits);
153 std::string round_money_up(const std::string &amount, unsigned significant_digits);
154 //---------------------------------------------------------------
155 template<class t_object>
156 bool t_serializable_object_from_blob(t_object& to, const blobdata& b_blob)
157 {
158 binary_archive<false> ba{epee::strspan<std::uint8_t>(b_blob)};
159 bool r = ::serialization::serialize(ba, to);
160 return r;
161 }
162 //---------------------------------------------------------------
163 template<class t_object>
164 bool t_serializable_object_to_blob(const t_object& to, blobdata& b_blob)
165 {
166 std::stringstream ss;
168 bool r = ::serialization::serialize(ba, const_cast<t_object&>(to));
169 b_blob = ss.str();
170 return r;
171 }
172 //---------------------------------------------------------------
173 template<class t_object>
175 {
176 blobdata b;
178 return b;
179 }
180 //---------------------------------------------------------------
181 template<class t_object>
182 bool get_object_hash(const t_object& o, crypto::hash& res)
183 {
185 return true;
186 }
187 //---------------------------------------------------------------
188 template<class t_object>
189 size_t get_object_blobsize(const t_object& o)
190 {
192 return b.size();
193 }
194 //---------------------------------------------------------------
195 template<class t_object>
196 bool get_object_hash(const t_object& o, crypto::hash& res, size_t& blob_size)
197 {
199 blob_size = bl.size();
200 get_blob_hash(bl, res);
201 return true;
202 }
203 //---------------------------------------------------------------
204 template <typename T>
205 std::string obj_to_json_str(T& obj)
206 {
207 std::stringstream ss;
208 json_archive<true> ar(ss, true);
209 bool r = ::serialization::serialize(ar, obj);
210 CHECK_AND_ASSERT_MES(r, "", "obj_to_json_str failed: serialization::serialize returned false");
211 return ss.str();
212 }
213 //---------------------------------------------------------------
214 // 62387455827 -> 455827 + 7000000 + 80000000 + 300000000 + 2000000000 + 60000000000, where 455827 <= dust_threshold
215 template<typename chunk_handler_t, typename dust_handler_t>
216 void decompose_amount_into_digits(uint64_t amount, uint64_t dust_threshold, const chunk_handler_t& chunk_handler, const dust_handler_t& dust_handler)
217 {
218 if (0 == amount)
219 {
220 return;
221 }
222
223 bool is_dust_handled = false;
224 uint64_t dust = 0;
225 uint64_t order = 1;
226 while (0 != amount)
227 {
228 uint64_t chunk = (amount % 10) * order;
229 amount /= 10;
230 order *= 10;
231
232 if (dust + chunk <= dust_threshold)
233 {
234 dust += chunk;
235 }
236 else
237 {
238 if (!is_dust_handled && 0 != dust)
239 {
240 dust_handler(dust);
241 is_dust_handled = true;
242 }
243 if (0 != chunk)
244 {
245 chunk_handler(chunk);
246 }
247 }
248 }
249
250 if (!is_dust_handled && 0 != dust)
251 {
252 dust_handler(dust);
253 }
254 }
255 //---------------------------------------------------------------
257 bool block_to_blob(const block& b, blobdata& b_blob);
258 blobdata tx_to_blob(const transaction& b);
259 bool tx_to_blob(const transaction& b, blobdata& b_blob);
260 void get_tx_tree_hash(const std::vector<crypto::hash>& tx_hashes, crypto::hash& h);
261 crypto::hash get_tx_tree_hash(const std::vector<crypto::hash>& tx_hashes);
264 void get_hash_stats(uint64_t &tx_hashes_calculated, uint64_t &tx_hashes_cached, uint64_t &block_hashes_calculated, uint64_t & block_hashes_cached);
265
268#define CHECKED_GET_SPECIFIC_VARIANT(variant_var, specific_type, variable_name, fail_return_val) \
269 CHECK_AND_ASSERT_MES(variant_var.type() == typeid(specific_type), fail_return_val, "wrong variant type: " << variant_var.type().name() << ", expected " << typeid(specific_type).name()); \
270 specific_type& variable_name = boost::get<specific_type>(variant_var);
271}
static const unsigned long long order[16]
Definition: sc25519_from32bytes.c:8
cryptonote::block b
Definition: block.cpp:40
static uint64_t h
Definition: blockchain_stats.cpp:55
binary_archive< false > ba
Definition: bulletproof.cpp:40
Definition: cryptonote_basic.h:205
Definition: wipeable_string.h:41
Definition: device.hpp:87
binary_archive< false > ar
Definition: cold-outputs.cpp:54
#define CRYPTONOTE_DISPLAY_DECIMAL_POINT
Definition: cryptonote_config.h:64
const char * res
Definition: hmac_keccak.cpp:42
const char * key
Definition: hmac_keccak.cpp:40
POD_CLASS hash8
Definition: hash.h:51
POD_CLASS key_derivation
Definition: crypto.h:91
POD_CLASS view_tag
Definition: crypto.h:103
POD_CLASS public_key
Definition: crypto.h:64
POD_CLASS key_image
Definition: crypto.h:95
POD_CLASS hash
Definition: hash.h:48
Holds cryptonote related classes and helpers.
Definition: blockchain_db.cpp:45
bool t_serializable_object_from_blob(t_object &to, const blobdata &b_blob)
Definition: cryptonote_format_utils.h:156
std::string obj_to_json_str(T &obj)
Definition: cryptonote_format_utils.h:205
void get_hash_stats(uint64_t &tx_hashes_calculated, uint64_t &tx_hashes_cached, uint64_t &block_hashes_calculated, uint64_t &block_hashes_cached)
Definition: cryptonote_format_utils.cpp:1618
bool is_valid_decomposed_amount(uint64_t amount)
Definition: cryptonote_format_utils.cpp:1611
void set_encrypted_payment_id_to_tx_extra_nonce(blobdata &extra_nonce, const crypto::hash8 &payment_id)
Definition: cryptonote_format_utils.cpp:794
bool parse_and_validate_tx_prefix_from_blob(const blobdata_ref &tx_blob, transaction_prefix &tx)
Definition: cryptonote_format_utils.cpp:245
std::string short_hash_str(const crypto::hash &h)
Definition: cryptonote_format_utils.cpp:933
bool get_object_hash(const t_object &o, crypto::hash &res)
Definition: cryptonote_format_utils.h:182
bool calculate_transaction_hash(const transaction &t, crypto::hash &res, size_t *blob_size)
Definition: cryptonote_format_utils.cpp:1352
bool sort_tx_extra(const std::vector< uint8_t > &tx_extra, std::vector< uint8_t > &sorted_tx_extra, bool allow_partial)
Definition: cryptonote_format_utils.cpp:589
bool get_encrypted_payment_id_from_tx_extra_nonce(const blobdata &extra_nonce, crypto::hash8 &payment_id)
Definition: cryptonote_format_utils.cpp:812
bool check_inputs_overflow(const transaction &tx)
Definition: cryptonote_format_utils.cpp:876
void decompose_amount_into_digits(uint64_t amount, uint64_t dust_threshold, const chunk_handler_t &chunk_handler, const dust_handler_t &dust_handler)
Definition: cryptonote_format_utils.h:216
blobdata get_block_hashing_blob(const block &b)
Definition: cryptonote_format_utils.cpp:1440
bool get_inputs_money_amount(const transaction &tx, uint64_t &money)
Definition: cryptonote_format_utils.cpp:822
std::vector< crypto::public_key > get_additional_tx_pub_keys_from_extra(const std::vector< uint8_t > &tx_extra)
Definition: cryptonote_format_utils.cpp:692
bool get_tx_fee(const transaction &tx, uint64_t &fee)
Definition: cryptonote_format_utils.cpp:523
bool get_payment_id_from_tx_extra_nonce(const blobdata &extra_nonce, crypto::hash &payment_id)
Definition: cryptonote_format_utils.cpp:802
boost::optional< subaddress_receive_info > is_out_to_acc_precomp(const std::unordered_map< crypto::public_key, subaddress_index > &subaddresses, const crypto::public_key &out_key, const crypto::key_derivation &derivation, const std::vector< crypto::key_derivation > &additional_derivations, size_t output_index, hw::device &hwdev, const boost::optional< crypto::view_tag > &view_tag_opt)
Definition: cryptonote_format_utils.cpp:1047
void set_payment_id_to_tx_extra_nonce(blobdata &extra_nonce, const crypto::hash &payment_id)
Definition: cryptonote_format_utils.cpp:786
unsigned int get_default_decimal_point()
Definition: cryptonote_format_utils.cpp:1128
bool calculate_block_hash(const block &b, crypto::hash &res, const blobdata_ref *blob)
Definition: cryptonote_format_utils.cpp:1449
boost::variant< tx_extra_padding, tx_extra_pub_key, tx_extra_nonce, tx_extra_merge_mining_tag, tx_extra_additional_pub_keys, tx_extra_mysterious_minergate > tx_extra_field
Definition: tx_extra.h:181
void get_tx_tree_hash(const std::vector< crypto::hash > &tx_hashes, crypto::hash &h)
Definition: cryptonote_format_utils.cpp:1586
std::vector< uint64_t > absolute_output_offsets_to_relative(const std::vector< uint64_t > &off)
Definition: cryptonote_format_utils.cpp:1528
std::string print_money(uint64_t amount, unsigned int decimal_point)
Definition: cryptonote_format_utils.cpp:1166
bool check_money_overflow(const transaction &tx)
Definition: cryptonote_format_utils.cpp:871
std::vector< uint64_t > relative_output_offsets_to_absolute(const std::vector< uint64_t > &off)
Definition: cryptonote_format_utils.cpp:1520
bool get_block_hash(const block &b, crypto::hash &res)
Definition: cryptonote_format_utils.cpp:1494
bool is_out_to_acc(const account_keys &acc, const crypto::public_key &output_public_key, const crypto::public_key &tx_pub_key, const std::vector< crypto::public_key > &additional_tx_pub_keys, size_t output_index, const boost::optional< crypto::view_tag > &view_tag_opt)
Definition: cryptonote_format_utils.cpp:1017
crypto::secret_key encrypt_key(crypto::secret_key key, const epee::wipeable_string &passphrase)
Definition: cryptonote_format_utils.cpp:1626
uint64_t get_block_height(const block &b)
Definition: cryptonote_format_utils.cpp:833
crypto::public_key get_tx_pub_key_from_extra(const std::vector< uint8_t > &tx_extra, size_t pk_index)
Definition: cryptonote_format_utils.cpp:652
bool add_tx_pub_key_to_extra(transaction &tx, const crypto::public_key &tx_pub_key)
Definition: cryptonote_format_utils.cpp:674
crypto::hash get_transaction_hash(const transaction &t)
Definition: cryptonote_format_utils.cpp:1259
bool check_outs_valid(const transaction &tx)
Definition: cryptonote_format_utils.cpp:852
bool parse_and_validate_tx_from_blob(const blobdata_ref &tx_blob, transaction &tx)
Definition: cryptonote_format_utils.cpp:224
bool find_tx_extra_field_by_type(const std::vector< tx_extra_field > &tx_extra_fields, T &field, size_t index=0)
Definition: cryptonote_format_utils.h:64
crypto::hash get_transaction_prunable_hash(const transaction &t, const cryptonote::blobdata_ref *blobdata)
Definition: cryptonote_format_utils.cpp:1297
blobdata block_to_blob(const block &b)
Definition: cryptonote_format_utils.cpp:1566
crypto::secret_key decrypt_key(crypto::secret_key key, const epee::wipeable_string &passphrase)
Definition: cryptonote_format_utils.cpp:1634
bool generate_key_image_helper(const account_keys &ack, const std::unordered_map< crypto::public_key, subaddress_index > &subaddresses, const crypto::public_key &out_key, const crypto::public_key &tx_public_key, const std::vector< crypto::public_key > &additional_tx_public_keys, size_t real_output_index, keypair &in_ephemeral, crypto::key_image &ki, hw::device &hwdev)
Definition: cryptonote_format_utils.cpp:289
bool calculate_transaction_prunable_hash(const transaction &t, const cryptonote::blobdata_ref *blob, crypto::hash &res)
Definition: cryptonote_format_utils.cpp:1272
bool check_outs_overflow(const transaction &tx)
Definition: cryptonote_format_utils.cpp:889
bool out_can_be_to_acc(const boost::optional< crypto::view_tag > &view_tag_opt, const crypto::key_derivation &derivation, const size_t output_index, hw::device *hwdev)
Definition: cryptonote_format_utils.cpp:992
bool lookup_acc_outs(const account_keys &acc, const transaction &tx, std::vector< size_t > &outs, uint64_t &money_transfered)
Definition: cryptonote_format_utils.cpp:1074
void set_default_decimal_point(unsigned int decimal_point)
Definition: cryptonote_format_utils.cpp:1112
blobdata tx_to_blob(const transaction &tx)
Definition: cryptonote_format_utils.cpp:1576
bool parse_tx_extra(const std::vector< uint8_t > &tx_extra, std::vector< tx_extra_field > &tx_extra_fields)
Definition: cryptonote_format_utils.cpp:553
std::string blobdata
Definition: blobdatatype.h:39
static bool is_v1_tx(MDB_cursor *c_txs_pruned, MDB_val *tx_id)
Definition: db_lmdb.cpp:1973
bool add_additional_tx_pub_keys_to_extra(std::vector< uint8_t > &tx_extra, const std::vector< crypto::public_key > &additional_pub_keys)
Definition: cryptonote_format_utils.cpp:709
size_t get_object_blobsize(const t_object &o)
Definition: cryptonote_format_utils.h:189
bool parse_amount(uint64_t &amount, const std::string &str_amount_)
Definition: cryptonote_format_utils.cpp:409
uint64_t get_pruned_transaction_weight(const transaction &tx)
Definition: cryptonote_format_utils.cpp:460
bool get_output_public_key(const cryptonote::tx_out &out, crypto::public_key &output_public_key)
Definition: cryptonote_format_utils.cpp:909
void get_blob_hash(const blobdata_ref &blob, crypto::hash &res)
Definition: cryptonote_format_utils.cpp:1102
bool remove_field_from_tx_extra(std::vector< uint8_t > &tx_extra, const std::type_info &type)
Definition: cryptonote_format_utils.cpp:761
bool check_inputs_types_supported(const transaction &tx)
Definition: cryptonote_format_utils.cpp:840
crypto::hash get_pruned_transaction_hash(const transaction &t, const crypto::hash &pruned_data_hash)
Definition: cryptonote_format_utils.cpp:1316
void get_transaction_prefix_hash(const transaction_prefix &tx, crypto::hash &h, hw::device &hwdev)
Definition: cryptonote_format_utils.cpp:131
bool add_mm_merkle_root_to_tx_extra(std::vector< uint8_t > &tx_extra, const crypto::hash &mm_merkle_root, size_t mm_merkle_tree_depth)
Definition: cryptonote_format_utils.cpp:742
std::string get_unit(unsigned int decimal_point)
Definition: cryptonote_format_utils.cpp:1133
bool parse_and_validate_tx_base_from_blob(const blobdata_ref &tx_blob, transaction &tx)
Definition: cryptonote_format_utils.cpp:235
uint64_t round_money_up(uint64_t amount, unsigned significant_digits)
Definition: cryptonote_format_utils.cpp:1182
bool parse_and_validate_block_from_blob(const blobdata_ref &b_blob, block &b, crypto::hash *block_hash)
Definition: cryptonote_format_utils.cpp:1540
bool t_serializable_object_to_blob(const t_object &to, blobdata &b_blob)
Definition: cryptonote_format_utils.h:164
void set_tx_out(const uint64_t amount, const crypto::public_key &output_public_key, const bool use_view_tags, const crypto::view_tag &view_tag, tx_out &out)
Definition: cryptonote_format_utils.cpp:942
bool generate_key_image_helper_precomp(const account_keys &ack, const crypto::public_key &out_key, const crypto::key_derivation &recv_derivation, size_t real_output_index, const subaddress_index &received_index, keypair &in_ephemeral, crypto::key_image &ki, hw::device &hwdev)
Definition: cryptonote_format_utils.cpp:320
boost::string_ref blobdata_ref
Definition: blobdatatype.h:40
uint64_t get_outs_money_amount(const transaction &tx)
Definition: cryptonote_format_utils.cpp:901
uint64_t get_transaction_weight(const transaction &tx, size_t blob_size)
Definition: cryptonote_format_utils.cpp:444
bool check_output_types(const transaction &tx, const uint8_t hf_version)
Definition: cryptonote_format_utils.cpp:960
boost::optional< crypto::view_tag > get_output_view_tag(const cryptonote::tx_out &out)
Definition: cryptonote_format_utils.cpp:926
bool add_extra_nonce_to_tx_extra(std::vector< uint8_t > &tx_extra, const blobdata &extra_nonce)
Definition: cryptonote_format_utils.cpp:726
TODO: (mj-xmr) This will be reduced in an another PR.
Definition: byte_slice.h:40
bool serialize(Archive &ar, T &v)
Definition: serialization.h:373
unsigned char uint8_t
Definition: stdint.h:124
unsigned __int64 uint64_t
Definition: stdint.h:136
Definition: binary_archive.h:89
Definition: argon2_core.h:74
Definition: account.h:41
Definition: cryptonote_basic.h:475
Definition: cryptonote_basic.h:539
Definition: subaddress_index.h:39
Definition: cryptonote_format_utils.h:97
subaddress_index index
Definition: cryptonote_format_utils.h:98
crypto::key_derivation derivation
Definition: cryptonote_format_utils.h:99
Definition: cryptonote_basic.h:158
a archive using the JSON standard
Definition: json_archive.h:116
Definition: chaingen.h:294
cryptonote::transaction tx
Definition: transaction.cpp:40
std::vector< cryptonote::tx_extra_field > tx_extra_fields
Definition: tx-extra.cpp:38
#define T(x)