Electroneum
Namespaces | Macros | Functions | Variables
cryptonote_format_utils.cpp File Reference
#include <atomic>
#include <boost/algorithm/string.hpp>
#include "wipeable_string.h"
#include "string_tools.h"
#include "serialization/string.h"
#include "cryptonote_format_utils.h"
#include "cryptonote_config.h"
#include "crypto/crypto.h"
#include "crypto/hash.h"
#include "ringct/rctSigs.h"
Include dependency graph for cryptonote_format_utils.cpp:

Namespaces

 cryptonote
 Holds cryptonote related classes and helpers.
 

Macros

#define ELECTRONEUM_DEFAULT_LOG_CATEGORY   "cn"
 
#define ENCRYPTED_PAYMENT_ID_TAIL   0x8d
 
#define CHECK_AND_ASSERT_THROW_MES_L1(expr, message)   {if(!(expr)) {MWARNING(message); throw std::runtime_error(message);}}
 

Functions

static std::atomic< unsigned int > default_decimal_point (CRYPTONOTE_DISPLAY_DECIMAL_POINT)
 
static std::atomic< uint64_t > tx_hashes_calculated_count (0)
 
static std::atomic< uint64_t > tx_hashes_cached_count (0)
 
static std::atomic< uint64_t > block_hashes_calculated_count (0)
 
static std::atomic< uint64_t > block_hashes_cached_count (0)
 
static unsigned char * cryptonote::operator& (ec_point &point)
 
static const unsigned char * cryptonote::operator& (const ec_point &point)
 
static void cryptonote::add_public_key (crypto::public_key &AB, const crypto::public_key &A, const crypto::public_key &B)
 
void cryptonote::get_transaction_prefix_hash (const transaction_prefix &tx, crypto::hash &h)
 
crypto::hash cryptonote::get_transaction_prefix_hash (const transaction_prefix &tx)
 
bool cryptonote::expand_transaction_1 (transaction &tx, bool base_only)
 
bool cryptonote::parse_and_validate_tx_from_blob (const blobdata &tx_blob, transaction &tx)
 
bool cryptonote::parse_and_validate_tx_base_from_blob (const blobdata &tx_blob, transaction &tx)
 
bool cryptonote::parse_and_validate_tx_prefix_from_blob (const blobdata &tx_blob, transaction_prefix &tx)
 
bool cryptonote::parse_and_validate_tx_from_blob (const blobdata &tx_blob, transaction &tx, crypto::hash &tx_hash)
 
bool cryptonote::parse_and_validate_tx_from_blob (const blobdata &tx_blob, transaction &tx, crypto::hash &tx_hash, crypto::hash &tx_prefix_hash)
 
bool cryptonote::is_v1_tx (const blobdata_ref &tx_blob)
 
bool cryptonote::is_v1_tx (const blobdata &tx_blob)
 
bool cryptonote::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, const uint32_t account_major_offset)
 
bool cryptonote::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, const uint32_t account_major_offset)
 
uint64_t cryptonote::power_integral (uint64_t a, uint64_t b)
 
bool cryptonote::parse_amount (uint64_t &amount, const std::string &str_amount_)
 
uint64_t cryptonote::get_transaction_weight (const transaction &tx, size_t blob_size)
 
uint64_t cryptonote::get_transaction_weight (const transaction &tx)
 
bool cryptonote::get_tx_fee (const transaction &tx, uint64_t &fee)
 
uint64_t cryptonote::get_tx_fee (const transaction &tx)
 
bool cryptonote::parse_tx_extra (const std::vector< uint8_t > &tx_extra, std::vector< tx_extra_field > &tx_extra_fields)
 
template<typename T >
static bool cryptonote::pick (binary_archive< true > &ar, std::vector< tx_extra_field > &fields, uint8_t tag)
 
bool cryptonote::sort_tx_extra (const std::vector< uint8_t > &tx_extra, std::vector< uint8_t > &sorted_tx_extra, bool allow_partial)
 
crypto::public_key cryptonote::get_tx_pub_key_from_extra (const std::vector< uint8_t > &tx_extra, size_t pk_index)
 
crypto::public_key cryptonote::get_tx_pub_key_from_extra (const transaction_prefix &tx_prefix, size_t pk_index)
 
crypto::public_key cryptonote::get_tx_pub_key_from_extra (const transaction &tx, size_t pk_index)
 
bool cryptonote::add_tx_pub_key_to_extra (transaction &tx, const crypto::public_key &tx_pub_key)
 
