Monero
Classes | Namespaces | Macros | Functions | Variables
wallet2.cpp File Reference
#include <numeric>
#include <random>
#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 "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/dns_utils.h"
#include "ringct/rctSigs.h"
#include "ringdb.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 MONERO_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   "Monero unsigned tx set\004"
 
#define SIGNED_TX_PREFIX   "Monero signed tx set\004"
 
#define MULTISIG_UNSIGNED_TX_PREFIX   "Monero 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   "Monero key image export\002"
 
#define MULTISIG_EXPORT_FILE_MAGIC   "Monero multisig export\001"
 
#define OUTPUT_EXPORT_FILE_MAGIC   "Monero output export\003"
 
#define SEGREGATION_FORK_HEIGHT   1546000
 
#define TESTNET_SEGREGATION_FORK_HEIGHT   1000000
 
#define STAGENET_SEGREGATION_FORK_HEIGHT   1000000
 
#define SEGREGATION_FORK_VICINITY   1500 /* blocks */
 
#define FIRST_REFRESH_GRANULARITY   1024
 

Functions

std::string anonymous_namespace{wallet2.cpp}::get_default_ringdb_path ()
 
void anonymous_namespace{wallet2.cpp}::do_prepare_file_names (const std::string &file_path, std::string &keys_file, std::string &wallet_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::unique_ptr< tools::wallet2anonymous_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)
 
static void anonymous_namespace{wallet2.cpp}::throw_on_rpc_response_error (const boost::optional< std::string > &status, const char *method)
 
std::string anonymous_namespace{wallet2.cpp}::strjoin (const std::vector< size_t > &V, const char *sep)
 
static void 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)
 
crypto::hash8 anonymous_namespace{wallet2.cpp}::get_short_payment_id (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 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"
 
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

◆ FEE_ESTIMATE_GRACE_BLOCKS

#define FEE_ESTIMATE_GRACE_BLOCKS   10

◆ FIRST_REFRESH_GRANULARITY

#define FIRST_REFRESH_GRANULARITY   1024

◆ KEY_IMAGE_EXPORT_FILE_MAGIC

#define KEY_IMAGE_EXPORT_FILE_MAGIC   "Monero key image export\002"

◆ MONERO_DEFAULT_LOG_CATEGORY

#define MONERO_DEFAULT_LOG_CATEGORY   "wallet.wallet2"

◆ MULTISIG_EXPORT_FILE_MAGIC

#define MULTISIG_EXPORT_FILE_MAGIC   "Monero multisig export\001"

◆ MULTISIG_UNSIGNED_TX_PREFIX

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

◆ OUTPUT_EXPORT_FILE_MAGIC

#define OUTPUT_EXPORT_FILE_MAGIC   "Monero 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   1546000

◆ SEGREGATION_FORK_VICINITY

#define SEGREGATION_FORK_VICINITY   1500 /* blocks */

◆ SIGNED_TX_PREFIX

#define SIGNED_TX_PREFIX   "Monero signed tx set\004"

◆ STAGENET_SEGREGATION_FORK_HEIGHT

#define STAGENET_SEGREGATION_FORK_HEIGHT   1000000

◆ 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   1000000

◆ TX_WEIGHT_TARGET

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

◆ UNSIGNED_TX_PREFIX

#define UNSIGNED_TX_PREFIX   "Monero unsigned tx set\004"

Variable Documentation

◆ MULTISIG_SIGNATURE_MAGIC

const std::string MULTISIG_SIGNATURE_MAGIC = "SigMultisigPkV1"
static