40 #include <boost/optional/optional.hpp> 41 #include <boost/program_options/variables_map.hpp> 46 #include "console_handler.h" 47 #include "wipeable_string.h" 52 #undef MONERO_DEFAULT_LOG_CATEGORY 53 #define MONERO_DEFAULT_LOG_CATEGORY "wallet.simplewallet" 55 constexpr
const char MONERO_DONATION_ADDR[] =
"44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A";
69 static const char *
tr(
const char *str) {
return i18n_translate(str,
"cryptonote::simple_wallet"); }
75 bool init(
const boost::program_options::variables_map& vm);
95 boost::optional<epee::wipeable_string>
new_wallet(
const boost::program_options::variables_map& vm,
const crypto::secret_key& recovery_key,
96 bool recover,
bool two_random,
const std::string &old_language);
99 boost::optional<epee::wipeable_string>
new_wallet(
const boost::program_options::variables_map& vm,
100 const epee::wipeable_string &multisig_keys,
const std::string &old_language);
101 boost::optional<epee::wipeable_string>
new_wallet(
const boost::program_options::variables_map& vm);
102 bool open_wallet(
const boost::program_options::variables_map& vm);
105 bool viewkey(
const std::vector<std::string> &args = std::vector<std::string>());
106 bool spendkey(
const std::vector<std::string> &args = std::vector<std::string>());
107 bool seed(
const std::vector<std::string> &args = std::vector<std::string>());
108 bool encrypted_seed(
const std::vector<std::string> &args = std::vector<std::string>());
119 bool seed_set_language(
const std::vector<std::string> &args = std::vector<std::string>());
122 bool set_store_tx_info(
const std::vector<std::string> &args = std::vector<std::string>());
124 bool set_auto_refresh(
const std::vector<std::string> &args = std::vector<std::string>());
125 bool set_refresh_type(
const std::vector<std::string> &args = std::vector<std::string>());
127 bool set_ask_password(
const std::vector<std::string> &args = std::vector<std::string>());
128 bool set_unit(
const std::vector<std::string> &args = std::vector<std::string>());
132 bool set_confirm_backlog(
const std::vector<std::string> &args = std::vector<std::string>());
142 bool help(
const std::vector<std::string> &args = std::vector<std::string>());
143 bool start_mining(
const std::vector<std::string> &args);
144 bool stop_mining(
const std::vector<std::string> &args);
145 bool set_daemon(
const std::vector<std::string> &args);
146 bool save_bc(
const std::vector<std::string> &args);
147 bool refresh(
const std::vector<std::string> &args);
149 bool show_balance(
const std::vector<std::string> &args = std::vector<std::string>());
153 bool transfer_main(
int transfer_type,
const std::vector<std::string> &args);
154 bool transfer(
const std::vector<std::string> &args);
157 bool sweep_main(uint64_t below,
bool locked,
const std::vector<std::string> &args);
158 bool sweep_all(
const std::vector<std::string> &args);
159 bool sweep_below(
const std::vector<std::string> &args);
160 bool sweep_single(
const std::vector<std::string> &args);
162 bool donate(
const std::vector<std::string> &args);
165 std::vector<std::vector<cryptonote::tx_destination_entry>>
split_amounts(
166 std::vector<cryptonote::tx_destination_entry> dsts,
size_t num_splits
168 bool account(
const std::vector<std::string> &args = std::vector<std::string>());
171 bool print_address(
const std::vector<std::string> &args = std::vector<std::string>());
173 bool address_book(
const std::vector<std::string> &args = std::vector<std::string>());
174 bool save(
const std::vector<std::string> &args);
176 bool set_variable(
const std::vector<std::string> &args);
177 bool rescan_spent(
const std::vector<std::string> &args);
178 bool set_log(
const std::vector<std::string> &args);
179 bool get_tx_key(
const std::vector<std::string> &args);
180 bool set_tx_key(
const std::vector<std::string> &args);
181 bool check_tx_key(
const std::vector<std::string> &args);
182 bool get_tx_proof(
const std::vector<std::string> &args);
191 bool refresh_main(uint64_t start_height,
bool reset =
false,
bool is_init =
false);
192 bool set_tx_note(
const std::vector<std::string> &args);
193 bool get_tx_note(
const std::vector<std::string> &args);
196 bool status(
const std::vector<std::string> &args);
197 bool wallet_info(
const std::vector<std::string> &args);
199 bool sign(
const std::vector<std::string> &args);
200 bool verify(
const std::vector<std::string> &args);
203 bool hw_reconnect(
const std::vector<std::string> &args);
208 bool payment_id(
const std::vector<std::string> &args);
220 bool print_ring(
const std::vector<std::string>& args);
221 bool set_ring(
const std::vector<std::string>& args);
223 bool blackball(
const std::vector<std::string>& args);
224 bool unblackball(
const std::vector<std::string>& args);
225 bool blackballed(
const std::vector<std::string>& args);
226 bool version(
const std::vector<std::string>& args);
234 bool print_ring_members(
const std::vector<tools::wallet2::pending_tx>& ptx_vector, std::ostream& ostr);
257 void commit_or_save(std::vector<tools::wallet2::pending_tx>& ptx_vector,
bool do_not_relay);
265 virtual boost::optional<epee::wipeable_string>
on_get_password(
const char *reason);
283 auto current_time = std::chrono::system_clock::now();
291 if (std::chrono::milliseconds(20) < current_time -
m_print_time || force)
310 LOG_ERROR(
"Failed to get current blockchain height: " << err);
std::vector< std::vector< cryptonote::tx_destination_entry > > split_amounts(std::vector< cryptonote::tx_destination_entry > dsts, size_t num_splits)
bool run()
Definition: simplewallet.cpp:7041
bool show_blockchain_height(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4548
bool sign_transfer(const std::vector< std::string > &args)
Definition: simplewallet.cpp:6016
std::string m_import_path
Definition: simplewallet.h:331
static const char * tr(const char *str)
Definition: simplewallet.h:69
bool show_transfer(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7902
bool show_incoming_transfers(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4382
bool get_tx_proof(const std::vector< std::string > &args)
Definition: simplewallet.cpp:6214
#define QT_TRANSLATE_NOOP(context, str)
Definition: i18n.h:31
bool set_default_priority(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1906
std::string m_generate_from_spend_key
Definition: simplewallet.h:326
bool m_restore_deterministic_wallet
Definition: simplewallet.h:337
bool set_ring(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1467
bool make_multisig(const std::vector< std::string > &args)
Definition: simplewallet.cpp:882
bool ask_wallet_create_if_needed()
Definition: simplewallet.cpp:2771
boost::optional< epee::wipeable_string > new_wallet(const boost::program_options::variables_map &vm, const crypto::secret_key &recovery_key, bool recover, bool two_random, const std::string &old_language)
Definition: simplewallet.cpp:3590
bool check_reserve_proof(const std::vector< std::string > &args)
Definition: simplewallet.cpp:6569
bool set_min_output_value(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2093
bool set_subaddress_lookahead(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2224
std::unique_ptr< tools::wallet2 > m_wallet
Definition: simplewallet.h:348
bool import_multisig(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1118
bool get_description(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7574
bool set_segregation_height(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2239
bool save(const std::vector< std::string > &args)
Definition: simplewallet.cpp:3956
std::string m_generate_from_multisig_keys
Definition: simplewallet.h:328
Definition: cryptonote_basic.h:366
bool m_non_deterministic
Definition: simplewallet.h:339
bool address_book(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:7426
bool start_mining(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4003
bool set_ask_password(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2013
std::string get_command_usage(const std::vector< std::string > &args)
Definition: simplewallet.cpp:569
uint64_t height
Definition: blockchain.cpp:89
bool spendkey(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:607
bool unblackball(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1738
std::string m_generate_new
Definition: simplewallet.h:323
bool set_store_tx_info(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:1841
#define DIFFICULTY_TARGET_V1
Definition: cryptonote_config.h:80
bool export_key_images(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7717
bool set_unit(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2045
std::string m_generate_from_device
Definition: simplewallet.h:324
bool import_outputs(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7865
std::string get_mnemonic_language()
Gets the word seed language from the user.
Definition: simplewallet.cpp:3538
epee::mlocked< tools::scrubbed< ec_scalar > > secret_key
Definition: crypto.h:69
bool m_auto_refresh_refreshing
Definition: simplewallet.h:357
bool set_refresh_from_block_height(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2168
Definition: simplewallet.h:270
bool set_variable(const std::vector< std::string > &args)
Definition: simplewallet.cpp:2637
bool set_confirm_backlog(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2124
bool encrypted_seed(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:693
bool exchange_multisig_keys(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1012
bool wallet_info(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7616
bool process_command(const std::vector< std::string > &args)
Definition: simplewallet.cpp:8051
uint64_t m_restore_height
Definition: simplewallet.h:342
bool locked_transfer(const std::vector< std::string > &args)
Definition: simplewallet.cpp:5156
virtual void on_money_spent(uint64_t height, const crypto::hash &txid, const cryptonote::transaction &in_tx, uint64_t amount, const cryptonote::transaction &spend_tx, const cryptonote::subaddress_index &subaddr_index)
Definition: simplewallet.cpp:4207
uint64_t m_blockchain_height
Definition: simplewallet.h:316
bool save_known_rings(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1795
bool seed_set_language(const std::vector< std::string > &args=std::vector< std::string >())
Sets seed language.
Definition: simplewallet.cpp:698
bool set_print_ring_members(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:1828
bool m_use_english_language_names
Definition: simplewallet.h:344
const char * i18n_translate(const char *s, const std::string &context)
Definition: i18n.cpp:309
bool set_tx_note(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7505
bool open_wallet(const boost::program_options::variables_map &vm)
Definition: simplewallet.cpp:3822
bool donate(const std::vector< std::string > &args)
Definition: simplewallet.cpp:5815
bool accept_loaded_tx(const tools::wallet2::multisig_tx_set &txs)
Definition: simplewallet.cpp:1192
bool set_refresh_type(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:1981
bool sweep_single(const std::vector< std::string > &args)
Definition: simplewallet.cpp:5563
bool set_confirm_missing_payment_id(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:1998
bool stop_mining(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4062
bool set_min_output_count(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2075
Holds cryptonote related classes and helpers.
Definition: db_bdb.cpp:224
bool unspent_outputs(const std::vector< std::string > &args)
Definition: simplewallet.cpp:6850
bool close_wallet()
Definition: simplewallet.cpp:3923
uint64_t get_daemon_blockchain_height(std::string &err)
Definition: simplewallet.cpp:4539
virtual void on_unconfirmed_money_received(uint64_t height, const crypto::hash &txid, const cryptonote::transaction &tx, uint64_t amount, const cryptonote::subaddress_index &subaddr_index)
Definition: simplewallet.cpp:4202
std::chrono::system_clock::time_point m_print_time
Definition: simplewallet.h:318
bool export_raw_multisig(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1339
Manages wallet operations. This is the most abstracted wallet class.
Definition: simplewallet.h:66
bool transfer_main(int transfer_type, const std::vector< std::string > &args)
Definition: simplewallet.cpp:4722
std::string m_wallet_file
Definition: simplewallet.h:322
bool export_outputs(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7826
virtual void on_money_received(uint64_t height, const crypto::hash &txid, const cryptonote::transaction &tx, uint64_t amount, const cryptonote::subaddress_index &subaddr_index)
Definition: simplewallet.cpp:4174
bool hw_reconnect(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7801
bool transfer(const std::vector< std::string > &args)
Definition: simplewallet.cpp:5151
void update(uint64_t height, bool force=false)
Definition: simplewallet.h:281
bool sweep_unmixable(const std::vector< std::string > &args)
Definition: simplewallet.cpp:5167
bool try_connect_to_daemon(bool silent=false, uint32_t *version=nullptr)
Definition: simplewallet.cpp:3509
bool status(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7591
simple_wallet()
Definition: simplewallet.cpp:2282
bool get_spend_proof(const std::vector< std::string > &args)
Definition: simplewallet.cpp:6425
bool run_console_handler()
bool print_ring(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1416
virtual boost::optional< epee::wipeable_string > on_get_password(const char *reason)
Definition: simplewallet.cpp:4224
bool finalize_multisig(const std::vector< std::string > &args)
Definition: simplewallet.cpp:960
boost::thread m_idle_thread
Definition: simplewallet.h:352
boost::condition_variable m_idle_cond
Definition: simplewallet.h:354
bool version(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1809
bool set_key_reuse_mitigation2(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2211
bool help(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2269
void print_accounts()
Definition: simplewallet.cpp:7220
bool set_merge_destinations(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2111
void wallet_idle_thread()
Definition: simplewallet.cpp:7001
bool blackball(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1649
bool seed(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:688
bool set_confirm_backlog_threshold(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2137
constexpr const char MONERO_DONATION_ADDR[]
Definition: simplewallet.h:55
bool rescan_spent(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4562
bool set_segregate_pre_fork_outputs(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2198
bool export_multisig(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1067
Definition: subaddress_index.h:38
bool init(const boost::program_options::variables_map &vm)
Definition: simplewallet.cpp:2892
virtual void on_skip_transaction(uint64_t height, const crypto::hash &txid, const cryptonote::transaction &tx)
Definition: simplewallet.cpp:4220
bool m_restore_multisig_wallet
Definition: simplewallet.h:338
void update_blockchain_height()
Definition: simplewallet.h:299
bool m_restoring
Definition: simplewallet.h:341
bool print_seed(bool encrypted)
Definition: simplewallet.cpp:629
std::string m_subaddress_lookahead
Definition: simplewallet.h:332
refresh_progress_reporter_t m_refresh_progress_reporter
Definition: simplewallet.h:349
bool sweep_main(uint64_t below, bool locked, const std::vector< std::string > &args)
Definition: simplewallet.cpp:5273
bool get_tx_key(const std::vector< std::string > &args)
Definition: simplewallet.cpp:6115
bool check_spend_proof(const std::vector< std::string > &args)
Definition: simplewallet.cpp:6474
bool set_log(const std::vector< std::string > &args)
Definition: simplewallet.cpp:2742
std::string m_generate_from_json
Definition: simplewallet.h:329
bool get_tx_note(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7533
bool show_balance(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:4370
std::atomic< bool > m_in_manual_refresh
Definition: simplewallet.h:358
bool get_reserve_proof(const std::vector< std::string > &args)
Definition: simplewallet.cpp:6515
bool save_bc(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4147
std::atomic< bool > m_auto_refresh_enabled
Definition: simplewallet.h:356
bool sign_multisig(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1198
std::string get_prompt() const
Definition: simplewallet.cpp:7029
bool set_confirm_export_overwrite(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2155
bool show_payments(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4485
Definition: cryptonote_basic.h:400
bool m_do_not_relay
Definition: simplewallet.h:343
bool set_daemon(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4084
bool m_long_payment_id_support
Definition: simplewallet.h:361
std::chrono::system_clock::time_point m_blockchain_height_update_time
Definition: simplewallet.h:317
cryptonote::simple_wallet & m_simple_wallet
Definition: simplewallet.h:315
bool refresh_main(uint64_t start_height, bool reset=false, bool is_init=false)
Definition: simplewallet.cpp:4250
bool verify(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7679
bool blackballed(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1765
bool viewkey(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:590
std::string get_commands_str()
Definition: simplewallet.cpp:558
bool import_key_images(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7759
bool check_tx_proof(const std::vector< std::string > &args)
Definition: simplewallet.cpp:6347
void stop()
Definition: simplewallet.cpp:7055
bool set_auto_low_priority(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2185
bool sweep_all(const std::vector< std::string > &args)
Definition: simplewallet.cpp:5794
boost::optional< tools::password_container > get_and_verify_password() const
Definition: simplewallet.cpp:3576
bool print_ring_members(const std::vector< tools::wallet2::pending_tx > &ptx_vector, std::ostream &ostr)
Definition: simplewallet.cpp:4609
std::string m_generate_from_keys
Definition: simplewallet.h:327
bool rescan_blockchain(const std::vector< std::string > &args)
Definition: simplewallet.cpp:6988
bool save_watch_only(const std::vector< std::string > &args)
Definition: simplewallet.cpp:3972
bool submit_multisig(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1271
bool print_integrated_address(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:7376
bool refresh(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4324
bool set_tx_key(const std::vector< std::string > &args)
Definition: simplewallet.cpp:6156
boost::mutex m_idle_mutex
Definition: simplewallet.h:353
void commit_or_save(std::vector< tools::wallet2::pending_tx > &ptx_vector, bool do_not_relay)
When –do-not-relay option is specified, save the raw tx hex blob to a file instead of calling m_walle...
Definition: simplewallet.cpp:8068
POD_CLASS hash
Definition: hash.h:49
std::string m_mnemonic_language
Definition: simplewallet.h:330
bool change_password(const std::vector< std::string > &args)
Definition: simplewallet.cpp:748
bool sweep_below(const std::vector< std::string > &args)
Definition: simplewallet.cpp:5799
std::vector< std::string > command_type
Definition: simplewallet.h:72
bool account(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:7066
bool submit_transfer(const std::vector< std::string > &args)
Definition: simplewallet.cpp:6080
std::atomic< bool > m_idle_run
Definition: simplewallet.h:351
bool sign(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7642
bool check_tx_key(const std::vector< std::string > &args)
Definition: simplewallet.cpp:6259
bool print_fee_info(const std::vector< std::string > &args)
Definition: simplewallet.cpp:791
bool set_default_ring_size(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:1860
crypto::secret_key m_recovery_key
Definition: simplewallet.h:336
uint32_t m_current_subaddress_account
Definition: simplewallet.h:359
bool set_always_confirm_transfers(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:1815
epee::console_handlers_binder m_cmd_binder
Definition: simplewallet.h:346
std::string m_generate_from_view_key
Definition: simplewallet.h:325
bool payment_id(const std::vector< std::string > &args)
Definition: simplewallet.cpp:776
bool handle_command_line(const boost::program_options::variables_map &vm)
Definition: simplewallet.cpp:3476
bool set_description(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7558
bool deinit()
Definition: simplewallet.cpp:3468
bool show_transfers(const std::vector< std::string > &args)
Definition: simplewallet.cpp:6656
epee::wipeable_string m_electrum_seed
Definition: simplewallet.h:334
bool locked_sweep_all(const std::vector< std::string > &args)
Definition: simplewallet.cpp:5161
Definition: cryptonote_basic.h:182
bool print_address(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:7276
void interrupt()
Definition: simplewallet.cpp:8056
bool m_allow_mismatched_daemon_version
Definition: simplewallet.h:340
bool set_auto_refresh(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:1962
virtual void on_new_block(uint64_t height, const cryptonote::block &block)
Definition: simplewallet.cpp:4168
bool set_ignore_fractional_outputs(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2256
refresh_progress_reporter_t(cryptonote::simple_wallet &simple_wallet)
Definition: simplewallet.h:273
bool prepare_multisig(const std::vector< std::string > &args)
Definition: simplewallet.cpp:849
bool show_balance_unlocked(bool detailed=false)
Definition: simplewallet.cpp:4340