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);
219 bool print_ring(
const std::vector<std::string>& args);
220 bool set_ring(
const std::vector<std::string>& args);
222 bool blackball(
const std::vector<std::string>& args);
223 bool unblackball(
const std::vector<std::string>& args);
224 bool blackballed(
const std::vector<std::string>& args);
225 bool version(
const std::vector<std::string>& args);
233 bool print_ring_members(
const std::vector<tools::wallet2::pending_tx>& ptx_vector, std::ostream& ostr);
256 void commit_or_save(std::vector<tools::wallet2::pending_tx>& ptx_vector,
bool do_not_relay);
264 virtual boost::optional<epee::wipeable_string>
on_get_password(
const char *reason);
282 auto current_time = std::chrono::system_clock::now();
290 if (std::chrono::milliseconds(20) < current_time -
m_print_time || force)
309 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:7018
bool show_blockchain_height(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4520
bool sign_transfer(const std::vector< std::string > &args)
Definition: simplewallet.cpp:5993
std::string m_import_path
Definition: simplewallet.h:330
static const char * tr(const char *str)
Definition: simplewallet.h:69
bool show_transfer(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7878
bool show_incoming_transfers(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4354
bool get_tx_proof(const std::vector< std::string > &args)
Definition: simplewallet.cpp:6191
#define QT_TRANSLATE_NOOP(context, str)
Definition: i18n.h:31
bool set_default_priority(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1884
std::string m_generate_from_spend_key
Definition: simplewallet.h:325
bool m_restore_deterministic_wallet
Definition: simplewallet.h:336
bool set_ring(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1445
bool make_multisig(const std::vector< std::string > &args)
Definition: simplewallet.cpp:915
bool ask_wallet_create_if_needed()
Definition: simplewallet.cpp:2743
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:3559
bool check_reserve_proof(const std::vector< std::string > &args)
Definition: simplewallet.cpp:6546
bool set_min_output_value(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2069
bool set_subaddress_lookahead(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2200
std::unique_ptr< tools::wallet2 > m_wallet
Definition: simplewallet.h:347
bool import_multisig(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1096
bool get_description(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7550
bool set_segregation_height(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2215
bool save(const std::vector< std::string > &args)
Definition: simplewallet.cpp:3925
std::string m_generate_from_multisig_keys
Definition: simplewallet.h:327
Definition: cryptonote_basic.h:366
bool m_non_deterministic
Definition: simplewallet.h:338
bool address_book(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:7403
bool start_mining(const std::vector< std::string > &args)
Definition: simplewallet.cpp:3972
bool set_ask_password(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:1989
std::string get_command_usage(const std::vector< std::string > &args)
Definition: simplewallet.cpp:604
uint64_t height
Definition: blockchain.cpp:88
bool spendkey(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:642
bool unblackball(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1716
std::string m_generate_new
Definition: simplewallet.h:322
bool set_store_tx_info(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:1819
#define DIFFICULTY_TARGET_V1
Definition: cryptonote_config.h:78
bool export_key_images(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7693
bool set_unit(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2021
std::string m_generate_from_device
Definition: simplewallet.h:323
bool import_outputs(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7841
std::string get_mnemonic_language()
Gets the word seed language from the user.
Definition: simplewallet.cpp:3507
epee::mlocked< tools::scrubbed< ec_scalar > > secret_key
Definition: crypto.h:69
bool m_auto_refresh_refreshing
Definition: simplewallet.h:356
bool set_refresh_from_block_height(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2144
Definition: simplewallet.h:269
bool set_variable(const std::vector< std::string > &args)
Definition: simplewallet.cpp:2609
bool set_confirm_backlog(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2100
bool encrypted_seed(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:728
bool wallet_info(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7592
bool process_command(const std::vector< std::string > &args)
Definition: simplewallet.cpp:8027
uint64_t m_restore_height
Definition: simplewallet.h:341
bool locked_transfer(const std::vector< std::string > &args)
Definition: simplewallet.cpp:5135
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:4179
uint64_t m_blockchain_height
Definition: simplewallet.h:315
bool save_known_rings(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1773
bool seed_set_language(const std::vector< std::string > &args=std::vector< std::string >())
Sets seed language.
Definition: simplewallet.cpp:733
bool set_print_ring_members(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:1806
bool m_use_english_language_names
Definition: simplewallet.h:343
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:7481
bool open_wallet(const boost::program_options::variables_map &vm)
Definition: simplewallet.cpp:3791
bool donate(const std::vector< std::string > &args)
Definition: simplewallet.cpp:5807
bool accept_loaded_tx(const tools::wallet2::multisig_tx_set &txs)
Definition: simplewallet.cpp:1170
bool set_refresh_type(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:1959
bool sweep_single(const std::vector< std::string > &args)
Definition: simplewallet.cpp:5552
bool set_confirm_missing_payment_id(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:1976
bool stop_mining(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4031
bool set_min_output_count(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2051
Holds cryptonote related classes and helpers.
Definition: db_bdb.cpp:224
bool unspent_outputs(const std::vector< std::string > &args)
Definition: simplewallet.cpp:6827
bool close_wallet()
Definition: simplewallet.cpp:3892
uint64_t get_daemon_blockchain_height(std::string &err)
Definition: simplewallet.cpp:4511
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:4174
std::chrono::system_clock::time_point m_print_time
Definition: simplewallet.h:317
bool export_raw_multisig(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1317
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:4694
std::string m_wallet_file
Definition: simplewallet.h:321
bool export_outputs(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7802
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:4143
bool hw_reconnect(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7777
bool transfer(const std::vector< std::string > &args)
Definition: simplewallet.cpp:5130
void update(uint64_t height, bool force=false)
Definition: simplewallet.h:280
bool sweep_unmixable(const std::vector< std::string > &args)
Definition: simplewallet.cpp:5146
bool try_connect_to_daemon(bool silent=false, uint32_t *version=nullptr)
Definition: simplewallet.cpp:3478
bool status(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7567
simple_wallet()
Definition: simplewallet.cpp:2258
bool get_spend_proof(const std::vector< std::string > &args)
Definition: simplewallet.cpp:6402
bool run_console_handler()
bool print_ring(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1394
virtual boost::optional< epee::wipeable_string > on_get_password(const char *reason)
Definition: simplewallet.cpp:4196
bool finalize_multisig(const std::vector< std::string > &args)
Definition: simplewallet.cpp:993
boost::thread m_idle_thread
Definition: simplewallet.h:351
boost::condition_variable m_idle_cond
Definition: simplewallet.h:353
bool version(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1787
bool set_key_reuse_mitigation2(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2187
bool help(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2245
void print_accounts()
Definition: simplewallet.cpp:7197
bool set_merge_destinations(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2087
void wallet_idle_thread()
Definition: simplewallet.cpp:6978
bool blackball(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1627
bool seed(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:723
bool set_confirm_backlog_threshold(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2113
constexpr const char MONERO_DONATION_ADDR[]
Definition: simplewallet.h:55
bool rescan_spent(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4534
bool set_segregate_pre_fork_outputs(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2174
bool export_multisig(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1045
Definition: subaddress_index.h:38
bool init(const boost::program_options::variables_map &vm)
Definition: simplewallet.cpp:2864
virtual void on_skip_transaction(uint64_t height, const crypto::hash &txid, const cryptonote::transaction &tx)
Definition: simplewallet.cpp:4192
bool m_restore_multisig_wallet
Definition: simplewallet.h:337
void update_blockchain_height()
Definition: simplewallet.h:298
bool m_restoring
Definition: simplewallet.h:340
bool print_seed(bool encrypted)
Definition: simplewallet.cpp:664
std::string m_subaddress_lookahead
Definition: simplewallet.h:331
refresh_progress_reporter_t m_refresh_progress_reporter
Definition: simplewallet.h:348
bool sweep_main(uint64_t below, bool locked, const std::vector< std::string > &args)
Definition: simplewallet.cpp:5252
bool get_tx_key(const std::vector< std::string > &args)
Definition: simplewallet.cpp:6092
bool check_spend_proof(const std::vector< std::string > &args)
Definition: simplewallet.cpp:6451
bool set_log(const std::vector< std::string > &args)
Definition: simplewallet.cpp:2714
std::string m_generate_from_json
Definition: simplewallet.h:328
bool get_tx_note(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7509
bool show_balance(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:4342
std::atomic< bool > m_in_manual_refresh
Definition: simplewallet.h:357
bool get_reserve_proof(const std::vector< std::string > &args)
Definition: simplewallet.cpp:6492
bool save_bc(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4116
std::atomic< bool > m_auto_refresh_enabled
Definition: simplewallet.h:355
bool sign_multisig(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1176
std::string get_prompt() const
Definition: simplewallet.cpp:7006
bool set_confirm_export_overwrite(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2131
bool show_payments(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4457
Definition: cryptonote_basic.h:400
bool m_do_not_relay
Definition: simplewallet.h:342
bool set_daemon(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4053
std::chrono::system_clock::time_point m_blockchain_height_update_time
Definition: simplewallet.h:316
cryptonote::simple_wallet & m_simple_wallet
Definition: simplewallet.h:314
bool refresh_main(uint64_t start_height, bool reset=false, bool is_init=false)
Definition: simplewallet.cpp:4222
bool verify(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7655
bool blackballed(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1743
bool viewkey(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:625
std::string get_commands_str()
Definition: simplewallet.cpp:593
bool import_key_images(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7735
bool check_tx_proof(const std::vector< std::string > &args)
Definition: simplewallet.cpp:6324
void stop()
Definition: simplewallet.cpp:7032
bool set_auto_low_priority(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2161
bool sweep_all(const std::vector< std::string > &args)
Definition: simplewallet.cpp:5786
boost::optional< tools::password_container > get_and_verify_password() const
Definition: simplewallet.cpp:3545
bool print_ring_members(const std::vector< tools::wallet2::pending_tx > &ptx_vector, std::ostream &ostr)
Definition: simplewallet.cpp:4581
std::string m_generate_from_keys
Definition: simplewallet.h:326
bool rescan_blockchain(const std::vector< std::string > &args)
Definition: simplewallet.cpp:6965
bool save_watch_only(const std::vector< std::string > &args)
Definition: simplewallet.cpp:3941
bool submit_multisig(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1249
bool print_integrated_address(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:7353
bool refresh(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4296
bool set_tx_key(const std::vector< std::string > &args)
Definition: simplewallet.cpp:6133
boost::mutex m_idle_mutex
Definition: simplewallet.h:352
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_wall...
Definition: simplewallet.cpp:8044
POD_CLASS hash
Definition: hash.h:49
std::string m_mnemonic_language
Definition: simplewallet.h:329
bool change_password(const std::vector< std::string > &args)
Definition: simplewallet.cpp:783
bool sweep_below(const std::vector< std::string > &args)
Definition: simplewallet.cpp:5791
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:7043
bool submit_transfer(const std::vector< std::string > &args)
Definition: simplewallet.cpp:6057
std::atomic< bool > m_idle_run
Definition: simplewallet.h:350
bool sign(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7618
bool check_tx_key(const std::vector< std::string > &args)
Definition: simplewallet.cpp:6236
bool print_fee_info(const std::vector< std::string > &args)
Definition: simplewallet.cpp:824
bool set_default_ring_size(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:1838
crypto::secret_key m_recovery_key
Definition: simplewallet.h:335
uint32_t m_current_subaddress_account
Definition: simplewallet.h:358
bool set_always_confirm_transfers(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:1793
epee::console_handlers_binder m_cmd_binder
Definition: simplewallet.h:345
std::string m_generate_from_view_key
Definition: simplewallet.h:324
bool payment_id(const std::vector< std::string > &args)
Definition: simplewallet.cpp:811
bool handle_command_line(const boost::program_options::variables_map &vm)
Definition: simplewallet.cpp:3446
bool set_description(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7534
bool deinit()
Definition: simplewallet.cpp:3438
bool show_transfers(const std::vector< std::string > &args)
Definition: simplewallet.cpp:6633
epee::wipeable_string m_electrum_seed
Definition: simplewallet.h:333
bool locked_sweep_all(const std::vector< std::string > &args)
Definition: simplewallet.cpp:5140
Definition: cryptonote_basic.h:182
bool print_address(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:7253
void interrupt()
Definition: simplewallet.cpp:8032
bool m_allow_mismatched_daemon_version
Definition: simplewallet.h:339
bool set_auto_refresh(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:1940
virtual void on_new_block(uint64_t height, const cryptonote::block &block)
Definition: simplewallet.cpp:4137
bool set_ignore_fractional_outputs(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2232
refresh_progress_reporter_t(cryptonote::simple_wallet &simple_wallet)
Definition: simplewallet.h:272
bool prepare_multisig(const std::vector< std::string > &args)
Definition: simplewallet.cpp:882
bool show_balance_unlocked(bool detailed=false)
Definition: simplewallet.cpp:4312