Electroneum
Classes | Namespaces | Macros | Functions | Variables
wallet2.cpp File Reference
#include <numeric>
#include <tuple>
#include <boost/format.hpp>
#include <boost/optional/optional.hpp>
#include <boost/utility/value_init.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/trim.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/asio/ip/address.hpp>
#include <boost/range/adaptor/transformed.hpp>
#include <boost/preprocessor/stringize.hpp>
#include "include_base_utils.h"
#include "cryptonote_config.h"
#include "wallet2.h"
#include "cryptonote_basic/cryptonote_format_utils.h"
#include "rpc/core_rpc_server_commands_defs.h"
#include "misc_language.h"
#include "cryptonote_basic/cryptonote_basic_impl.h"
#include "multisig/multisig.h"
#include "common/boost_serialization_helper.h"
#include "common/command_line.h"
#include "common/threadpool.h"
#include "profile_tools.h"
#include "crypto/crypto.h"
#include "serialization/binary_utils.h"
#include "serialization/string.h"
#include "cryptonote_basic/blobdatatype.h"
#include "mnemonics/electrum-words.h"
#include "common/i18n.h"
#include "common/util.h"
#include "common/apply_permutation.h"
#include "rapidjson/document.h"
#include "rapidjson/writer.h"
#include "rapidjson/stringbuffer.h"
#include "common/json_util.h"
#include "memwipe.h"
#include "common/base58.h"
#include "common/combinator.h"
#include "common/dns_utils.h"
#include "common/notify.h"
#include "common/perf_timer.h"
#include "ringct/rctSigs.h"
#include "ringdb.h"
#include "device/device_cold.hpp"
#include "device_trezor/device_trezor.hpp"
#include "net/socks_connect.h"
#include "crypto/keccak.h"
#include "crypto/crypto-ops.h"
Include dependency graph for wallet2.cpp:

Classes

struct  anonymous_namespace{wallet2.cpp}::options
 

Namespaces

 anonymous_namespace{wallet2.cpp}
 
 tools
 Various Tools.
 
 tools::anonymous_namespace{wallet2.cpp}
 

Macros

#define ELECTRONEUM_DEFAULT_LOG_CATEGORY   "wallet.wallet2"
 
#define APPROXIMATE_INPUT_BYTES   80
 
#define TX_WEIGHT_TARGET(bytes)   (bytes*2/3)
 
#define CHACHA8_KEY_TAIL   0x8c
 
#define CACHE_KEY_TAIL   0x8d
 
#define UNSIGNED_TX_PREFIX   "Electroneum unsigned tx set\003"
 
#define SIGNED_TX_PREFIX   "Electroneum signed tx set\003"
 
#define MULTISIG_UNSIGNED_TX_PREFIX   "Electroneum multisig unsigned tx set\001"
 
#define RECENT_OUTPUT_RATIO   (0.5)
 
#define RECENT_OUTPUT_DAYS   (1.8)
 
#define RECENT_OUTPUT_ZONE   ((time_t)(RECENT_OUTPUT_DAYS * 86400))
 
#define RECENT_OUTPUT_BLOCKS   (RECENT_OUTPUT_DAYS * 720)
 
#define FEE_ESTIMATE_GRACE_BLOCKS   10
 
#define SECOND_OUTPUT_RELATEDNESS_THRESHOLD   0.0f
 
#define SUBADDRESS_LOOKAHEAD_MAJOR   50
 
#define SUBADDRESS_LOOKAHEAD_MINOR   200
 
#define KEY_IMAGE_EXPORT_FILE_MAGIC   "Electroneum key image export\002"
 
#define MULTISIG_EXPORT_FILE_MAGIC   "Electroneum multisig export\001"
 
#define SEGREGATION_FORK_HEIGHT   99999999
 
#define TESTNET_SEGREGATION_FORK_HEIGHT   99999999
 
#define STAGENET_SEGREGATION_FORK_HEIGHT   99999999
 
#define SEGREGATION_FORK_VICINITY   1500 /* blocks */
 
#define FIRST_REFRESH_GRANULARITY   1024
 
#define GAMMA_SHAPE   19.28
 
#define GAMMA_SCALE   (1/1.61)
 
#define DEFAULT_MIN_OUTPUT_COUNT   5
 
#define DEFAULT_MIN_OUTPUT_VALUE   (2*COIN)
 
#define OUTPUT_EXPORT_FILE_MAGIC   "Electroneum output export\003"
 
#define CMPF(f)   if (!(td.f == org_td.f)) goto process
 

Functions

std::string anonymous_namespace{wallet2.cpp}::get_default_ringdb_path ()
 
std::string anonymous_namespace{wallet2.cpp}::pack_multisignature_keys (const std::string &prefix, const std::vector< crypto::public_key > &keys, const crypto::secret_key &signer_secret_key)
 
std::vector< crypto::public_keyanonymous_namespace{wallet2.cpp}::secret_keys_to_public_keys (const std::vector< crypto::secret_key > &keys)
 