bool cryptonote::add_tx_pub_key_to_extra (transaction_prefix &tx, const crypto::public_key &tx_pub_key)
 
bool cryptonote::add_tx_pub_key_to_extra (std::vector< uint8_t > &tx_extra, const crypto::public_key &tx_pub_key)
 
std::vector< crypto::public_keycryptonote::get_additional_tx_pub_keys_from_extra (const std::vector< uint8_t > &tx_extra)
 
std::vector< crypto::public_keycryptonote::get_additional_tx_pub_keys_from_extra (const transaction_prefix &tx)
 
bool cryptonote::add_additional_tx_pub_keys_to_extra (std::vector< uint8_t > &tx_extra, const std::vector< crypto::public_key > &additional_pub_keys)
 
bool cryptonote::add_extra_nonce_to_tx_extra (std::vector< uint8_t > &tx_extra, const blobdata &extra_nonce)
 
bool cryptonote::remove_field_from_tx_extra (std::vector< uint8_t > &tx_extra, const std::type_info &type)
 
void cryptonote::set_payment_id_to_tx_extra_nonce (blobdata &extra_nonce, const crypto::hash &payment_id)
 
void cryptonote::set_encrypted_payment_id_to_tx_extra_nonce (blobdata &extra_nonce, const crypto::hash8 &payment_id)
 
bool cryptonote::get_payment_id_from_tx_extra_nonce (const blobdata &extra_nonce, crypto::hash &payment_id)
 
bool cryptonote::get_encrypted_payment_id_from_tx_extra_nonce (const blobdata &extra_nonce, crypto::hash8 &payment_id)
 
bool cryptonote::get_inputs_money_amount (const transaction &tx, uint64_t &money)
 
uint64_t cryptonote::get_block_height (const block &b)
 
bool cryptonote::check_inputs_types_supported (const transaction &tx)
 
bool cryptonote::check_outs_valid (const transaction &tx)
 
bool cryptonote::check_money_overflow (const transaction &tx)
 
bool cryptonote::check_inputs_overflow (const transaction &tx)
 
bool cryptonote::check_outs_overflow (const transaction &tx)
 
uint64_t cryptonote::get_outs_money_amount (const transaction &tx)
 
std::string cryptonote::short_hash_str (const crypto::hash &h)
 
bool cryptonote::is_out_to_acc (const account_keys &acc, const txout_to_key &out_key, const crypto::public_key &tx_pub_key, const std::vector< crypto::public_key > &additional_tx_pub_keys, size_t output_index)
 
boost::optional< subaddress_receive_info > cryptonote::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)
 
bool cryptonote::lookup_acc_outs (const account_keys &acc, const transaction &tx, std::vector< size_t > &outs, uint64_t &money_transfered)
 
bool cryptonote::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_pub_keys, std::vector< size_t > &outs, uint64_t &money_transfered)
 
void cryptonote::get_blob_hash (const epee::span< const char > &blob, crypto::hash &res)
 
void cryptonote::get_blob_hash (const blobdata &blob, crypto::hash &res)
 
void cryptonote::set_default_decimal_point (unsigned int decimal_point)
 
unsigned int cryptonote::get_default_decimal_point ()
 
std::string cryptonote::get_unit (unsigned int decimal_point)
 
std::string cryptonote::print_money (uint64_t amount, unsigned int decimal_point)
 
crypto::hash cryptonote::get_blob_hash (const blobdata &blob)
 
crypto::hash cryptonote::get_blob_hash (const epee::span< const char > &blob)
 
crypto::hash cryptonote::get_transaction_hash (const transaction &t)
 
bool cryptonote::get_transaction_hash (const transaction &t, crypto::hash &res)
 
bool cryptonote::calculate_transaction_prunable_hash (const transaction &t, const cryptonote::blobdata *blob, crypto::hash &res)
 
crypto::hash cryptonote::get_transaction_prunable_hash (const transaction &t, const cryptonote::blobdata *blobdata)
 
crypto::hash cryptonote::get_pruned_transaction_hash (const transaction &t, const crypto::hash &pruned_data_hash)
 
bool cryptonote::calculate_transaction_hash (const transaction &t, crypto::hash &res, size_t *blob_size)
 
bool cryptonote::get_transaction_hash (const transaction &t, crypto::hash &res, size_t *blob_size)
 
bool cryptonote::get_transaction_hash (const transaction &t, crypto::hash &res, size_t &blob_size)
 
