Electroneum
simplewallet.h
Go to the documentation of this file.
1 // Copyrights(c) 2017-2020, The Electroneum Project
2 // Copyrights(c) 2014-2019, The Monero Project
3 //
4 // All rights reserved.
5 //
6 // Redistribution and use in source and binary forms, with or without modification, are
7 // permitted provided that the following conditions are met:
8 //
9 // 1. Redistributions of source code must retain the above copyright notice, this list of
10 // conditions and the following disclaimer.
11 //
12 // 2. Redistributions in binary form must reproduce the above copyright notice, this list
13 // of conditions and the following disclaimer in the documentation and/or other
14 // materials provided with the distribution.
15 //
16 // 3. Neither the name of the copyright holder nor the names of its contributors may be
17 // used to endorse or promote products derived from this software without specific
18 // prior written permission.
19 //
20 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
21 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
23 // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27 // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
28 // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
31 
37 #pragma once
38 
39 #include <memory>
40 
41 #include <boost/optional/optional.hpp>
42 #include <boost/program_options/variables_map.hpp>
43 
46 #include "wallet/wallet2.h"
47 #include "console_handler.h"
48 #include "wipeable_string.h"
49 #include "common/i18n.h"
50 #include "common/password.h"
51 #include "crypto/crypto.h" // for definition of crypto::secret_key
52 
53 #undef ELECTRONEUM_DEFAULT_LOG_CATEGORY
54 #define ELECTRONEUM_DEFAULT_LOG_CATEGORY "wallet.simplewallet"
55 // Hardcode Electroneum's donation address (see #1447)
56 constexpr const char ETN_DONATION_ADDR[] = "etnjwQwwEY65dhSMfKto64GgY7j7q2RUSZP1r8rXZ615J4egUC596R4crvZ5woWWTWBUztnKMUudzQ22E37LHiV48XWeJDFkkY";
57 
62 namespace cryptonote
63 {
68  {
69  public:
70  static const char *tr(const char *str) { return i18n_translate(str, "cryptonote::simple_wallet"); }
71 
72  public:
73  typedef std::vector<std::string> command_type;
74 
75  simple_wallet();
76  bool init(const boost::program_options::variables_map& vm);
77  bool deinit();
78  bool run();
79  void stop();
80  void interrupt();
81 
82  //wallet *create_wallet();
83  bool process_command(const std::vector<std::string> &args);
84  std::string get_commands_str();
85  std::string get_command_usage(const std::vector<std::string> &args);
86  private:
87 
89 
90  bool handle_command_line(const boost::program_options::variables_map& vm);
91 
93 
94  void wallet_idle_thread();
95 
97  boost::optional<tools::password_container> get_and_verify_password() const;
98 
99  boost::optional<epee::wipeable_string> new_wallet(const boost::program_options::variables_map& vm, const crypto::secret_key& recovery_key,
100  bool recover, bool two_random, const std::string &old_language);
101  boost::optional<epee::wipeable_string> new_wallet(const boost::program_options::variables_map& vm, const cryptonote::account_public_address& address,
102  const boost::optional<crypto::secret_key>& spendkey, const crypto::secret_key& viewkey);
103  boost::optional<epee::wipeable_string> new_wallet(const boost::program_options::variables_map& vm,
104  const epee::wipeable_string &multisig_keys, const std::string &old_language);
105  boost::optional<epee::wipeable_string> new_wallet(const boost::program_options::variables_map& vm);
106  boost::optional<epee::wipeable_string> open_wallet(const boost::program_options::variables_map& vm);
107  bool close_wallet();
108 
109  bool viewkey(const std::vector<std::string> &args = std::vector<std::string>());
110  bool spendkey(const std::vector<std::string> &args = std::vector<std::string>());
111  bool seed(const std::vector<std::string> &args = std::vector<std::string>());
112  bool encrypted_seed(const std::vector<std::string> &args = std::vector<std::string>());
113 
123  bool seed_set_language(const std::vector<std::string> &args = std::vector<std::string>());
124  bool set_always_confirm_transfers(const std::vector<std::string> &args = std::vector<std::string>());
125  bool set_print_ring_members(const std::vector<std::string> &args = std::vector<std::string>());
126  bool set_store_tx_info(const std::vector<std::string> &args = std::vector<std::string>());
127  bool set_auto_refresh(const std::vector<std::string> &args = std::vector<std::string>());
128  bool set_refresh_type(const std::vector<std::string> &args = std::vector<std::string>());
129  bool set_confirm_missing_payment_id(const std::vector<std::string> &args = std::vector<std::string>());
130  bool set_ask_password(const std::vector<std::string> &args = std::vector<std::string>());
131  bool set_unit(const std::vector<std::string> &args = std::vector<std::string>());
132  bool set_min_output_count(const std::vector<std::string> &args = std::vector<std::string>());
133  bool set_min_output_value(const std::vector<std::string> &args = std::vector<std::string>());
134  bool set_merge_destinations(const std::vector<std::string> &args = std::vector<std::string>());
135  bool set_confirm_backlog(const std::vector<std::string> &args = std::vector<std::string>());
136  bool set_confirm_backlog_threshold(const std::vector<std::string> &args = std::vector<std::string>());
137  bool set_confirm_export_overwrite(const std::vector<std::string> &args = std::vector<std::string>());
138  bool set_refresh_from_block_height(const std::vector<std::string> &args = std::vector<std::string>());
139  bool set_auto_low_priority(const std::vector<std::string> &args = std::vector<std::string>());
140  bool set_segregate_pre_fork_outputs(const std::vector<std::string> &args = std::vector<std::string>());
141  bool set_key_reuse_mitigation2(const std::vector<std::string> &args = std::vector<std::string>());
142  bool set_subaddress_lookahead(const std::vector<std::string> &args = std::vector<std::string>());
143  bool set_segregation_height(const std::vector<std::string> &args = std::vector<std::string>());
144  bool set_ignore_fractional_outputs(const std::vector<std::string> &args = std::vector<std::string>());
145  bool set_track_uses(const std::vector<std::string> &args = std::vector<std::string>());
146  bool set_setup_background_mining(const std::vector<std::string> &args = std::vector<std::string>());
147  bool set_device_name(const std::vector<std::string> &args = std::vector<std::string>());
148  bool help(const std::vector<std::string> &args = std::vector<std::string>());
149  bool start_mining(const std::vector<std::string> &args);
150  bool stop_mining(const std::vector<std::string> &args);
151  bool set_daemon(const std::vector<std::string> &args);
152  bool save_bc(const std::vector<std::string> &args);
153  bool refresh(const std::vector<std::string> &args);
154  bool show_balance_unlocked(bool detailed = false);
155  bool show_balance(const std::vector<std::string> &args = std::vector<std::string>());
156  bool show_incoming_transfers(const std::vector<std::string> &args);
157  bool show_payments(const std::vector<std::string> &args);
158  bool show_blockchain_height(const std::vector<std::string> &args);
159  bool transfer_main(int transfer_type, const std::vector<std::string> &args, bool called_by_mms);
160  bool transfer(const std::vector<std::string> &args);
161  bool locked_transfer(const std::vector<std::string> &args);
162  bool locked_sweep_all(const std::vector<std::string> &args);
163  bool sweep_main(uint64_t below, bool locked, const std::vector<std::string> &args);
164  bool sweep_all(const std::vector<std::string> &args);
165  bool sweep_below(const std::vector<std::string> &args);
166  bool sweep_single(const std::vector<std::string> &args);
167  bool sweep_unmixable(const std::vector<std::string> &args);
168  bool donate(const std::vector<std::string> &args);
169  bool sign_transfer(const std::vector<std::string> &args);
170  bool submit_transfer(const std::vector<std::string> &args);
171  std::vector<std::vector<cryptonote::tx_destination_entry>> split_amounts(
172  std::vector<cryptonote::tx_destination_entry> dsts, size_t num_splits
173  );
174  bool account(const std::vector<std::string> &args = std::vector<std::string>());
175  void print_accounts();
176  void print_accounts(const std::string& tag);
177  bool print_address(const std::vector<std::string> &args = std::vector<std::string>());
178  bool print_integrated_address(const std::vector<std::string> &args = std::vector<std::string>());
179  bool address_book(const std::vector<std::string> &args = std::vector<std::string>());
180  bool save(const std::vector<std::string> &args);
181  bool save_watch_only(const std::vector<std::string> &args);
182  bool set_variable(const std::vector<std::string> &args);
183  bool rescan_spent(const std::vector<std::string> &args);
184  bool set_log(const std::vector<std::string> &args);
185  bool get_tx_key(const std::vector<std::string> &args);
186  bool set_tx_key(const std::vector<std::string> &args);
187  bool check_tx_key(const std::vector<std::string> &args);
188  bool get_tx_proof(const std::vector<std::string> &args);
189  bool check_tx_proof(const std::vector<std::string> &args);
190  bool get_spend_proof(const std::vector<std::string> &args);
191  bool check_spend_proof(const std::vector<std::string> &args);
192  bool get_reserve_proof(const std::vector<std::string> &args);
193  bool check_reserve_proof(const std::vector<std::string> &args);
194  bool show_transfers(const std::vector<std::string> &args);
195  bool export_transfers(const std::vector<std::string> &args);
196  bool unspent_outputs(const std::vector<std::string> &args);
197  bool rescan_blockchain(const std::vector<std::string> &args);
198  bool refresh_main(uint64_t start_height, ResetType reset, bool is_init = false);
199  bool set_tx_note(const std::vector<std::string> &args);
200  bool get_tx_note(const std::vector<std::string> &args);
201  bool set_description(const std::vector<std::string> &args);
202  bool get_description(const std::vector<std::string> &args);
203  bool status(const std::vector<std::string> &args);
204  bool wallet_info(const std::vector<std::string> &args);
205  bool set_default_ring_size(const std::vector<std::string> &args);
206  bool set_default_priority(const std::vector<std::string> &args);
207  bool sign(const std::vector<std::string> &args);
208  bool verify(const std::vector<std::string> &args);
209  bool export_key_images(const std::vector<std::string> &args);
210  bool import_key_images(const std::vector<std::string> &args);
211  bool hw_key_images_sync(const std::vector<std::string> &args);
212  bool hw_reconnect(const std::vector<std::string> &args);
213  bool export_outputs(const std::vector<std::string> &args);
214  bool import_outputs(const std::vector<std::string> &args);
215  bool show_transfer(const std::vector<std::string> &args);
216  bool change_password(const std::vector<std::string>& args);
217  bool payment_id(const std::vector<std::string> &args);
218  bool print_fee_info(const std::vector<std::string> &args);
219  bool prepare_multisig(const std::vector<std::string>& args);
220  bool prepare_multisig_main(const std::vector<std::string>& args, bool called_by_mms);
221  bool make_multisig(const std::vector<std::string>& args);
222  bool make_multisig_main(const std::vector<std::string>& args, bool called_by_mms);
223  bool finalize_multisig(const std::vector<std::string> &args);
224  bool exchange_multisig_keys(const std::vector<std::string> &args);
225  bool exchange_multisig_keys_main(const std::vector<std::string> &args, bool called_by_mms);
226  bool export_multisig(const std::vector<std::string>& args);
227  bool export_multisig_main(const std::vector<std::string>& args, bool called_by_mms);
228  bool import_multisig(const std::vector<std::string>& args);
229  bool import_multisig_main(const std::vector<std::string>& args, bool called_by_mms);
231  bool sign_multisig(const std::vector<std::string>& args);
232  bool sign_multisig_main(const std::vector<std::string>& args, bool called_by_mms);
233  bool submit_multisig(const std::vector<std::string>& args);
234  bool submit_multisig_main(const std::vector<std::string>& args, bool called_by_mms);
235  bool export_raw_multisig(const std::vector<std::string>& args);
236  bool mms(const std::vector<std::string>& args);
237  bool print_ring(const std::vector<std::string>& args);
238  bool set_ring(const std::vector<std::string>& args);
239  bool unset_ring(const std::vector<std::string>& args);
240  bool save_known_rings(const std::vector<std::string>& args);
241  bool blackball(const std::vector<std::string>& args);
242  bool unblackball(const std::vector<std::string>& args);
243  bool blackballed(const std::vector<std::string>& args);
244  bool freeze(const std::vector<std::string>& args);
245  bool thaw(const std::vector<std::string>& args);
246  bool frozen(const std::vector<std::string>& args);
247  bool net_stats(const std::vector<std::string>& args);
248  bool welcome(const std::vector<std::string>& args);
249  bool version(const std::vector<std::string>& args);
250 
251  bool set_account_major_offset(const std::vector<std::string> &args = std::vector<std::string>());
252 
253  bool cold_sign_tx(const std::vector<tools::wallet2::pending_tx>& ptx_vector, tools::wallet2::signed_tx_set &exported_txs, std::vector<cryptonote::address_parse_info> &dsts_info, std::function<bool(const tools::wallet2::signed_tx_set &)> accept_func);
254  uint64_t get_daemon_blockchain_height(std::string& err);
255  bool try_connect_to_daemon(bool silent = false, uint32_t* version = nullptr);
257  bool accept_loaded_tx(const std::function<size_t()> get_num_txes, const std::function<const tools::wallet2::tx_construction_data&(size_t)> &get_tx, const std::string &extra_message = std::string());
260  bool print_ring_members(const std::vector<tools::wallet2::pending_tx>& ptx_vector, std::ostream& ostr);
261  std::string get_prompt() const;
262  bool print_seed(bool encrypted);
263  void key_images_sync_intern();
264  void on_refresh_finished(uint64_t start_height, uint64_t fetched_blocks, bool is_init, bool received_money);
265  std::pair<std::string, std::string> show_outputs_line(const std::vector<uint64_t> &heights, uint64_t blockchain_height, uint64_t highlight_height = std::numeric_limits<uint64_t>::max()) const;
266  bool freeze_thaw(const std::vector<std::string>& args, bool freeze);
267 
269  {
270  std::string type;
271  boost::variant<uint64_t, std::string> block;
272  uint64_t timestamp;
273  std::string direction;
274  bool confirmed;
275  uint64_t amount;
277  std::string payment_id;
278  uint64_t fee;
279  std::vector<std::pair<std::string, uint64_t>> outputs;
280  std::set<uint32_t> index;
281  std::string note;
282  std::string unlocked;
283  };
284  bool get_transfers(std::vector<std::string>& args_, std::vector<transfer_view>& transfers);
285 
290  void print_seed(const epee::wipeable_string &seed);
291 
299  std::string get_mnemonic_language();
300 
305  void commit_or_save(std::vector<tools::wallet2::pending_tx>& ptx_vector, bool do_not_relay);
306 
310  void check_background_mining(const epee::wipeable_string &password);
312  void stop_background_mining();
313 
314  //----------------- i_wallet2_callback ---------------------
315  virtual void on_new_block(uint64_t height, const cryptonote::block& block);
316  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, uint64_t unlock_time);
317  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);
318  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);
319  virtual void on_skip_transaction(uint64_t height, const crypto::hash &txid, const cryptonote::transaction& tx);
320  virtual boost::optional<epee::wipeable_string> on_get_password(const char *reason);
321  virtual void on_device_button_request(uint64_t code);
322  virtual boost::optional<epee::wipeable_string> on_device_pin_request();
323  virtual boost::optional<epee::wipeable_string> on_device_passphrase_request(bool on_device);
324  //----------------------------------------------------------
325 
327 
329  {
330  public:
335  , m_print_time()
336  {
337  }
338 
339  void update(uint64_t height, bool force = false)
340  {
341  auto current_time = std::chrono::system_clock::now();
342  const auto node_update_threshold = std::chrono::seconds(DIFFICULTY_TARGET / 2); // use min of V1/V2
343  if (node_update_threshold < current_time - m_blockchain_height_update_time || m_blockchain_height <= height)
344  {
347  }
348 
349  if (std::chrono::milliseconds(20) < current_time - m_print_time || force)
350  {
351  std::cout << QT_TRANSLATE_NOOP("cryptonote::simple_wallet", "Height ") << height << " / " << m_blockchain_height << '\r' << std::flush;
352  m_print_time = current_time;
353  }
354  }
355 
356  private:
358  {
359  std::string err;
360  uint64_t blockchain_height = m_simple_wallet.get_daemon_blockchain_height(err);
361  if (err.empty())
362  {
363  m_blockchain_height = blockchain_height;
364  m_blockchain_height_update_time = std::chrono::system_clock::now();
365  }
366  else
367  {
368  LOG_ERROR("Failed to get current blockchain height: " << err);
369  }
370  }
371 
372  private:
375  std::chrono::system_clock::time_point m_blockchain_height_update_time;
376  std::chrono::system_clock::time_point m_print_time;
377  };
378 
379  private:
380  std::string m_wallet_file;
381  std::string m_generate_new;
385  std::string m_generate_from_keys;
387  std::string m_generate_from_json;
388  std::string m_mnemonic_language;
389  std::string m_import_path;
391  std::string m_restore_date; // optional - converted to m_restore_height
392 
393  epee::wipeable_string m_electrum_seed; // electrum-style seed parameter
394 
395  crypto::secret_key m_recovery_key; // recovery key (used as random for wallet gen)
396  bool m_restore_deterministic_wallet; // recover flag
397  bool m_restore_multisig_wallet; // recover flag
398  bool m_non_deterministic; // old 2-random generation
400  bool m_restoring; // are we restoring, by whatever method?
401  uint64_t m_restore_height; // optional
405 
406  epee::console_handlers_binder m_cmd_binder;
407 
408  std::unique_ptr<tools::wallet2> m_wallet;
410 
411  std::atomic<bool> m_idle_run;
412  boost::thread m_idle_thread;
413  boost::mutex m_idle_mutex;
414  boost::condition_variable m_idle_cond;
415 
416  std::atomic<bool> m_auto_refresh_enabled;
418  std::atomic<bool> m_in_manual_refresh;
420 
422 
423  // MMS
424  mms::message_store& get_message_store() const { return m_wallet->get_message_store(); };
425  mms::multisig_wallet_state get_multisig_wallet_state() const { return m_wallet->get_multisig_wallet_state(); };
426  bool mms_active() const { return get_message_store().get_active(); };
427  bool choose_mms_processing(const std::vector<mms::processing_data> &data_list, uint32_t &choice);
428  void list_mms_messages(const std::vector<mms::message> &messages);
429  void list_signers(const std::vector<mms::authorized_signer> &signers);
431  void show_message(const mms::message &m);
433  void check_for_messages();
434  bool user_confirms(const std::string &question);
435  bool get_message_from_arg(const std::string &arg, mms::message &m);
436  bool get_number_from_arg(const std::string &arg, uint32_t &number, const uint32_t lower_bound, const uint32_t upper_bound);
437 
438  void mms_init(const std::vector<std::string> &args);
439  void mms_info(const std::vector<std::string> &args);
440  void mms_signer(const std::vector<std::string> &args);
441  void mms_list(const std::vector<std::string> &args);
442  void mms_next(const std::vector<std::string> &args);
443  void mms_sync(const std::vector<std::string> &args);
444  void mms_transfer(const std::vector<std::string> &args);
445  void mms_delete(const std::vector<std::string> &args);
446  void mms_send(const std::vector<std::string> &args);
447  void mms_receive(const std::vector<std::string> &args);
448  void mms_export(const std::vector<std::string> &args);
449  void mms_note(const std::vector<std::string> &args);
450  void mms_show(const std::vector<std::string> &args);
451  void mms_set(const std::vector<std::string> &args);
452  void mms_help(const std::vector<std::string> &args);
453  void mms_send_signer_config(const std::vector<std::string> &args);
454  void mms_start_auto_config(const std::vector<std::string> &args);
455  void mms_stop_auto_config(const std::vector<std::string> &args);
456  void mms_auto_config(const std::vector<std::string> &args);
457  };
458 }
uint64_t height
Definition: blockchain.cpp:91
cryptonote::simple_wallet & m_simple_wallet
Definition: simplewallet.h:373
std::chrono::system_clock::time_point m_print_time
Definition: simplewallet.h:376
uint64_t m_blockchain_height
Definition: simplewallet.h:374
std::chrono::system_clock::time_point m_blockchain_height_update_time
Definition: simplewallet.h:375
refresh_progress_reporter_t(cryptonote::simple_wallet &simple_wallet)
Definition: simplewallet.h:331
void update(uint64_t height, bool force=false)
Definition: simplewallet.h:339
void update_blockchain_height()
Definition: simplewallet.h:357
Manages wallet operations. This is the most abstracted wallet class.
Definition: simplewallet.h:68
bool accept_loaded_tx(const tools::wallet2::multisig_tx_set &txs)
Definition: simplewallet.cpp:1368
uint32_t m_account_major_offset
Definition: simplewallet.h:404
std::string m_generate_new
Definition: simplewallet.h:381
bool m_allow_mismatched_daemon_version
Definition: simplewallet.h:399
bool welcome(const std::vector< std::string > &args)
Definition: simplewallet.cpp:2154
std::string m_generate_from_view_key
Definition: simplewallet.h:383
void ask_send_all_ready_messages()
Definition: simplewallet.cpp:9758
void mms_signer(const std::vector< std::string > &args)
Definition: simplewallet.cpp:9858
bool get_transfers(std::vector< std::string > &args_, std::vector< transfer_view > &transfers)
Definition: simplewallet.cpp:7662
bool donate(const std::vector< std::string > &args)
Definition: simplewallet.cpp:6830
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:9418
std::string m_generate_from_multisig_keys
Definition: simplewallet.h:386
bool transfer(const std::vector< std::string > &args)
Definition: simplewallet.cpp:6129
bool show_payments(const std::vector< std::string > &args)
Definition: simplewallet.cpp:5399
bool user_confirms(const std::string &question)
Definition: simplewallet.cpp:9566
void start_background_mining()
Definition: simplewallet.cpp:4695
bool print_ring_members(const std::vector< tools::wallet2::pending_tx > &ptx_vector, std::ostream &ostr)
Definition: simplewallet.cpp:5550
void mms_note(const std::vector< std::string > &args)
Definition: simplewallet.cpp:10229
void mms_info(const std::vector< std::string > &args)
Definition: simplewallet.cpp:9844
bool export_key_images(const std::vector< std::string > &args)
Definition: simplewallet.cpp:9024
bool start_mining(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4812
bool import_key_images(const std::vector< std::string > &args)
Definition: simplewallet.cpp:9067
bool payment_id(const std::vector< std::string > &args)
Definition: simplewallet.cpp:893
void mms_receive(const std::vector< std::string > &args)
Definition: simplewallet.cpp:10187
bool set_default_priority(const std::vector< std::string > &args)
Definition: simplewallet.cpp:2296
bool account(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:8343
void mms_set(const std::vector< std::string > &args)
Definition: simplewallet.cpp:10290
bool sign(const std::vector< std::string > &args)
Definition: simplewallet.cpp:8947
bool address_book(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:8730
bool handle_command_line(const boost::program_options::variables_map &vm)
Definition: simplewallet.cpp:4151
void add_signer_config_messages()
Definition: simplewallet.cpp:9697
bool print_seed(bool encrypted)
Definition: simplewallet.cpp:745
bool import_multisig(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1279
bool unblackball(const std::vector< std::string > &args)
Definition: simplewallet.cpp:2008
bool sign_multisig(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1374
bool import_outputs(const std::vector< std::string > &args)
Definition: simplewallet.cpp:9215
bool seed_set_language(const std::vector< std::string > &args=std::vector< std::string >())
Sets seed language.
Definition: simplewallet.cpp:815
bool verify(const std::vector< std::string > &args)
Definition: simplewallet.cpp:8986
bool sign_transfer(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7054
bool set_variable(const std::vector< std::string > &args)
Definition: simplewallet.cpp:3239
bool set_track_uses(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2670
bool set_tx_key(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7196
void stop_background_mining()
Definition: simplewallet.cpp:4727
bool set_description(const std::vector< std::string > &args)
Definition: simplewallet.cpp:8862
bool sweep_all(const std::vector< std::string > &args)
Definition: simplewallet.cpp:6809
bool show_transfer(const std::vector< std::string > &args)
Definition: simplewallet.cpp:9252
virtual void on_device_button_request(uint64_t code)
Definition: simplewallet.cpp:5061
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:4275
bool set_print_ring_members(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2212
void mms_init(const std::vector< std::string > &args)
Definition: simplewallet.cpp:9812
bool m_use_english_language_names
Definition: simplewallet.h:403
boost::optional< tools::password_container > get_and_verify_password() const
Definition: simplewallet.cpp:4261
bool locked_transfer(const std::vector< std::string > &args)
Definition: simplewallet.cpp:6135
void stop()
Definition: simplewallet.cpp:8338
bool cold_sign_tx(const std::vector< tools::wallet2::pending_tx > &ptx_vector, tools::wallet2::signed_tx_set &exported_txs, std::vector< cryptonote::address_parse_info > &dsts_info, std::function< bool(const tools::wallet2::signed_tx_set &)> accept_func)
Definition: simplewallet.cpp:2178
bool prepare_multisig(const std::vector< std::string > &args)
Definition: simplewallet.cpp:963
bool choose_mms_processing(const std::vector< mms::processing_data > &data_list, uint32_t &choice)
Definition: simplewallet.cpp:9586
virtual void on_skip_transaction(uint64_t height, const crypto::hash &txid, const cryptonote::transaction &tx)
Definition: simplewallet.cpp:5031
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:5018
bool get_spend_proof(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7460
bool show_balance(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:5262
bool sweep_unmixable(const std::vector< std::string > &args)
Definition: simplewallet.cpp:6147
bool set_confirm_backlog(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2508
bool check_reserve_proof(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7595
virtual void on_new_block(uint64_t height, const cryptonote::block &block)
Definition: simplewallet.cpp:4977
bool set_segregate_pre_fork_outputs(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2599
bool get_tx_note(const std::vector< std::string > &args)
Definition: simplewallet.cpp:8837
bool check_tx_proof(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7382
bool change_password(const std::vector< std::string > &args)
Definition: simplewallet.cpp:865
bool print_integrated_address(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:8680
bool wallet_info(const std::vector< std::string > &args)
Definition: simplewallet.cpp:8921
std::atomic< bool > m_auto_refresh_enabled
Definition: simplewallet.h:416
uint64_t m_restore_height
Definition: simplewallet.h:401
bool set_default_ring_size(const std::vector< std::string > &args)
Definition: simplewallet.cpp:2244
bool set_ask_password(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2403
bool thaw(const std::vector< std::string > &args)
Definition: simplewallet.cpp:2113
bool set_confirm_backlog_threshold(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2521
std::atomic< bool > m_in_manual_refresh
Definition: simplewallet.h:418
std::pair< std::string, std::string > show_outputs_line(const std::vector< uint64_t > &heights, uint64_t blockchain_height, uint64_t highlight_height=std::numeric_limits< uint64_t >::max()) const
Definition: simplewallet.cpp:5523
void mms_list(const std::vector< std::string > &args)
Definition: simplewallet.cpp:9915
void mms_start_auto_config(const std::vector< std::string > &args)
Definition: simplewallet.cpp:10361
bool encrypted_seed(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:810
bool m_restore_deterministic_wallet
Definition: simplewallet.h:396
bool sign_multisig_main(const std::vector< std::string > &args, bool called_by_mms)
Definition: simplewallet.cpp:1380
bool set_ring(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1705
bool sweep_main(uint64_t below, bool locked, const std::vector< std::string > &args)
Definition: simplewallet.cpp:6253
void mms_send(const std::vector< std::string > &args)
Definition: simplewallet.cpp:10165
bool show_incoming_transfers(const std::vector< std::string > &args)
Definition: simplewallet.cpp:5274
bool set_min_output_count(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2459
bool set_setup_background_mining(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2683
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:5013
bool show_transfers(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7914
void mms_delete(const std::vector< std::string > &args)
Definition: simplewallet.cpp:10137
void show_message(const mms::message &m)
Definition: simplewallet.cpp:9712
bool stop_mining(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4871
void interrupt()
Definition: simplewallet.cpp:9406
std::string m_restore_date
Definition: simplewallet.h:391
bool show_balance_unlocked(bool detailed=false)
Definition: simplewallet.cpp:5227
bool mms_active() const
Definition: simplewallet.h:426
ResetType
Definition: simplewallet.h:88
@ ResetSoft
Definition: simplewallet.h:88
@ ResetNone
Definition: simplewallet.h:88
@ ResetHard
Definition: simplewallet.h:88
@ ResetSoftKeepKI
Definition: simplewallet.h:88
std::string get_prompt() const
Definition: simplewallet.cpp:8312
bool mms(const std::vector< std::string > &args)
Definition: simplewallet.cpp:10442
bool set_key_reuse_mitigation2(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2612
void wallet_idle_thread()
Definition: simplewallet.cpp:8275
void mms_help(const std::vector< std::string > &args)
Definition: simplewallet.cpp:10327
boost::condition_variable m_idle_cond
Definition: simplewallet.h:414
std::string get_commands_str()
Definition: simplewallet.cpp:674
crypto::secret_key m_recovery_key
Definition: simplewallet.h:395
bool get_number_from_arg(const std::string &arg, uint32_t &number, const uint32_t lower_bound, const uint32_t upper_bound)
Definition: simplewallet.cpp:9572
bool m_non_deterministic
Definition: simplewallet.h:398
bool set_account_major_offset(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2569
bool import_multisig_main(const std::vector< std::string > &args, bool called_by_mms)
Definition: simplewallet.cpp:1285
epee::wipeable_string m_electrum_seed
Definition: simplewallet.h:393
bool deinit()
Definition: simplewallet.cpp:4143
bool save_known_rings(const std::vector< std::string > &args)
Definition: simplewallet.cpp:2065
bool frozen(const std::vector< std::string > &args)
Definition: simplewallet.cpp:2118
bool locked_sweep_all(const std::vector< std::string > &args)
Definition: simplewallet.cpp:6141
bool check_spend_proof(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7506
bool version(const std::vector< std::string > &args)
Definition: simplewallet.cpp:2172
std::string m_mnemonic_language
Definition: simplewallet.h:388
bool close_wallet()
Definition: simplewallet.cpp:4616
bool export_multisig_main(const std::vector< std::string > &args, bool called_by_mms)
Definition: simplewallet.cpp:1220
std::string m_generate_from_device
Definition: simplewallet.h:382
void mms_auto_config(const std::vector< std::string > &args)
Definition: simplewallet.cpp:10415
std::string m_wallet_file
Definition: simplewallet.h:380
bool freeze_thaw(const std::vector< std::string > &args, bool freeze)
Definition: simplewallet.cpp:2079
std::vector< std::string > command_type
Definition: simplewallet.h:73
bool finalize_multisig(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1096
bool set_segregation_height(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2640
mms::message_store & get_message_store() const
Definition: simplewallet.h:424
bool set_refresh_type(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2371
uint32_t m_current_subaddress_account
Definition: simplewallet.h:419
bool set_auto_low_priority(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2586
refresh_progress_reporter_t m_refresh_progress_reporter
Definition: simplewallet.h:409
bool make_multisig_main(const std::vector< std::string > &args, bool called_by_mms)
Definition: simplewallet.cpp:1014
bool export_raw_multisig(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1576
virtual boost::optional< epee::wipeable_string > on_device_pin_request()
Definition: simplewallet.cpp:5066
bool rescan_spent(const std::vector< std::string > &args)
Definition: simplewallet.cpp:5476
void mms_sync(const std::vector< std::string > &args)
Definition: simplewallet.cpp:10112
bool unspent_outputs(const std::vector< std::string > &args)
Definition: simplewallet.cpp:8056
bool set_log(const std::vector< std::string > &args)
Definition: simplewallet.cpp:3358
virtual boost::optional< epee::wipeable_string > on_get_password(const char *reason)
Definition: simplewallet.cpp:5035
bool submit_multisig(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1489
bool sweep_single(const std::vector< std::string > &args)
Definition: simplewallet.cpp:6576
void check_for_messages()
Definition: simplewallet.cpp:8259
bool blackball(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1919
boost::thread m_idle_thread
Definition: simplewallet.h:412
std::string m_generate_from_spend_key
Definition: simplewallet.h:384
bool check_tx_key(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7294
bool set_unit(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2435
bool print_address(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:8580
std::string get_command_usage(const std::vector< std::string > &args)
Definition: simplewallet.cpp:685
void list_mms_messages(const std::vector< mms::message > &messages)
Definition: simplewallet.cpp:9649
bool help(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2735
void mms_stop_auto_config(const std::vector< std::string > &args)
Definition: simplewallet.cpp:10399
void mms_transfer(const std::vector< std::string > &args)
Definition: simplewallet.cpp:10131
bool unset_ring(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1887
void check_background_mining(const epee::wipeable_string &password)
checks whether background mining is enabled, and asks to configure it if not
Definition: simplewallet.cpp:4755
virtual boost::optional< epee::wipeable_string > on_device_passphrase_request(bool on_device)
Definition: simplewallet.cpp:5077
bool save_bc(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4956
bool m_auto_refresh_refreshing
Definition: simplewallet.h:417
bool print_fee_info(const std::vector< std::string > &args)
Definition: simplewallet.cpp:908
bool spendkey(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:723
static const char * tr(const char *str)
Definition: simplewallet.h:70
bool set_daemon(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4893
bool m_restore_multisig_wallet
Definition: simplewallet.h:397
uint64_t get_daemon_blockchain_height(std::string &err)
Definition: simplewallet.cpp:5453
bool save_watch_only(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4665
bool get_tx_proof(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7254
bool make_multisig(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1008
bool submit_transfer(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7118
bool set_device_name(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2708
bool m_restoring
Definition: simplewallet.h:400
bool init(const boost::program_options::variables_map &vm)
Definition: simplewallet.cpp:3530
bool transfer_main(int transfer_type, const std::vector< std::string > &args, bool called_by_mms)
Definition: simplewallet.cpp:5657
void on_refresh_finished(uint64_t start_height, uint64_t fetched_blocks, bool is_init, bool received_money)
Definition: simplewallet.cpp:5093
simple_wallet()
Definition: simplewallet.cpp:2754
bool status(const std::vector< std::string > &args)
Definition: simplewallet.cpp:8895
bool set_auto_refresh(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2352
bool run()
Definition: simplewallet.cpp:8324
mms::multisig_wallet_state get_multisig_wallet_state() const
Definition: simplewallet.h:425
bool exchange_multisig_keys(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1148
void mms_export(const std::vector< std::string > &args)
Definition: simplewallet.cpp:10204
void key_images_sync_intern()
Definition: simplewallet.cpp:9122
bool refresh_main(uint64_t start_height, ResetType reset, bool is_init=false)
Definition: simplewallet.cpp:5116
bool get_reserve_proof(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7544
void print_accounts()
Definition: simplewallet.cpp:8524
bool seed(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:805
std::atomic< bool > m_idle_run
Definition: simplewallet.h:411
std::unique_ptr< tools::wallet2 > m_wallet
Definition: simplewallet.h:408
bool save(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4649
bool show_blockchain_height(const std::vector< std::string > &args)
Definition: simplewallet.cpp:5462
bool rescan_blockchain(const std::vector< std::string > &args)
Definition: simplewallet.cpp:8194
bool set_tx_note(const std::vector< std::string > &args)
Definition: simplewallet.cpp:8809
bool export_outputs(const std::vector< std::string > &args)
Definition: simplewallet.cpp:9175
boost::optional< epee::wipeable_string > open_wallet(const boost::program_options::variables_map &vm)
Definition: simplewallet.cpp:4513
bool hw_reconnect(const std::vector< std::string > &args)
Definition: simplewallet.cpp:9150
bool try_connect_to_daemon(bool silent=false, uint32_t *version=nullptr)
Definition: simplewallet.cpp:4194
std::string m_subaddress_lookahead
Definition: simplewallet.h:390
bool set_ignore_fractional_outputs(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2657
bool set_store_tx_info(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2225
bool set_merge_destinations(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2495
std::string m_generate_from_keys
Definition: simplewallet.h:385
bool set_always_confirm_transfers(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2199
epee::console_handlers_binder m_cmd_binder
Definition: simplewallet.h:406
bool set_subaddress_lookahead(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2625
bool freeze(const std::vector< std::string > &args)
Definition: simplewallet.cpp:2108
bool set_refresh_from_block_height(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2552
bool m_long_payment_id_support
Definition: simplewallet.h:421
bool set_confirm_missing_payment_id(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2388
std::string m_import_path
Definition: simplewallet.h:389
bool get_message_from_arg(const std::string &arg, mms::message &m)
Definition: simplewallet.cpp:9792
std::string m_generate_from_json
Definition: simplewallet.h:387
bool viewkey(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:706
bool export_transfers(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7967
bool get_description(const std::vector< std::string > &args)
Definition: simplewallet.cpp:8878
void mms_next(const std::vector< std::string > &args)
Definition: simplewallet.cpp:9928
bool set_min_output_value(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2477
bool prepare_multisig_main(const std::vector< std::string > &args, bool called_by_mms)
Definition: simplewallet.cpp:969
bool blackballed(const std::vector< std::string > &args)
Definition: simplewallet.cpp:2035
bool print_ring(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1654
std::string get_mnemonic_language()
Gets the word seed language from the user.
Definition: simplewallet.cpp:4223
bool exchange_multisig_keys_main(const std::vector< std::string > &args, bool called_by_mms)
Definition: simplewallet.cpp:1154
bool m_do_not_relay
Definition: simplewallet.h:402
void list_signers(const std::vector< mms::authorized_signer > &signers)
Definition: simplewallet.cpp:9673
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, uint64_t unlock_time)
Definition: simplewallet.cpp:4983
bool get_tx_key(const std::vector< std::string > &args)
Definition: simplewallet.cpp:7153
void mms_show(const std::vector< std::string > &args)
Definition: simplewallet.cpp:10273
bool submit_multisig_main(const std::vector< std::string > &args, bool called_by_mms)
Definition: simplewallet.cpp:1495
bool process_command(const std::vector< std::string > &args)
Definition: simplewallet.cpp:9401
bool net_stats(const std::vector< std::string > &args)
Definition: simplewallet.cpp:2147
bool set_confirm_export_overwrite(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2539
boost::mutex m_idle_mutex
Definition: simplewallet.h:413
bool hw_key_images_sync(const std::vector< std::string > &args)
Definition: simplewallet.cpp:9104
std::vector< std::vector< cryptonote::tx_destination_entry > > split_amounts(std::vector< cryptonote::tx_destination_entry > dsts, size_t num_splits)
bool export_multisig(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1214
bool sweep_below(const std::vector< std::string > &args)
Definition: simplewallet.cpp:6814
bool refresh(const std::vector< std::string > &args)
Definition: simplewallet.cpp:5211
void mms_send_signer_config(const std::vector< std::string > &args)
Definition: simplewallet.cpp:10343
bool ask_wallet_create_if_needed()
Definition: simplewallet.cpp:3387
Definition: cryptonote_basic.h:205
Definition: message_store.h:203
bool get_active() const
Definition: message_store.h:215
Definition: wallet2.h:118
#define DIFFICULTY_TARGET
Definition: cryptonote_config.h:90
const char * i18n_translate(const char *s, const std::string &context)
Definition: i18n.cpp:322
#define QT_TRANSLATE_NOOP(context, str)
Definition: i18n.h:32
args
Definition: build_protob.py:10
epee::mlocked< tools::scrubbed< ec_scalar > > secret_key
Definition: crypto.h:82
POD_CLASS hash
Definition: hash.h:50
Holds cryptonote related classes and helpers.
Definition: db_bdb.cpp:226
constexpr const char ETN_DONATION_ADDR[]
Definition: simplewallet.h:56
Definition: cryptonote_basic.h:453
Definition: cryptonote_basic.h:410
Definition: simplewallet.h:269
bool confirmed
Definition: simplewallet.h:274
boost::variant< uint64_t, std::string > block
Definition: simplewallet.h:271
crypto::hash hash
Definition: simplewallet.h:276
uint64_t amount
Definition: simplewallet.h:275
std::string type
Definition: simplewallet.h:270
std::string unlocked
Definition: simplewallet.h:282
uint64_t timestamp
Definition: simplewallet.h:272
std::string note
Definition: simplewallet.h:281
std::string payment_id
Definition: simplewallet.h:277
std::vector< std::pair< std::string, uint64_t > > outputs
Definition: simplewallet.h:279
std::set< uint32_t > index
Definition: simplewallet.h:280
uint64_t fee
Definition: simplewallet.h:278
std::string direction
Definition: simplewallet.h:273
Definition: subaddress_index.h:39
Definition: message_store.h:99
Definition: message_store.h:190
Definition: wallet2.h:496
Definition: wallet2.h:489
Definition: wallet2.h:406
Definition: wallet2.h:483