bool anonymous_namespace{wallet2.cpp}::keys_intersect (const std::unordered_set< crypto::public_key > &s1, const std::unordered_set< crypto::public_key > &s2)
 
void anonymous_namespace{wallet2.cpp}::add_reason (std::string &reasons, const char *reason)
 
std::string anonymous_namespace{wallet2.cpp}::get_text_reason (const cryptonote::COMMAND_RPC_SEND_RAW_TX::response &res)
 
void anonymous_namespace{wallet2.cpp}::do_prepare_file_names (const std::string &file_path, std::string &keys_file, std::string &wallet_file, std::string &mms_file)
 
uint64_t anonymous_namespace{wallet2.cpp}::calculate_fee (uint64_t fee_per_kb, size_t bytes, uint64_t fee_multiplier)
 
uint64_t anonymous_namespace{wallet2.cpp}::calculate_fee_from_weight (uint64_t base_fee, uint64_t weight, uint64_t fee_multiplier, uint64_t fee_quantization_mask)
 
std::string anonymous_namespace{wallet2.cpp}::get_weight_string (size_t weight)
 
std::string anonymous_namespace{wallet2.cpp}::get_weight_string (const cryptonote::transaction &tx, size_t blob_size)
 
std::unique_ptr< tools::wallet2anonymous_namespace{wallet2.cpp}::make_basic (const boost::program_options::variables_map &vm, bool unattended, const options &opts, const std::function< boost::optional< tools::password_container >(const char *, bool)> &password_prompter)
 
boost::optional< tools::password_containeranonymous_namespace{wallet2.cpp}::get_password (const boost::program_options::variables_map &vm, const options &opts, const std::function< boost::optional< tools::password_container >(const char *, bool)> &password_prompter, const bool verify)
 
std::pair< std::unique_ptr< tools::wallet2 >, tools::password_containeranonymous_namespace{wallet2.cpp}::generate_from_json (const std::string &json_file, const boost::program_options::variables_map &vm, bool unattended, const options &opts, const std::function< boost::optional< tools::password_container >(const char *, bool)> &password_prompter)
 
std::string anonymous_namespace{wallet2.cpp}::strjoin (const std::vector< size_t > &V, const char *sep)
 
static bool anonymous_namespace{wallet2.cpp}::emplace_or_replace (std::unordered_multimap< crypto::hash, tools::wallet2::pool_payment_details > &container, const crypto::hash &key, const tools::wallet2::pool_payment_details &pd)
 
void anonymous_namespace{wallet2.cpp}::drop_from_short_history (std::list< crypto::hash > &short_chain_history, size_t N)
 
size_t anonymous_namespace{wallet2.cpp}::estimate_rct_tx_size (int n_inputs, int mixin, int n_outputs, size_t extra_size, bool bulletproof)
 
size_t anonymous_namespace{wallet2.cpp}::estimate_tx_size (bool use_rct, int n_inputs, int mixin, int n_outputs, size_t extra_size, bool bulletproof)
 
uint64_t anonymous_namespace{wallet2.cpp}::estimate_tx_weight (bool use_rct, int n_inputs, int mixin, int n_outputs, size_t extra_size, bool bulletproof)
 
uint8_t anonymous_namespace{wallet2.cpp}::get_bulletproof_fork ()
 
uint64_t anonymous_namespace{wallet2.cpp}::estimate_fee (bool use_per_byte_fee, bool use_rct, int n_inputs, int mixin, int n_outputs, size_t extra_size, bool bulletproof, uint64_t base_fee, uint64_t fee_multiplier, uint64_t fee_quantization_mask)
 
uint64_t anonymous_namespace{wallet2.cpp}::calculate_fee (bool use_per_byte_fee, const cryptonote::transaction &tx, size_t blob_size, uint64_t base_fee, uint64_t fee_multiplier, uint64_t fee_quantization_mask)
 
bool anonymous_namespace{wallet2.cpp}::get_short_payment_id (crypto::hash8 &payment_id8, const tools::wallet2::pending_tx &ptx, hw::device &hwdev)
 
tools::wallet2::tx_construction_data anonymous_namespace{wallet2.cpp}::get_construction_data_with_decrypted_short_payment_id (const tools::wallet2::pending_tx &ptx, hw::device &hwdev)
 
uint32_t anonymous_namespace{wallet2.cpp}::get_subaddress_clamped_sum (uint32_t idx, uint32_t extra)
 
static void anonymous_namespace{wallet2.cpp}::setup_shim (hw::wallet_shim *shim, tools::wallet2 *wallet)
 
bool anonymous_namespace{wallet2.cpp}::get_pruned_tx (const cryptonote::COMMAND_RPC_GET_TRANSACTIONS::entry &entry, cryptonote::transaction &tx, crypto::hash &tx_hash)
 
static uint64_t tools::decodeRct (const rct::rctSig &rv, const crypto::key_derivation &derivation, unsigned int i, rct::key &mask, hw::device &hwdev)
 
template<typename T >
T tools::anonymous_namespace{wallet2.cpp}::pop_index (std::vector< T > &vec, size_t idx)
 