blobdata cryptonote::get_block_hashing_blob (const block &b)
 
bool cryptonote::calculate_block_hash (const block &b, crypto::hash &res, const blobdata *blob)
 
bool cryptonote::get_block_hash (const block &b, crypto::hash &res)
 
crypto::hash cryptonote::get_block_hash (const block &b)
 
bool cryptonote::get_block_longhash (const block &b, crypto::hash &res, uint64_t height)
 
std::vector< uint64_t > cryptonote::relative_output_offsets_to_absolute (const std::vector< uint64_t > &off)
 
std::vector< uint64_t > cryptonote::absolute_output_offsets_to_relative (const std::vector< uint64_t > &off)
 
crypto::hash cryptonote::get_block_longhash (const block &b, uint64_t height)
 
bool cryptonote::parse_and_validate_block_from_blob (const blobdata &b_blob, block &b, crypto::hash *block_hash)
 
bool cryptonote::parse_and_validate_block_from_blob (const blobdata &b_blob, block &b)
 
bool cryptonote::parse_and_validate_block_from_blob (const blobdata &b_blob, block &b, crypto::hash &block_hash)
 
blobdata cryptonote::block_to_blob (const block &b)
 
bool cryptonote::block_to_blob (const block &b, blobdata &b_blob)
 
blobdata cryptonote::tx_to_blob (const transaction &tx)
 
bool cryptonote::tx_to_blob (const transaction &tx, blobdata &b_blob)
 
void cryptonote::get_tx_tree_hash (const std::vector< crypto::hash > &tx_hashes, crypto::hash &h)
 
crypto::hash cryptonote::get_tx_tree_hash (const std::vector< crypto::hash > &tx_hashes)
 
crypto::hash cryptonote::get_tx_tree_hash (const block &b)
 
bool cryptonote::is_valid_decomposed_amount (uint64_t amount)
 
void cryptonote::get_hash_stats (uint64_t &tx_hashes_calculated, uint64_t &tx_hashes_cached, uint64_t &block_hashes_calculated, uint64_t &block_hashes_cached)
 
crypto::secret_key cryptonote::encrypt_key (crypto::secret_key key, const epee::wipeable_string &passphrase)
 
crypto::secret_key cryptonote::decrypt_key (crypto::secret_key key, const epee::wipeable_string &passphrase)
 

Variables

static const uint64_t valid_decomposed_outputs []
 

Macro Definition Documentation

◆ CHECK_AND_ASSERT_THROW_MES_L1

#define CHECK_AND_ASSERT_THROW_MES_L1 (   expr,
  message 
)    {if(!(expr)) {MWARNING(message); throw std::runtime_error(message);}}

◆ ELECTRONEUM_DEFAULT_LOG_CATEGORY

#define ELECTRONEUM_DEFAULT_LOG_CATEGORY   "cn"

◆ ENCRYPTED_PAYMENT_ID_TAIL

#define ENCRYPTED_PAYMENT_ID_TAIL   0x8d

Function Documentation

◆ block_hashes_cached_count()

static std::atomic<uint64_t> block_hashes_cached_count ( )
static

◆ block_hashes_calculated_count()

static std::atomic<uint64_t> block_hashes_calculated_count ( )
static

◆ default_decimal_point()

static std::atomic<unsigned int> default_decimal_point ( CRYPTONOTE_DISPLAY_DECIMAL_POINT  )
static

◆ tx_hashes_cached_count()

static std::atomic<uint64_t> tx_hashes_cached_count ( )
static

◆ tx_hashes_calculated_count()

static std::atomic<uint64_t> tx_hashes_calculated_count ( )
static

Variable Documentation

◆ valid_decomposed_outputs

const uint64_t valid_decomposed_outputs[]
static
Initial value:
= {
(uint64_t)1, (uint64_t)2, (uint64_t)3, (uint64_t)4, (uint64_t)5, (uint64_t)6, (uint64_t)7, (uint64_t)8, (uint64_t)9,
(uint64_t)10, (uint64_t)20, (uint64_t)30, (uint64_t)40, (uint64_t)50, (uint64_t)60, (uint64_t)70, (uint64_t)80, (uint64_t)90,
(uint64_t)100, (uint64_t)200, (uint64_t)300, (uint64_t)400, (uint64_t)500, (uint64_t)600, (uint64_t)700, (uint64_t)800, (uint64_t)900,
(uint64_t)1000, (uint64_t)2000, (uint64_t)3000, (uint64_t)4000, (uint64_t)5000, (uint64_t)6000, (uint64_t)7000, (uint64_t)8000, (uint64_t)9000,
(uint64_t)10000, (uint64_t)20000, (uint64_t)30000, (uint64_t)40000, (uint64_t)50000, (uint64_t)60000, (uint64_t)70000, (uint64_t)80000, (uint64_t)90000,
(uint64_t)100000, (uint64_t)200000, (uint64_t)300000, (uint64_t)400000, (uint64_t)500000, (uint64_t)600000, (uint64_t)700000, (uint64_t)800000, (uint64_t)900000,
(uint64_t)1000000, (uint64_t)2000000, (uint64_t)3000000, (uint64_t)4000000, (uint64_t)5000000, (uint64_t)6000000, (uint64_t)7000000, (uint64_t)8000000, (uint64_t)9000000,
(uint64_t)10000000, (uint64_t)20000000, (uint64_t)30000000, (uint64_t)40000000, (uint64_t)50000000, (uint64_t)60000000, (uint64_t)70000000, (uint64_t)80000000, (uint64_t)90000000,
(uint64_t)100000000, (uint64_t)200000000, (uint64_t)300000000, (uint64_t)400000000, (uint64_t)500000000, (uint64_t)600000000, (uint64_t)700000000, (uint64_t)800000000, (uint64_t)900000000,
(uint64_t)1000000000, (uint64_t)2000000000, (uint64_t)3000000000, (uint64_t)4000000000, (uint64_t)5000000000, (uint64_t)6000000000, (uint64_t)7000000000, (uint64_t)8000000000, (uint64_t)9000000000,
(uint64_t)10000000000, (uint64_t)20000000000, (uint64_t)30000000000, (uint64_t)40000000000, (uint64_t)50000000000, (uint64_t)60000000000, (uint64_t)70000000000, (uint64_t)80000000000, (uint64_t)90000000000,
(uint64_t)100000000000, (uint64_t)200000000000, (uint64_t)300000000000, (uint64_t)400000000000, (uint64_t)500000000000, (uint64_t)600000000000, (uint64_t)700000000000, (uint64_t)800000000000, (uint64_t)900000000000,
(uint64_t)1000000000000, (uint64_t)2000000000000, (uint64_t)3000000000000, (uint64_t)4000000000000, (uint64_t)5000000000000, (uint64_t)6000000000000, (uint64_t)7000000000000, (uint64_t)8000000000000, (uint64_t)9000000000000,
(uint64_t)10000000000000, (uint64_t)20000000000000, (uint64_t)30000000000000, (uint64_t)40000000000000, (uint64_t)50000000000000, (uint64_t)60000000000000, (uint64_t)70000000000000, (uint64_t)80000000000000, (uint64_t)90000000000000,
(uint64_t)100000000000000, (uint64_t)200000000000000, (uint64_t)300000000000000, (uint64_t)400000000000000, (uint64_t)500000000000000, (uint64_t)600000000000000, (uint64_t)700000000000000, (uint64_t)800000000000000, (uint64_t)900000000000000,
(uint64_t)1000000000000000, (uint64_t)2000000000000000, (uint64_t)3000000000000000, (uint64_t)4000000000000000, (uint64_t)5000000000000000, (uint64_t)6000000000000000, (uint64_t)7000000000000000, (uint64_t)8000000000000000, (uint64_t)9000000000000000,
(uint64_t)10000000000000000, (uint64_t)20000000000000000, (uint64_t)30000000000000000, (uint64_t)40000000000000000, (uint64_t)50000000000000000, (uint64_t)60000000000000000, (uint64_t)70000000000000000, (uint64_t)80000000000000000, (uint64_t)90000000000000000,
(uint64_t)100000000000000000, (uint64_t)200000000000000000, (uint64_t)300000000000000000, (uint64_t)400000000000000000, (uint64_t)500000000000000000, (uint64_t)600000000000000000, (uint64_t)700000000000000000, (uint64_t)800000000000000000, (uint64_t)900000000000000000,
(uint64_t)1000000000000000000, (uint64_t)2000000000000000000, (uint64_t)3000000000000000000, (uint64_t)4000000000000000000, (uint64_t)5000000000000000000, (uint64_t)6000000000000000000, (uint64_t)7000000000000000000, (uint64_t)8000000000000000000, (uint64_t)9000000000000000000,
(uint64_t)10000000000000000000ull
}