template<typename T >
T tools::anonymous_namespace{wallet2.cpp}::pop_random_value (std::vector< T > &vec)
 
template<typename T >
T tools::anonymous_namespace{wallet2.cpp}::pop_back (std::vector< T > &vec)
 
template<typename T >
void tools::anonymous_namespace{wallet2.cpp}::pop_if_present (std::vector< T > &vec, T e)
 
static uint32_t tools::get_count_above (const std::vector< wallet2::transfer_details > &transfers, const std::vector< size_t > &indices, uint64_t threshold)
 

Variables

static const std::string MULTISIG_SIGNATURE_MAGIC = "SigMultisigPkV1"
 
static const std::string MULTISIG_EXTRA_INFO_MAGIC = "MultisigxV1"
 
const size_t tools::MAX_SPLIT_ATTEMPTS = 30
 

Macro Definition Documentation

◆ APPROXIMATE_INPUT_BYTES

#define APPROXIMATE_INPUT_BYTES   80

◆ CACHE_KEY_TAIL

#define CACHE_KEY_TAIL   0x8d

◆ CHACHA8_KEY_TAIL

#define CHACHA8_KEY_TAIL   0x8c

◆ CMPF

#define CMPF (   f)    if (!(td.f == org_td.f)) goto process

◆ DEFAULT_MIN_OUTPUT_COUNT

#define DEFAULT_MIN_OUTPUT_COUNT   5

◆ DEFAULT_MIN_OUTPUT_VALUE

#define DEFAULT_MIN_OUTPUT_VALUE   (2*COIN)

◆ ELECTRONEUM_DEFAULT_LOG_CATEGORY

#define ELECTRONEUM_DEFAULT_LOG_CATEGORY   "wallet.wallet2"

◆ FEE_ESTIMATE_GRACE_BLOCKS

#define FEE_ESTIMATE_GRACE_BLOCKS   10

◆ FIRST_REFRESH_GRANULARITY

#define FIRST_REFRESH_GRANULARITY   1024

◆ GAMMA_SCALE

#define GAMMA_SCALE   (1/1.61)

◆ GAMMA_SHAPE

#define GAMMA_SHAPE   19.28

◆ KEY_IMAGE_EXPORT_FILE_MAGIC

#define KEY_IMAGE_EXPORT_FILE_MAGIC   "Electroneum key image export\002"

◆ MULTISIG_EXPORT_FILE_MAGIC

#define MULTISIG_EXPORT_FILE_MAGIC   "Electroneum multisig export\001"

◆ MULTISIG_UNSIGNED_TX_PREFIX

#define MULTISIG_UNSIGNED_TX_PREFIX   "Electroneum multisig unsigned tx set\001"

◆ OUTPUT_EXPORT_FILE_MAGIC

#define OUTPUT_EXPORT_FILE_MAGIC   "Electroneum output export\003"

◆ RECENT_OUTPUT_BLOCKS

#define RECENT_OUTPUT_BLOCKS   (RECENT_OUTPUT_DAYS * 720)

◆ RECENT_OUTPUT_DAYS

#define RECENT_OUTPUT_DAYS   (1.8)

◆ RECENT_OUTPUT_RATIO

#define RECENT_OUTPUT_RATIO   (0.5)

◆ RECENT_OUTPUT_ZONE

#define RECENT_OUTPUT_ZONE   ((time_t)(RECENT_OUTPUT_DAYS * 86400))

◆ SECOND_OUTPUT_RELATEDNESS_THRESHOLD

#define SECOND_OUTPUT_RELATEDNESS_THRESHOLD   0.0f

◆ SEGREGATION_FORK_HEIGHT

#define SEGREGATION_FORK_HEIGHT   99999999

◆ SEGREGATION_FORK_VICINITY

#define SEGREGATION_FORK_VICINITY   1500 /* blocks */

◆ SIGNED_TX_PREFIX

#define SIGNED_TX_PREFIX   "Electroneum signed tx set\003"

◆ STAGENET_SEGREGATION_FORK_HEIGHT

#define STAGENET_SEGREGATION_FORK_HEIGHT   99999999

◆ SUBADDRESS_LOOKAHEAD_MAJOR

#define SUBADDRESS_LOOKAHEAD_MAJOR   50

◆ SUBADDRESS_LOOKAHEAD_MINOR

#define SUBADDRESS_LOOKAHEAD_MINOR   200

◆ TESTNET_SEGREGATION_FORK_HEIGHT

#define TESTNET_SEGREGATION_FORK_HEIGHT   99999999

◆ TX_WEIGHT_TARGET

#define TX_WEIGHT_TARGET (   bytes)    (bytes*2/3)

◆ UNSIGNED_TX_PREFIX

#define UNSIGNED_TX_PREFIX   "Electroneum unsigned tx set\003"

Variable Documentation

◆ MULTISIG_EXTRA_INFO_MAGIC

const std::string MULTISIG_EXTRA_INFO_MAGIC = "MultisigxV1"
static

◆ MULTISIG_SIGNATURE_MAGIC

const std::string MULTISIG_SIGNATURE_MAGIC = "SigMultisigPkV1"
static