Electroneum
wallet2.h
Go to the documentation of this file.
1 // Copyrights(c) 2017-2021, 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 
32 #pragma once
33 
34 #include <memory>
35 
36 #include <boost/program_options/options_description.hpp>
37 #include <boost/program_options/variables_map.hpp>
38 #include <boost/serialization/unordered_map.hpp>
39 
40 #if BOOST_VERSION >= 107400
41  #include <boost/serialization/library_version_type.hpp>
42 #endif
43 #include <boost/serialization/list.hpp>
44 #include <boost/serialization/vector.hpp>
45 #include <boost/serialization/deque.hpp>
46 #include <boost/thread/lock_guard.hpp>
47 #include <atomic>
48 #include <random>
49 #include<utility>
50 
51 #include "include_base_utils.h"
55 #include "net/http_client.h"
61 #include "common/util.h"
62 #include "crypto/chacha.h"
63 #include "crypto/hash.h"
64 #include "ringct/rctTypes.h"
65 #include "ringct/rctOps.h"
67 #include "serialization/pair.h"
68 
69 #include "wallet_errors.h"
70 #include "common/password.h"
71 #include "node_rpc_proxy.h"
72 #include "message_store.h"
73 #include "wallet_light_rpc.h"
74 
75 #undef ELECTRONEUM_DEFAULT_LOG_CATEGORY
76 #define ELECTRONEUM_DEFAULT_LOG_CATEGORY "wallet.wallet2"
77 
78 class Serialization_portability_wallet_Test;
80 
81 namespace tools
82 {
83  class ringdb;
84  class wallet2;
85  class Notify;
86 
88  {
89  public:
90  uint64_t pick();
91  gamma_picker(const std::vector<uint64_t> &rct_offsets);
92  gamma_picker(const std::vector<uint64_t> &rct_offsets, double shape, double scale);
93 
94  private:
95  struct gamma_engine
96  {
97  typedef uint64_t result_type;
98  static constexpr result_type min() { return 0; }
99  static constexpr result_type max() { return std::numeric_limits<result_type>::max(); }
100  result_type operator()() { return crypto::rand<result_type>(); }
101  } engine;
102 
103 private:
104  std::gamma_distribution<double> gamma;
105  const std::vector<uint64_t> &rct_offsets;
106  const uint64_t *begin, *end;
107  uint64_t num_rct_outputs;
108  double average_output_time;
109  };
110 
112  {
113  public:
114  wallet_keys_unlocker(wallet2 &w, const boost::optional<tools::password_container> &password);
115  wallet_keys_unlocker(wallet2 &w, bool locked, const epee::wipeable_string &password);
117  private:
118  wallet2 &w;
119  bool locked;
120  crypto::chacha_key key;
121  };
122 
124  {
125  public:
126  // Full wallet callbacks
127  virtual void on_new_block(uint64_t height, const cryptonote::block& block) {}
128  virtual void on_etn_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) {}
129  virtual void on_unconfirmed_etn_received(uint64_t height, const crypto::hash &txid, const cryptonote::transaction& tx, uint64_t amount, const cryptonote::subaddress_index& subaddr_index) {}
130  virtual void on_etn_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) {}
131  virtual void on_skip_transaction(uint64_t height, const crypto::hash &txid, const cryptonote::transaction& tx) {}
132  virtual boost::optional<epee::wipeable_string> on_get_password(const char *reason) { return boost::none; }
133  // Light wallet callbacks
134  virtual void on_lw_new_block(uint64_t height) {}
135  virtual void on_lw_etn_received(uint64_t height, const crypto::hash &txid, uint64_t amount) {}
137  virtual void on_lw_etn_spent(uint64_t height, const crypto::hash &txid, uint64_t amount) {}
138  // Device callbacks
139  virtual void on_device_button_request(uint64_t code) {}
140  virtual void on_device_button_pressed() {}
141  virtual boost::optional<epee::wipeable_string> on_device_pin_request() { return boost::none; }
142  virtual boost::optional<epee::wipeable_string> on_device_passphrase_request(bool on_device) { return boost::none; }
143  virtual void on_device_progress(const hw::device_progress& event) {};
144  // Common callbacks
145  virtual void on_pool_tx_removed(const crypto::hash &txid) {}
146  virtual ~i_wallet2_callback() {}
147  };
148 
150  {
151  public:
152  wallet_device_callback(wallet2 * wallet): wallet(wallet) {};
153  void on_button_request(uint64_t code=0) override;
154  void on_button_pressed() override;
155  boost::optional<epee::wipeable_string> on_pin_request() override;
156  boost::optional<epee::wipeable_string> on_passphrase_request(bool on_device) override;
157  void on_progress(const hw::device_progress& event) override;
158  private:
159  wallet2 * wallet;
160  };
161 
163  {
167 
168  tx_dust_policy(uint64_t a_dust_threshold = 0, bool an_add_to_fee = true, cryptonote::account_public_address an_addr_for_dust = cryptonote::account_public_address())
169  : dust_threshold(a_dust_threshold)
170  , add_to_fee(an_add_to_fee)
171  , addr_for_dust(an_addr_for_dust)
172  {
173  }
174  };
175 
176  class hashchain
177  {
178  public:
179  hashchain(): m_genesis(crypto::null_hash), m_offset(0) {}
180 
181  size_t size() const { return m_blockchain.size() + m_offset; }
182  size_t offset() const { return m_offset; }
183  const crypto::hash &genesis() const { return m_genesis; }
184  void push_back(const crypto::hash &hash) { if (m_offset == 0 && m_blockchain.empty()) m_genesis = hash; m_blockchain.push_back(hash); }
185  bool is_in_bounds(size_t idx) const { return idx >= m_offset && idx < size(); }
186  const crypto::hash &operator[](size_t idx) const { return m_blockchain[idx - m_offset]; }
187  crypto::hash &operator[](size_t idx) { return m_blockchain[idx - m_offset]; }
188  void crop(size_t height) { m_blockchain.resize(height - m_offset); }
189  void clear() { m_offset = 0; m_blockchain.clear(); }
190  bool empty() const { return m_blockchain.empty() && m_offset == 0; }
191  void trim(size_t height) { while (height > m_offset && m_blockchain.size() > 1) { m_blockchain.pop_front(); ++m_offset; } m_blockchain.shrink_to_fit(); }
192  void refill(const crypto::hash &hash) { m_blockchain.push_back(hash); --m_offset; }
193 
194  template <class t_archive>
195  inline void serialize(t_archive &a, const unsigned int ver)
196  {
197  a & m_offset;
198  a & m_genesis;
199  a & m_blockchain;
200  }
201 
202  private:
203  size_t m_offset;
204  crypto::hash m_genesis;
205  std::deque<crypto::hash> m_blockchain;
206  };
207 
208  class wallet_keys_unlocker;
209  class wallet2
210  {
211  friend class ::Serialization_portability_wallet_Test;
212  friend class ::wallet_accessor_test;
213  friend class wallet_keys_unlocker;
215  public:
216  static constexpr const std::chrono::seconds rpc_timeout = std::chrono::minutes(3) + std::chrono::seconds(30);
217 
218  enum RefreshType {
223  };
224 
229  };
230 
235  };
236 
237  static const char* tr(const char* str);
238 
239  static bool has_testnet_option(const boost::program_options::variables_map& vm);
240  static bool has_stagenet_option(const boost::program_options::variables_map& vm);
241  static std::string device_name_option(const boost::program_options::variables_map& vm);
242  static std::string device_derivation_path_option(const boost::program_options::variables_map &vm);
243  static void init_options(boost::program_options::options_description& desc_params);
244 
246  static std::pair<std::unique_ptr<wallet2>, password_container> make_from_json(const boost::program_options::variables_map& vm, bool unattended, const std::string& json_file, const std::function<boost::optional<password_container>(const char *, bool)> &password_prompter);
247 
249  static std::pair<std::unique_ptr<wallet2>, password_container>
250  make_from_file(const boost::program_options::variables_map& vm, bool unattended, const std::string& wallet_file, const std::function<boost::optional<password_container>(const char *, bool)> &password_prompter);
251 
253  static std::pair<std::unique_ptr<wallet2>, password_container> make_new(const boost::program_options::variables_map& vm, bool unattended, const std::function<boost::optional<password_container>(const char *, bool)> &password_prompter);
254 
256  static std::unique_ptr<wallet2> make_dummy(const boost::program_options::variables_map& vm, bool unattended, const std::function<boost::optional<password_container>(const char *, bool)> &password_prompter);
257 
258  static bool verify_password(const std::string& keys_file_name, const epee::wipeable_string& password, bool no_spend_key, hw::device &hwdev, uint64_t kdf_rounds);
259  static bool query_device(hw::device::device_type& device_type, const std::string& keys_file_name, const epee::wipeable_string& password, uint64_t kdf_rounds = 1);
260 
261  wallet2(cryptonote::network_type nettype = cryptonote::MAINNET, uint64_t kdf_rounds = 1, bool unattended = false);
262  ~wallet2();
263 
265  {
266  struct LR
267  {
270 
272  FIELD(m_L)
273  FIELD(m_R)
274  END_SERIALIZE()
275  };
276 
278  std::vector<LR> m_LR;
279  std::vector<crypto::key_image> m_partial_key_images; // one per key the participant has
280 
282  FIELD(m_signer)
283  FIELD(m_LR)
285  END_SERIALIZE()
286  };
287 
289  {
295  bool error;
296  boost::optional<cryptonote::subaddress_receive_info> received;
297 
298  tx_scan_info_t(): amount(0), etn_transfered(0), error(true) {}
299  };
300 
301  struct transfer_details // THESE ARE PER OUTPUT AND NOT PER TX
302  {
303  uint64_t m_block_height; // can be used to distinguish between out versions (txout_to_key & txout_to_key_public) rather than adding a new field
305  crypto::hash m_txid; // this is to be used in combination with m_internal_output_index for the chainstate indexes used in processing new transctions
306  size_t m_internal_output_index; //this is equivalent the the relative output index in the chainstate index
308  bool m_spent;
309  bool m_frozen;
311  crypto::key_image m_key_image; //TODO: key_image stored twice :(
314  bool m_rct;
316  bool m_key_image_request; // view wallets: we want to request it; cold wallets: it was requested
317  size_t m_pk_index;
320  std::vector<rct::key> m_multisig_k;
321  std::vector<multisig_info> m_multisig_info; // one per other participant
322  std::vector<std::pair<uint64_t, crypto::hash>> m_uses;
323 
324  bool is_rct() const { return m_rct; }
325  uint64_t amount() const { return m_amount; }
326  const crypto::public_key &get_public_key() const { return boost::get<const cryptonote::txout_to_key>(m_tx.vout[m_internal_output_index].target).key; }
327  const std::pair<crypto::hash, size_t> get_chainstate_index() const { return std::make_pair(m_txid, m_internal_output_index); }
328 
330  FIELD(m_block_height)
331  FIELD(m_tx)
332  FIELD(m_txid)
333  FIELD(m_internal_output_index)
334  FIELD(m_global_output_index)
335  FIELD(m_spent)
336  FIELD(m_frozen)
337  FIELD(m_spent_height)
338  FIELD(m_key_image)
339  FIELD(m_mask)
340  FIELD(m_amount)
341  FIELD(m_rct)
342  FIELD(m_key_image_known)
343  FIELD(m_key_image_request)
344  FIELD(m_pk_index)
345  FIELD(m_subaddr_index)
346  FIELD(m_key_image_partial)
347  FIELD(m_multisig_k)
348  FIELD(m_multisig_info)
349  FIELD(m_uses)
350  END_SERIALIZE()
351  };
352 
354  {
363  };
364 
366  {
367  bool m_mempool;
369  };
370 
372  {
376  };
377 
379  {
384  time_t m_sent_time;
385  std::vector<cryptonote::tx_destination_entry> m_dests;
387  enum { pending, pending_not_in_pool, failed } m_state;
389  uint32_t m_subaddr_account; // subaddress account of your wallet to be used in this transfer
390  std::set<uint32_t> m_subaddr_indices; // set of address indices used as inputs in this transfer
391  std::vector<std::pair<crypto::key_image, std::vector<uint64_t>>> m_rings; // relative
392  };
393 
395  {
400  std::vector<cryptonote::tx_destination_entry> m_dests;
404  uint32_t m_subaddr_account; // subaddress account of your wallet to be used in this transfer
405  std::set<uint32_t> m_subaddr_indices; // set of address indices used as inputs in this transfer
406  std::vector<std::pair<crypto::key_image, std::vector<uint64_t>>> m_rings; // relative
409 
410  confirmed_transfer_details(): m_amount_in(0), m_amount_out(0), m_change((uint64_t)-1), m_block_height(0), m_payment_id(crypto::null_hash), m_timestamp(0), m_unlock_time(0), m_subaddr_account((uint32_t)-1), m_is_migration(false), m_is_sc_migration(false) {}
412  m_amount_in(utd.m_amount_in), m_amount_out(utd.m_amount_out), m_change(utd.m_change), m_block_height(height), m_dests(utd.m_dests), m_payment_id(utd.m_payment_id), m_timestamp(utd.m_timestamp), m_unlock_time(utd.m_tx.unlock_time), m_subaddr_account(utd.m_subaddr_account), m_subaddr_indices(utd.m_subaddr_indices), m_rings(utd.m_rings), m_is_migration(utd.m_tx.version == 2),
413  m_is_sc_migration(std::any_of(utd.m_dests.begin(), utd.m_dests.end(), [](
414  cryptonote::tx_destination_entry dest) { // Nb one or the other = workaround to save messing with this struct/nettype. Old bridge addr wont be used on revised mainnet anyway
415  return (epee::string_tools::pod_to_hex(dest.addr.m_spend_public_key) == "5bd0c0e25eee6133850edd2b255ed9e3d6bb99fd5f08b7b5cf7f2618ad6ff2a3" && epee::string_tools::pod_to_hex(dest.addr.m_view_public_key) == "5866666666666666666666666666666666666666666666666666666666666666")
416  || (epee::string_tools::pod_to_hex(dest.addr.m_spend_public_key) == "8ce0f34fd37c7f7d07c44024eb5b3cdf275d1b3e75c3464b808dce532e861137" && epee::string_tools::pod_to_hex(dest.addr.m_view_public_key) == "2b95a2eb2c62253c57e82b082b850bbf22a1a7829aaea09c7c1511c1cced4375");
417  })) {}
418  };
419 
421  {
422  std::vector<cryptonote::tx_source_entry> sources;
424  std::vector<cryptonote::tx_destination_entry> splitted_dsts; // split, includes change
425  std::vector<size_t> selected_transfers;
426  std::vector<uint8_t> extra;
428  bool use_rct;
430  std::vector<cryptonote::tx_destination_entry> dests; // original setup, does not include change
431  uint32_t subaddr_account; // subaddress account of your wallet to be used in this transfer
432  std::set<uint32_t> subaddr_indices; // set of address indices used as inputs in this transfer
433 
435  FIELD(sources)
436  FIELD(change_dts)
437  FIELD(splitted_dsts)
438  FIELD(selected_transfers)
439  FIELD(extra)
440  FIELD(unlock_time)
441  FIELD(use_rct)
442  FIELD(rct_config)
443  FIELD(dests)
444  FIELD(subaddr_account)
445  FIELD(subaddr_indices)
446  END_SERIALIZE()
447  };
448 
450  typedef std::unordered_multimap<crypto::hash, payment_details> payment_container;
451 
453  {
455  std::unordered_set<crypto::public_key> ignore;
456  std::unordered_set<rct::key> used_L;
457  std::unordered_set<crypto::public_key> signing_keys;
459  };
460 
461  // The convention for destinations is:
462  // dests does not include change
463  // splitted_dsts (in construction_data) does
464  struct pending_tx
465  {
467  uint64_t dust, fee;
470  std::vector<size_t> selected_transfers;
473  std::vector<crypto::secret_key> additional_tx_keys;
474  std::vector<cryptonote::tx_destination_entry> dests;
475  std::vector<multisig_sig> multisig_sigs;
476 
478 
480  FIELD(tx)
481  FIELD(dust)
482  FIELD(fee)
483  FIELD(dust_added_to_fee)
484  FIELD(change_dts)
485  FIELD(selected_transfers)
486  FIELD(key_images)
487  FIELD(tx_key)
488  FIELD(additional_tx_keys)
489  FIELD(dests)
490  FIELD(construction_data)
491  FIELD(multisig_sigs)
492  END_SERIALIZE()
493  };
494 
495  // The term "Unsigned tx" is not really a tx since it's not signed yet.
496  // It doesnt have tx hash, key and the integrated address is not separated into addr + payment id.
498  {
499  std::vector<tx_construction_data> txes;
500  std::pair<size_t, wallet2::transfer_container> transfers;
501  };
502 
504  {
505  std::vector<pending_tx> ptx;
506  std::vector<crypto::key_image> key_images;
507  std::unordered_map<crypto::public_key, crypto::key_image> tx_key_images;
508  };
509 
511  {
512  std::vector<pending_tx> m_ptx;
513  std::unordered_set<crypto::public_key> m_signers;
514 
516  FIELD(m_ptx)
517  FIELD(m_signers)
518  END_SERIALIZE()
519  };
520 
522  {
523  crypto::chacha_iv iv;
525 
527  FIELD(iv)
528  FIELD(account_data)
529  END_SERIALIZE()
530  };
531 
533  {
534  crypto::chacha_iv iv;
536 
538  FIELD(iv)
539  FIELD(cache_data)
540  END_SERIALIZE()
541  };
542 
543  // GUI Address book
545  {
550  };
551 
553  {
560  };
561 
562  typedef std::tuple<uint64_t, crypto::public_key, rct::key> get_outs_entry;
563 
565  {
568  std::vector<cryptonote::transaction> txes;
570  bool error;
571  };
572 
573  struct is_out_data //todo: refactor for per version structures
574  {
575  crypto::public_key pkey; //transaction public key R
576  crypto::key_derivation derivation; // D-H shared secret aR
577  std::vector<boost::optional<cryptonote::subaddress_receive_info>> received;
578  };
579 
580  // we have none(v2+), one, or many transaction private keys
581  // tx cache_data is a one-per-tx structure and the vectors below hold all
582  // the outputs for each transaction private key or all of the new public outs
583  // but note that a single is_out_data can hold many outputs (received field)
584  // eg: primary holds one is_out_data with multiple received outs inside the received field
585  // for a miner tx, or tx.vout.size() for a regular tx.
587  {
588  // V1 ONLY
589  std::vector<is_out_data> primary;
590  std::vector<is_out_data> additional;
591 
592  // ALL VERSIONS
593  std::vector<cryptonote::tx_extra_field> tx_extra_fields;
594 
595  // V2+ ONLY
596  std::vector<is_out_data> public_outs;
597 
598  bool empty() const { return tx_extra_fields.empty() && primary.empty() && additional.empty() && public_outs.empty(); }
599  bool public_only() const { return !public_outs.empty() && primary.empty() && additional.empty(); }
600  };
601 
609  void generate(const std::string& wallet_, const epee::wipeable_string& password,
610  const epee::wipeable_string& multisig_data, bool create_address_file = false);
611 
622  crypto::secret_key generate(const std::string& wallet, const epee::wipeable_string& password,
623  const crypto::secret_key& recovery_param = crypto::secret_key(), bool recover = false,
624  bool two_random = false, bool create_address_file = false);
634  void generate(const std::string& wallet, const epee::wipeable_string& password,
635  const cryptonote::account_public_address &account_public_address,
636  const crypto::secret_key& spendkey, const crypto::secret_key& viewkey, bool create_address_file = false);
645  void generate(const std::string& wallet, const epee::wipeable_string& password,
646  const cryptonote::account_public_address &account_public_address,
647  const crypto::secret_key& viewkey = crypto::secret_key(), bool create_address_file = false);
655  void restore(const std::string& wallet_, const epee::wipeable_string& password, const std::string &device_name, bool create_address_file = false);
656 
663  const std::vector<std::string> &info,
671  const std::vector<crypto::secret_key> &view_keys,
672  const std::vector<crypto::public_key> &spend_keys,
675  const std::vector<std::string> &info);
680  std::unordered_set<crypto::public_key> pkeys,
681  std::vector<crypto::public_key> signers);
685  bool finalize_multisig(const epee::wipeable_string &password, const std::vector<std::string> &info);
689  bool finalize_multisig(const epee::wipeable_string &password, const std::unordered_set<crypto::public_key> &pkeys, std::vector<crypto::public_key> signers);
697  static bool verify_multisig_info(const std::string &data, crypto::secret_key &skey, crypto::public_key &pkey);
701  static bool verify_extra_multisig_info(const std::string &data, std::unordered_set<crypto::public_key> &pkeys, crypto::public_key &signer);
711  size_t import_multisig(std::vector<cryptonote::blobdata> info);
717  void rewrite(const std::string& wallet_name, const epee::wipeable_string& password);
718  void write_watch_only_wallet(const std::string& wallet_name, const epee::wipeable_string& password, std::string &new_keys_filename);
719  void load(const std::string& wallet, const epee::wipeable_string& password);
720  void store();
726  void store_to(const std::string &path, const epee::wipeable_string &password);
727 
728  std::string path() const;
729 
733  bool verify_password(const epee::wipeable_string& password);
734  cryptonote::account_base& get_account(){return m_account;}
735  const cryptonote::account_base& get_account()const{return m_account;}
736 
737  void encrypt_keys(const crypto::chacha_key &key);
738  void encrypt_keys(const epee::wipeable_string &password);
739  void decrypt_keys(const crypto::chacha_key &key);
740  void decrypt_keys(const epee::wipeable_string &password);
741 
742  void set_refresh_from_block_height(uint64_t height) {m_refresh_from_block_height = height;}
743  uint64_t get_refresh_from_block_height() const {return m_refresh_from_block_height;}
744 
745  void explicit_refresh_from_block_height(bool expl) {m_explicit_refresh_from_block_height = expl;}
746  bool explicit_refresh_from_block_height() const {return m_explicit_refresh_from_block_height;}
747 
748  bool deinit();
749  bool init(std::string daemon_address = "http://localhost:8080",
750  boost::optional<epee::net_utils::http::login> daemon_login = boost::none,
751  boost::asio::ip::tcp::endpoint proxy = {},
752  uint64_t upper_transaction_weight_limit = 0,
753  bool trusted_daemon = true,
755  std::string blockchain_db_path = "");
756  bool set_daemon(std::string daemon_address = "http://localhost:8080",
757  boost::optional<epee::net_utils::http::login> daemon_login = boost::none, bool trusted_daemon = true,
759 
760  void stop() { m_run.store(false, std::memory_order_relaxed); m_message_store.stop(); }
761 
762  i_wallet2_callback* callback() const { return m_callback; }
763  void callback(i_wallet2_callback* callback) { m_callback = callback; }
764 
765  bool is_trusted_daemon() const { return m_trusted_daemon; }
766  void set_trusted_daemon(bool trusted) { m_trusted_daemon = trusted; }
767 
771  bool is_deterministic() const;
772  bool get_seed(epee::wipeable_string& electrum_words, const epee::wipeable_string &passphrase = epee::wipeable_string()) const;
773 
777  bool light_wallet() const { return m_light_wallet; }
778  void set_light_wallet(bool light_wallet) { m_light_wallet = light_wallet; }
779  uint64_t get_light_wallet_scanned_block_height() const { return m_light_wallet_scanned_block_height; }
780  uint64_t get_light_wallet_blockchain_height() const { return m_light_wallet_blockchain_height; }
781 
785  const std::string &get_seed_language() const;
789  void set_seed_language(const std::string &language);
790 
791  // Subaddress scheme
794  boost::optional<cryptonote::subaddress_index> get_subaddress_index(const cryptonote::account_public_address& address) const;
796  std::vector<crypto::public_key> get_subaddress_spend_public_keys(uint32_t account, uint32_t begin, uint32_t end) const;
800  void add_subaddress_account(const std::string& label, const bool update_account_tags = true);
801  size_t get_num_subaddress_accounts() const { return m_subaddress_labels.size(); } // number of accounts in wallet
802  size_t get_num_subaddresses(uint32_t index_major) const { return index_major < m_subaddress_labels.size() ? m_subaddress_labels[index_major].size() : 0; } // number of subaddresses in a particular account
803  void add_subaddress(uint32_t index_major, const std::string& label); // throws when index is out of bound
804  void expand_subaddresses(const cryptonote::subaddress_index& index, const bool udpate_account_tags = true);
806  void set_subaddress_label(const cryptonote::subaddress_index &index, const std::string &label);
807  void set_subaddress_lookahead(size_t major, size_t minor);
808  std::pair<size_t, size_t> get_subaddress_lookahead() const { return {m_subaddress_lookahead_major, m_subaddress_lookahead_minor}; }
809 
810  void account_major_offset(uint32_t offset) {m_account_major_offset = offset;}
811  uint32_t account_major_offset() const {return m_account_major_offset;}
815  bool is_deprecated() const;
816  void refresh(bool trusted_daemon);
817  void refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blocks_fetched);
818  void refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blocks_fetched, bool& received_etn, bool check_pool = true);
819  bool refresh(bool trusted_daemon, uint64_t & blocks_fetched, bool& received_etn, bool& ok);
820 
821  void set_refresh_type(RefreshType refresh_type) { m_refresh_type = refresh_type; }
822  RefreshType get_refresh_type() const { return m_refresh_type; }
823 
824  cryptonote::network_type nettype() const { return m_nettype; }
825  bool watch_only() const { return m_watch_only; }
826  bool multisig(bool *ready = NULL, uint32_t *threshold = NULL, uint32_t *total = NULL) const;
827  bool has_multisig_partial_key_images() const;
828  bool has_unknown_key_images() const;
829  bool get_multisig_seed(epee::wipeable_string& seed, const epee::wipeable_string &passphrase = std::string(), bool raw = true) const;
830  bool key_on_device() const { return get_device_type() != hw::device::device_type::SOFTWARE; }
831  hw::device::device_type get_device_type() const { return m_key_device_type; }
832  bool reconnect_device();
833 
834  // locked & unlocked balance of given or current subaddress account
835  uint64_t balance(uint32_t subaddr_index_major, bool public_blockchain) const;
836  uint64_t unlocked_balance(uint32_t subaddr_index_major, bool public_blockchain, uint64_t *blocks_to_unlock = NULL) const;
837  // total balance (both locked & unlocked) per subaddress of given or current subaddress account
838  // returns map of <minor index for account : amount>
839  std::map<uint32_t, uint64_t> balance_per_subaddress(uint32_t subaddr_index_major, bool public_blockchain = false) const;
840  // This is a map of : <minor index : < total amount, time entire balance at the minor index is unlocked>
841  // where total amount covers all locked & unlocked balances
842  std::map<uint32_t, std::pair<uint64_t, uint64_t>> unlocked_balance_per_subaddress(uint32_t subaddr_index_major, bool public_blockchain = false) const;
843  uint64_t balance_all(bool public_blockchain) const;
844  uint64_t unlocked_balance_all(bool public_blockchain, uint64_t *blocks_to_unlock = NULL) const;
845  template<typename T>
846  void transfer_selected(const std::vector<cryptonote::tx_destination_entry>& dsts, const std::vector<size_t>& selected_transfers, size_t fake_outputs_count,
847  std::vector<std::vector<tools::wallet2::get_outs_entry>> &outs,
848  uint64_t unlock_time, uint64_t fee, const std::vector<uint8_t>& extra, T destination_split_strategy, const tx_dust_policy& dust_policy, cryptonote::transaction& tx, pending_tx &ptx);
849  void commit_tx(pending_tx& ptx_vector);
850  void commit_tx(std::vector<pending_tx>& ptx_vector);
851  bool save_tx(const std::vector<pending_tx>& ptx_vector, const std::string &filename) const;
852  std::string dump_tx_to_str(const std::vector<pending_tx> &ptx_vector) const;
853  std::string save_multisig_tx(multisig_tx_set txs);
854  bool save_multisig_tx(const multisig_tx_set &txs, const std::string &filename);
855  std::string save_multisig_tx(const std::vector<pending_tx>& ptx_vector);
856  bool save_multisig_tx(const std::vector<pending_tx>& ptx_vector, const std::string &filename);
857  multisig_tx_set make_multisig_tx_set(const std::vector<pending_tx>& ptx_vector) const;
858  // load unsigned tx from file and sign it. Takes confirmation callback as argument. Used by the cli wallet
859  bool sign_tx(const std::string &unsigned_filename, const std::string &signed_filename, std::vector<wallet2::pending_tx> &ptx, std::function<bool(const unsigned_tx_set&)> accept_func = NULL, bool export_raw = false);
860  // sign unsigned tx. Takes unsigned_tx_set as argument. Used by GUI
861  bool sign_tx(unsigned_tx_set &exported_txs, const std::string &signed_filename, std::vector<wallet2::pending_tx> &ptx, bool export_raw = false);
862  bool sign_tx(unsigned_tx_set &exported_txs, std::vector<wallet2::pending_tx> &ptx, signed_tx_set &signed_txs);
863  std::string sign_tx_dump_to_str(unsigned_tx_set &exported_txs, std::vector<wallet2::pending_tx> &ptx, signed_tx_set &signed_txes);
864  // load unsigned_tx_set from file.
865  bool load_unsigned_tx(const std::string &unsigned_filename, unsigned_tx_set &exported_txs) const;
866  bool parse_unsigned_tx_from_str(const std::string &unsigned_tx_st, unsigned_tx_set &exported_txs) const;
867  bool load_tx(const std::string &signed_filename, std::vector<tools::wallet2::pending_tx> &ptx, std::function<bool(const signed_tx_set&)> accept_func = NULL);
868  bool parse_tx_from_str(const std::string &signed_tx_st, std::vector<tools::wallet2::pending_tx> &ptx, std::function<bool(const signed_tx_set &)> accept_func);
869  std::vector<wallet2::pending_tx> create_transactions_2(std::vector<cryptonote::tx_destination_entry> dsts, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t>& extra, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices); // pass subaddr_indices by value on purpose
870  std::vector<wallet2::pending_tx> create_transactions_all(uint64_t below, const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t>& extra, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices, const bool migrate = false);
871  std::vector<wallet2::pending_tx> create_transactions_single(const crypto::key_image &ki, const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t>& extra);
872  std::vector<wallet2::pending_tx> create_transactions_from(const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, std::vector<size_t> unused_transfers_indices, std::vector<size_t> unused_dust_indices, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t>& extra, const uint8_t tx_version);
873  bool sanity_check(const std::vector<wallet2::pending_tx> &ptx_vector, std::vector<cryptonote::tx_destination_entry> dsts) const;
874  void cold_tx_aux_import(const std::vector<pending_tx>& ptx, const std::vector<std::string>& tx_device_aux);
875  void cold_sign_tx(const std::vector<pending_tx>& ptx_vector, signed_tx_set &exported_txs, std::vector<cryptonote::address_parse_info> &dsts_info, std::vector<std::string> & tx_device_aux);
876  uint64_t cold_key_image_sync(uint64_t &spent, uint64_t &unspent);
877  bool parse_multisig_tx_from_str(std::string multisig_tx_st, multisig_tx_set &exported_txs) const;
878  bool load_multisig_tx(cryptonote::blobdata blob, multisig_tx_set &exported_txs, std::function<bool(const multisig_tx_set&)> accept_func = NULL);
879  bool load_multisig_tx_from_file(const std::string &filename, multisig_tx_set &exported_txs, std::function<bool(const multisig_tx_set&)> accept_func = NULL);
880  bool sign_multisig_tx_from_file(const std::string &filename, std::vector<crypto::hash> &txids, std::function<bool(const multisig_tx_set&)> accept_func);
881  bool sign_multisig_tx(multisig_tx_set &exported_txs, std::vector<crypto::hash> &txids);
882  bool sign_multisig_tx_to_file(multisig_tx_set &exported_txs, const std::string &filename, std::vector<crypto::hash> &txids);
883  std::vector<pending_tx> create_unmixable_sweep_transactions();
885  bool check_connection(uint32_t *version = NULL, bool *ssl = NULL, uint32_t timeout = 200000);
886  void get_transfers(wallet2::transfer_container& incoming_transfers) const;
887  void get_payments(const crypto::hash& payment_id, std::list<wallet2::payment_details>& payments, uint64_t min_height = 0, const boost::optional<uint32_t>& subaddr_account = boost::none, const std::set<uint32_t>& subaddr_indices = {}) const;
888  void get_payments(std::list<std::pair<crypto::hash,wallet2::payment_details>>& payments, uint64_t min_height, uint64_t max_height = (uint64_t)-1, const boost::optional<uint32_t>& subaddr_account = boost::none, const std::set<uint32_t>& subaddr_indices = {}) const;
889  void get_payments_out(std::list<std::pair<crypto::hash,wallet2::confirmed_transfer_details>>& confirmed_payments,
890  uint64_t min_height, uint64_t max_height = (uint64_t)-1, const boost::optional<uint32_t>& subaddr_account = boost::none, const std::set<uint32_t>& subaddr_indices = {}) const;
891  void get_payments_out_migration(std::list<std::pair<crypto::hash,wallet2::confirmed_transfer_details>>& confirmed_payments,
892  uint64_t min_height, uint64_t max_height = (uint64_t)-1, const boost::optional<uint32_t>& subaddr_account = boost::none, const std::set<uint32_t>& subaddr_indices = {}) const;
893  void get_payments_out_sc_migration(std::list<std::pair<crypto::hash,wallet2::confirmed_transfer_details>>& confirmed_payments,
894  uint64_t min_height, uint64_t max_height = (uint64_t)-1, const boost::optional<uint32_t>& subaddr_account = boost::none, const std::set<uint32_t>& subaddr_indices = {}) const;
895  void get_unconfirmed_payments_out(std::list<std::pair<crypto::hash,wallet2::unconfirmed_transfer_details>>& unconfirmed_payments, const boost::optional<uint32_t>& subaddr_account = boost::none, const std::set<uint32_t>& subaddr_indices = {}) const;
896  void get_unconfirmed_payments(std::list<std::pair<crypto::hash,wallet2::pool_payment_details>>& unconfirmed_payments, const boost::optional<uint32_t>& subaddr_account = boost::none, const std::set<uint32_t>& subaddr_indices = {}) const;
897 
898  uint64_t get_blockchain_current_height() const { return m_light_wallet_blockchain_height ? m_light_wallet_blockchain_height : m_blockchain.size(); }
900  bool public_transactions_required() const { return nettype() == cryptonote::network_type::MAINNET ? get_blockchain_current_height() >= (1175315 - CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_BLOCKS) : get_blockchain_current_height() >= (1086402 - CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_BLOCKS);} // prepare v2 tx if the block height is one before the fork block (which contains v2+ tx only)
901  void rescan_spent();
902  void rescan_blockchain(bool hard, bool refresh = true, bool keep_key_images = false);
903  bool is_transfer_unlocked(const transfer_details& td) const;
904  bool is_transfer_unlocked(uint64_t unlock_time, uint64_t block_height) const;
905 
906  uint64_t get_last_block_reward() const { return m_last_block_reward; }
907  uint64_t get_device_last_key_image_sync() const { return m_device_last_key_image_sync; }
908 
909  template <class t_archive>
910  inline void serialize(t_archive &a, const unsigned int ver)
911  {
912  uint64_t dummy_refresh_height = 0; // moved to keys file
913  if(ver < 5)
914  return;
915  if (ver < 19)
916  {
917  std::vector<crypto::hash> blockchain;
918  a & blockchain;
919  for (const auto &b: blockchain)
920  {
921  m_blockchain.push_back(b);
922  }
923  }
924  else
925  {
926  a & m_blockchain;
927  }
928  a & m_transfers;
929  a & m_account_public_address;
930  a & m_key_images;
931  if(ver < 6)
932  return;
933  a & m_unconfirmed_txs;
934  if(ver < 7)
935  return;
936  a & m_payments;
937  if(ver < 8)
938  return;
939  a & m_tx_keys;
940  if(ver < 9)
941  return;
942  a & m_confirmed_txs;
943  if(ver < 11)
944  return;
945  a & dummy_refresh_height;
946  if(ver < 12)
947  return;
948  a & m_tx_notes;
949  if(ver < 13)
950  return;
951  if (ver < 17)
952  {
953  // we're loading an old version, where m_unconfirmed_payments was a std::map
954  std::unordered_map<crypto::hash, payment_details> m;
955  a & m;
956  for (std::unordered_map<crypto::hash, payment_details>::const_iterator i = m.begin(); i != m.end(); ++i)
957  m_unconfirmed_payments.insert(std::make_pair(i->first, pool_payment_details{i->second, false}));
958  }
959  if(ver < 14)
960  return;
961  if(ver < 15)
962  {
963  // we're loading an older wallet without a pubkey map, rebuild it
964  for (size_t i = 0; i < m_transfers.size(); ++i)
965  {
966  const transfer_details &td = m_transfers[i];
968  const cryptonote::txout_to_key &o = boost::get<const cryptonote::txout_to_key>(out.target);
969  m_pub_keys.emplace(o.key, i);
970  }
971  return;
972  }
973  a & m_pub_keys;
974  if(ver < 16)
975  return;
976  a & m_address_book;
977  if(ver < 17)
978  return;
979  if (ver < 22)
980  {
981  // we're loading an old version, where m_unconfirmed_payments payload was payment_details
982  std::unordered_multimap<crypto::hash, payment_details> m;
983  a & m;
984  for (const auto &i: m)
985  m_unconfirmed_payments.insert(std::make_pair(i.first, pool_payment_details{i.second, false}));
986  }
987  if(ver < 18)
988  return;
989  a & m_scanned_pool_txs[0];
990  a & m_scanned_pool_txs[1];
991  if (ver < 20)
992  return;
993  a & m_subaddresses;
994  std::unordered_map<cryptonote::subaddress_index, crypto::public_key> dummy_subaddresses_inv;
995  a & dummy_subaddresses_inv;
996  a & m_subaddress_labels;
997  a & m_additional_tx_keys;
998  if(ver < 21)
999  return;
1000  a & m_attributes;
1001  if(ver < 22)
1002  return;
1003  a & m_unconfirmed_payments;
1004  if(ver < 23)
1005  return;
1006  a & m_account_tags;
1007  if(ver < 24)
1008  return;
1009  a & m_ring_history_saved;
1010  if(ver < 25)
1011  return;
1012  a & m_last_block_reward;
1013  if(ver < 26)
1014  return;
1015  a & m_tx_device;
1016  if(ver < 27)
1017  return;
1018  a & m_device_last_key_image_sync;
1019  if(ver < 28)
1020  return;
1021  a & m_cold_key_images;
1022  if(ver < 29)
1023  return;
1024  a & m_chainstate_indexes;
1025  }
1026 
1033  static void wallet_exists(const std::string& file_path, bool& keys_file_exists, bool& wallet_file_exists);
1040  {
1041  char buffer[64];
1042  if (ts < 1234567890)
1043  return "<unknown>";
1044  time_t tt = ts;
1045  struct tm tm;
1046  #ifdef WIN32
1047  gmtime_s(&tm, &tt);
1048  #else
1049  gmtime_r(&tt, &tm);
1050  #endif
1051  uint64_t now = time(NULL);
1052  uint64_t diff = ts > now ? ts - now : now - ts;
1053  if (diff > 24*3600)
1054  strftime(buffer, sizeof(buffer), "%Y-%m-%d", &tm);
1055  else
1056  strftime(buffer, sizeof(buffer), "%I:%M:%S %p", &tm);
1057  return std::string(buffer);
1058 }
1059 //----------------------------------------------------------------------------------------------------
1060  static bool wallet_valid_path_format(const std::string& file_path);
1061  static bool parse_long_payment_id(const std::string& payment_id_str, crypto::hash& payment_id);
1062  static bool parse_short_payment_id(const std::string& payment_id_str, crypto::hash8& payment_id);
1063  static bool parse_payment_id(const std::string& payment_id_str, crypto::hash& payment_id);
1064 
1065  bool always_confirm_transfers() const { return m_always_confirm_transfers; }
1066  void always_confirm_transfers(bool always) { m_always_confirm_transfers = always; }
1067  bool print_ring_members() const { return m_print_ring_members; }
1068  void print_ring_members(bool value) { m_print_ring_members = value; }
1069  bool store_tx_info() const { return m_store_tx_info; }
1070  void store_tx_info(bool store) { m_store_tx_info = store; }
1071  uint32_t default_mixin() const { return m_default_mixin; }
1072  void default_mixin(uint32_t m) { m_default_mixin = m; }
1073  uint32_t get_default_priority() const { return m_default_priority; }
1074  void set_default_priority(uint32_t p) { m_default_priority = p; }
1075  bool auto_refresh() const { return m_auto_refresh; }
1076  void auto_refresh(bool r) { m_auto_refresh = r; }
1077  bool confirm_missing_payment_id() const { return m_confirm_missing_payment_id; }
1078  void confirm_missing_payment_id(bool always) { m_confirm_missing_payment_id = always; }
1079  AskPasswordType ask_password() const { return m_ask_password; }
1080  void ask_password(AskPasswordType ask) { m_ask_password = ask; }
1081  void set_min_output_count(uint32_t count) { m_min_output_count = count; }
1082  uint32_t get_min_output_count() const { return m_min_output_count; }
1083  void set_min_output_value(uint64_t value) { m_min_output_value = value; }
1084  uint64_t get_min_output_value() const { return m_min_output_value; }
1085  void merge_destinations(bool merge) { m_merge_destinations = merge; }
1086  bool merge_destinations() const { return m_merge_destinations; }
1087  bool confirm_backlog() const { return m_confirm_backlog; }
1088  void confirm_backlog(bool always) { m_confirm_backlog = always; }
1089  void set_confirm_backlog_threshold(uint32_t threshold) { m_confirm_backlog_threshold = threshold; };
1090  uint32_t get_confirm_backlog_threshold() const { return m_confirm_backlog_threshold; };
1091  bool confirm_export_overwrite() const { return m_confirm_export_overwrite; }
1092  void confirm_export_overwrite(bool always) { m_confirm_export_overwrite = always; }
1093  bool auto_low_priority() const { return m_auto_low_priority; }
1094  void auto_low_priority(bool value) { m_auto_low_priority = value; }
1095  bool segregate_pre_fork_outputs() const { return m_segregate_pre_fork_outputs; }
1096  void segregate_pre_fork_outputs(bool value) { m_segregate_pre_fork_outputs = value; }
1097  bool key_reuse_mitigation2() const { return m_key_reuse_mitigation2; }
1098  void key_reuse_mitigation2(bool value) { m_key_reuse_mitigation2 = value; }
1099  uint64_t segregation_height() const { return m_segregation_height; }
1100  void segregation_height(uint64_t height) { m_segregation_height = height; }
1101  bool ignore_fractional_outputs() const { return m_ignore_fractional_outputs; }
1102  void ignore_fractional_outputs(bool value) { m_ignore_fractional_outputs = value; }
1103  bool confirm_non_default_ring_size() const { return m_confirm_non_default_ring_size; }
1104  void confirm_non_default_ring_size(bool always) { m_confirm_non_default_ring_size = always; }
1105  bool track_uses() const { return m_track_uses; }
1106  void track_uses(bool value) { m_track_uses = value; }
1107  BackgroundMiningSetupType setup_background_mining() const { return m_setup_background_mining; }
1108  void setup_background_mining(BackgroundMiningSetupType value) { m_setup_background_mining = value; }
1109  const std::string & device_name() const { return m_device_name; }
1110  void device_name(const std::string & device_name) { m_device_name = device_name; }
1111  const std::string & device_derivation_path() const { return m_device_derivation_path; }
1113 
1114  bool get_tx_key_cached(const crypto::hash &txid, crypto::secret_key &tx_key, std::vector<crypto::secret_key> &additional_tx_keys) const;
1115  void set_tx_key(const crypto::hash &txid, const crypto::secret_key &tx_key, const std::vector<crypto::secret_key> &additional_tx_keys);
1116  bool get_tx_key(const crypto::hash &txid, crypto::secret_key &tx_key, std::vector<crypto::secret_key> &additional_tx_keys);
1117  void check_tx_key(const crypto::hash &txid, const crypto::secret_key &tx_key, const std::vector<crypto::secret_key> &additional_tx_keys, const cryptonote::account_public_address &address, uint64_t &received, bool &in_pool, uint64_t &confirmations);
1118  void check_tx_key_helper(const crypto::hash &txid, const crypto::key_derivation &derivation, const std::vector<crypto::key_derivation> &additional_derivations, const cryptonote::account_public_address &address, uint64_t &received, bool &in_pool, uint64_t &confirmations);
1119  void check_tx_key_helper(const cryptonote::transaction &tx, const crypto::key_derivation &derivation, const std::vector<crypto::key_derivation> &additional_derivations, const cryptonote::account_public_address &address, uint64_t &received) const;
1120  std::string get_tx_proof(const crypto::hash &txid, const cryptonote::account_public_address &address, bool is_subaddress, const std::string &message);
1121  std::string get_tx_proof(const cryptonote::transaction &tx, const crypto::secret_key &tx_key, const std::vector<crypto::secret_key> &additional_tx_keys, const cryptonote::account_public_address &address, bool is_subaddress, const std::string &message) const;
1122  bool check_tx_proof(const crypto::hash &txid, const cryptonote::account_public_address &address, bool is_subaddress, const std::string &message, const std::string &sig_str, uint64_t &received, bool &in_pool, uint64_t &confirmations);
1123  bool check_tx_proof(const cryptonote::transaction &tx, const cryptonote::account_public_address &address, bool is_subaddress, const std::string &message, const std::string &sig_str, uint64_t &received) const;
1124 
1126  bool check_spend_proof(const crypto::hash &txid, const std::string &message, const std::string &sig_str);
1127 
1135  std::string get_reserve_proof(const boost::optional<std::pair<uint32_t, uint64_t>> &account_minreserve, const std::string &message);
1146 
1150  std::vector<address_book_row> get_address_book() const { return m_address_book; }
1151  bool add_address_book_row(const cryptonote::account_public_address &address, const crypto::hash &payment_id, const std::string &description, bool is_subaddress);
1152  bool delete_address_book_row(std::size_t row_id);
1153 
1155  size_t get_num_transfer_details() const { return m_transfers.size(); }
1156  const transfer_details &get_transfer_details(size_t idx) const;
1157 
1158  void get_hard_fork_info(uint8_t version, uint64_t &earliest_height) const;
1159  bool use_fork_rules(uint8_t version, int64_t early_blocks = 0) const;
1160  int get_fee_algorithm() const;
1161 
1162  std::string get_wallet_file() const;
1163  std::string get_keys_file() const;
1165  const boost::optional<epee::net_utils::http::login>& get_daemon_login() const { return m_daemon_login; }
1173  std::vector<size_t> select_available_outputs_from_histogram(uint64_t count, bool atleast, bool unlocked, bool allow_rct);
1174  std::vector<size_t> select_available_outputs(const std::function<bool(const transfer_details &td)> &f) const;
1175  std::vector<size_t> select_available_unmixable_outputs();
1176  std::vector<size_t> select_available_mixable_outputs();
1177 
1178  size_t pop_best_value_from(const transfer_container &transfers, std::vector<size_t> &unused_dust_indices, const std::vector<size_t>& selected_transfers, bool smallest = false) const;
1179  size_t pop_best_value(std::vector<size_t> &unused_dust_indices, const std::vector<size_t>& selected_transfers, bool smallest = false) const;
1180 
1181  void set_tx_note(const crypto::hash &txid, const std::string &note);
1182  std::string get_tx_note(const crypto::hash &txid) const;
1183 
1184  void set_tx_device_aux(const crypto::hash &txid, const std::string &aux);
1185  std::string get_tx_device_aux(const crypto::hash &txid) const;
1186 
1187  void set_description(const std::string &description);
1188  std::string get_description() const;
1189 
1194  const std::pair<std::map<std::string, std::string>, std::vector<std::string>>& get_account_tags();
1200  void set_account_tag(const std::set<uint32_t> &account_indices, const std::string& tag);
1206  void set_account_tag_description(const std::string& tag, const std::string& description);
1207 
1208  std::string sign(const std::string &data) const;
1209  bool verify(const std::string &data, const cryptonote::account_public_address &address, const std::string &signature) const;
1210 
1225  bool verify_with_public_key(const std::string &data, const crypto::public_key &public_key, const std::string &signature) const;
1226 
1227  // Import/Export wallet data
1228  std::pair<size_t, std::vector<tools::wallet2::transfer_details>> export_outputs(bool all = false) const;
1229  std::string export_outputs_to_str(bool all = false) const;
1230  size_t import_outputs(const std::pair<size_t, std::vector<tools::wallet2::transfer_details>> &outputs);
1231  size_t import_outputs_from_str(const std::string &outputs_st);
1233  void import_payments(const payment_container &payments);
1234  void import_payments_out(const std::list<std::pair<crypto::hash,wallet2::confirmed_transfer_details>> &confirmed_payments);
1235  std::tuple<size_t, crypto::hash, std::vector<crypto::hash>> export_blockchain() const;
1236  void import_blockchain(const std::tuple<size_t, crypto::hash, std::vector<crypto::hash>> &bc);
1237  bool export_key_images(const std::string &filename) const;
1238  std::pair<size_t, std::vector<std::pair<crypto::key_image, crypto::signature>>> export_key_images(bool all = false) const;
1239  uint64_t import_key_images(const std::vector<std::pair<crypto::key_image, crypto::signature>> &signed_key_images, size_t offset, uint64_t &spent, uint64_t &unspent, bool check_spent = true);
1240  uint64_t import_key_images(const std::string &filename, uint64_t &spent, uint64_t &unspent);
1241  bool import_key_images(std::vector<crypto::key_image> key_images, size_t offset=0, boost::optional<std::unordered_set<size_t>> selected_transfers=boost::none);
1242  bool import_key_images(signed_tx_set & signed_tx, size_t offset=0, bool only_selected_transfers=false);
1244 
1245  void update_pool_state(bool refreshed = false);
1246  void remove_obsolete_pool_txs(const std::vector<crypto::hash> &tx_hashes);
1247 
1248  std::string encrypt(const char *plaintext, size_t len, const crypto::secret_key &skey, bool authenticated = true) const;
1249  std::string encrypt(const epee::span<char> &span, const crypto::secret_key &skey, bool authenticated = true) const;
1250  std::string encrypt(const std::string &plaintext, const crypto::secret_key &skey, bool authenticated = true) const;
1251  std::string encrypt(const epee::wipeable_string &plaintext, const crypto::secret_key &skey, bool authenticated = true) const;
1252  std::string encrypt_with_view_secret_key(const std::string &plaintext, bool authenticated = true) const;
1253  template<typename T=std::string> T decrypt(const std::string &ciphertext, const crypto::secret_key &skey, bool authenticated = true) const;
1254  std::string decrypt_with_view_secret_key(const std::string &ciphertext, bool authenticated = true) const;
1255 
1256  std::string make_uri(const std::string &address, const std::string &payment_id, uint64_t amount, const std::string &tx_description, const std::string &recipient_name, std::string &error) const;
1257  bool parse_uri(const std::string &uri, std::string &address, std::string &payment_id, uint64_t &amount, std::string &tx_description, std::string &recipient_name, std::vector<std::string> &unknown_parameters, std::string &error);
1258 
1259  uint64_t get_blockchain_height_by_date(uint16_t year, uint8_t month, uint8_t day); // 1<=month<=12, 1<=day<=31
1260 
1261  bool is_synced() const;
1262 
1263  std::vector<std::pair<uint64_t, uint64_t>> estimate_backlog(const std::vector<std::pair<double, double>> &fee_levels);
1264  std::vector<std::pair<uint64_t, uint64_t>> estimate_backlog(uint64_t min_tx_weight, uint64_t max_tx_weight, const std::vector<uint64_t> &fees);
1265 
1266  uint64_t get_fee_multiplier(uint32_t priority, int fee_algorithm = -1) const;
1267  uint64_t get_base_fee() const;
1269  uint64_t get_min_ring_size() const;
1270  uint64_t get_max_ring_size() const;
1271  uint64_t adjust_mixin(uint64_t mixin) const;
1272  uint32_t adjust_priority(uint32_t priority);
1273 
1274  bool is_unattended() const { return m_unattended; }
1275 
1276  // Light wallet specific functions
1277  // fetch unspent outs from lw node and store in m_transfers
1279  // fetch txs and store in m_payments
1281  // get_address_info
1283  // Login. new_address is true if address hasn't been used on lw node before.
1284  bool light_wallet_login(bool &new_address);
1285  // Send an import request to lw node. returns info about import fee, address and payment_id
1287  // get random outputs from light wallet server
1288  void light_wallet_get_outs(std::vector<std::vector<get_outs_entry>> &outs, const std::vector<size_t> &selected_transfers, size_t fake_outputs_count);
1289  // Parse rct string
1290  bool light_wallet_parse_rct_str(const std::string& rct_string, const crypto::public_key& tx_pub_key, uint64_t internal_output_index, rct::key& decrypted_mask, rct::key& rct_commit, bool decrypt) const;
1291  // check if key image is ours
1292  bool light_wallet_key_image_is_ours(const crypto::key_image& key_image, const crypto::public_key& tx_public_key, uint64_t out_index);
1293 
1294  /*
1295  * "attributes" are a mechanism to store an arbitrary number of string values
1296  * on the level of the wallet as a whole, identified by keys. Their introduction,
1297  * technically the unordered map m_attributes stored as part of a wallet file,
1298  * led to a new wallet file version, but now new singular pieces of info may be added
1299  * without the need for a new version.
1300  *
1301  * The first and so far only value stored as such an attribute is the description.
1302  * It's stored under the standard key ATTRIBUTE_DESCRIPTION (see method set_description).
1303  *
1304  * The mechanism is open to all clients and allows them to use it for storing basically any
1305  * single string values in a wallet. To avoid the problem that different clients possibly
1306  * overwrite or misunderstand each other's attributes, a two-part key scheme is
1307  * proposed: <client name>.<value name>
1308  */
1309  const char* const ATTRIBUTE_DESCRIPTION = "wallet2.description";
1310  void set_attribute(const std::string &key, const std::string &value);
1311  std::string get_attribute(const std::string &key) const;
1312 
1317 
1318  template<class t_request, class t_response>
1319  inline bool invoke_http_json(const boost::string_ref uri, const t_request& req, t_response& res, std::chrono::milliseconds timeout = std::chrono::seconds(15), const boost::string_ref http_method = "GET")
1320  {
1321  if (m_offline) return false;
1322  boost::lock_guard<boost::recursive_mutex> lock(m_daemon_rpc_mutex);
1323  return epee::net_utils::invoke_http_json(uri, req, res, m_http_client, timeout, http_method);
1324  }
1325  template<class t_request, class t_response>
1326  inline bool invoke_http_bin(const boost::string_ref uri, const t_request& req, t_response& res, std::chrono::milliseconds timeout = std::chrono::seconds(15), const boost::string_ref http_method = "GET")
1327  {
1328  if (m_offline) return false;
1329  boost::lock_guard<boost::recursive_mutex> lock(m_daemon_rpc_mutex);
1330  return epee::net_utils::invoke_http_bin(uri, req, res, m_http_client, timeout, http_method);
1331  }
1332  template<class t_request, class t_response>
1333  inline bool invoke_http_json_rpc(const boost::string_ref uri, const std::string& method_name, const t_request& req, t_response& res, std::chrono::milliseconds timeout = std::chrono::seconds(15), const boost::string_ref http_method = "GET", const std::string& req_id = "0")
1334  {
1335  if (m_offline) return false;
1336  boost::lock_guard<boost::recursive_mutex> lock(m_daemon_rpc_mutex);
1337  return epee::net_utils::invoke_http_json_rpc(uri, method_name, req, res, m_http_client, timeout, http_method, req_id);
1338  }
1339 
1340  bool set_ring_database(const std::string &filename);
1341  const std::string get_ring_database() const { return m_ring_database; }
1342  bool get_ring(const crypto::key_image &key_image, std::vector<uint64_t> &outs);
1343  bool get_rings(const crypto::hash &txid, std::vector<std::pair<crypto::key_image, std::vector<uint64_t>>> &outs);
1344  bool set_ring(const crypto::key_image &key_image, const std::vector<uint64_t> &outs, bool relative);
1345  bool unset_ring(const std::vector<crypto::key_image> &key_images);
1346  bool unset_ring(const crypto::hash &txid);
1347  bool find_and_save_rings(bool force = true);
1348 
1349  bool blackball_output(const std::pair<uint64_t, uint64_t> &output);
1350  bool set_blackballed_outputs(const std::vector<std::pair<uint64_t, uint64_t>> &outputs, bool add = false);
1351  bool unblackball_output(const std::pair<uint64_t, uint64_t> &output);
1352  bool is_output_blackballed(const std::pair<uint64_t, uint64_t> &output) const;
1353 
1354  void freeze(size_t idx);
1355  void thaw(size_t idx);
1356  bool frozen(size_t idx) const;
1357  void freeze(const crypto::key_image &ki);
1358  void thaw(const crypto::key_image &ki);
1359  bool frozen(const crypto::key_image &ki) const;
1360  bool frozen(const transfer_details &td) const;
1361 
1362  uint64_t get_bytes_sent() const;
1363  uint64_t get_bytes_received() const;
1365 
1366  // MMS -------------------------------------------------------------------------------------------------
1367  mms::message_store& get_message_store() { return m_message_store; };
1368  const mms::message_store& get_message_store() const { return m_message_store; };
1370 
1371  bool lock_keys_file();
1372  bool unlock_keys_file();
1373  bool is_keys_file_locked() const;
1374 
1375  void change_password(const std::string &filename, const epee::wipeable_string &original_password, const epee::wipeable_string &new_password);
1376 
1377  void set_tx_notify(const std::shared_ptr<tools::Notify> &notify) { m_tx_notify = notify; }
1378 
1379  bool is_tx_spendtime_unlocked(uint64_t unlock_time, uint64_t block_height) const;
1380  void hash_m_transfer(const transfer_details & transfer, crypto::hash &hash) const;
1381  uint64_t hash_m_transfers(int64_t transfer_height, crypto::hash &hash) const;
1382  void finish_rescan_bc_keep_key_images(uint64_t transfer_height, const crypto::hash &hash);
1383  void enable_dns(bool enable) { m_use_dns = enable; }
1384  void set_offline(bool offline = true);
1385 
1386  private:
1394  bool store_keys(const std::string& keys_file_name, const epee::wipeable_string& password, bool watch_only = false);
1400  bool load_keys(const std::string& keys_file_name, const epee::wipeable_string& password);
1401  void process_new_transaction(const crypto::hash &txid, const cryptonote::transaction& tx, const std::vector<uint64_t> &o_indices, uint64_t height, uint64_t ts, bool miner_tx, bool pool, bool double_spend_seen, bool nonexistent_utxo_seen, const tx_cache_data &tx_cache_data, std::pair<std::map<std::pair<uint64_t, uint64_t>, size_t>, std::map<std::pair<std::array<char, 32>, size_t>, size_t>> *output_tracker_cache = NULL);
1402  bool should_skip_block(const cryptonote::block &b, uint64_t height) const;
1403  void process_new_blockchain_entry(const cryptonote::block& b, const cryptonote::block_complete_entry& bche, const parsed_block &parsed_block, const crypto::hash& bl_id, uint64_t height, const std::vector<tx_cache_data> &tx_cache_data, size_t tx_cache_data_offset, std::pair<std::map<std::pair<uint64_t, uint64_t>, size_t>, std::map<std::pair<std::array<char, 32>, size_t>, size_t>> *output_tracker_cache = NULL);
1404  void detach_blockchain(uint64_t height, std::pair<std::map<std::pair<uint64_t, uint64_t>, size_t>, std::map<std::pair<std::array<char, 32>, size_t>, size_t>> *output_tracker_cache = NULL);
1405  void get_short_chain_history(std::list<crypto::hash>& ids, uint64_t granularity = 1) const;
1406  bool clear();
1407  void clear_soft(bool keep_key_images=false);
1408  void pull_blocks(uint64_t start_height, uint64_t& blocks_start_height, const std::list<crypto::hash> &short_chain_history, std::vector<cryptonote::block_complete_entry> &blocks, std::vector<cryptonote::COMMAND_RPC_GET_BLOCKS_FAST::block_output_indices> &o_indices);
1409  void pull_hashes(uint64_t start_height, uint64_t& blocks_start_height, const std::list<crypto::hash> &short_chain_history, std::vector<crypto::hash> &hashes);
1410  void fast_refresh(uint64_t stop_height, uint64_t &blocks_start_height, std::list<crypto::hash> &short_chain_history, bool force = false);
1411  void pull_and_parse_next_blocks(uint64_t start_height, uint64_t &blocks_start_height, std::list<crypto::hash> &short_chain_history, const std::vector<cryptonote::block_complete_entry> &prev_blocks, const std::vector<parsed_block> &prev_parsed_blocks, std::vector<cryptonote::block_complete_entry> &blocks, std::vector<parsed_block> &parsed_blocks, bool &error);
1412  void process_parsed_blocks(uint64_t start_height, const std::vector<cryptonote::block_complete_entry> &blocks, const std::vector<parsed_block> &parsed_blocks, uint64_t& blocks_added, std::pair<std::map<std::pair<uint64_t, uint64_t>, size_t>, std::map<std::pair<std::array<char, 32>, size_t>, size_t>> *output_tracker_cache = NULL);
1413  uint64_t select_transfers(uint64_t needed_etn, std::vector<size_t> unused_transfers_indices, std::vector<size_t>& selected_transfers) const;
1414  bool prepare_file_names(const std::string& file_path);
1415  void process_unconfirmed(const crypto::hash &txid, const cryptonote::transaction& tx, uint64_t height);
1416  void process_outgoing(const crypto::hash &txid, const cryptonote::transaction& tx, uint64_t height, uint64_t ts, uint64_t spent, uint64_t received, uint32_t subaddr_account, const std::set<uint32_t>& subaddr_indices);
1417  void add_unconfirmed_tx(const cryptonote::transaction& tx, uint64_t amount_in, const std::vector<cryptonote::tx_destination_entry> &dests, const crypto::hash &payment_id, uint64_t change_amount, uint32_t subaddr_account, const std::set<uint32_t>& subaddr_indices);
1418  void generate_genesis(cryptonote::block& b) const;
1419  void check_genesis(const crypto::hash& genesis_hash) const; //throws
1420  bool generate_chacha_key_from_secret_keys(crypto::chacha_key &key) const;
1421  void generate_chacha_key_from_password(const epee::wipeable_string &pass, crypto::chacha_key &key) const;
1422  crypto::hash get_payment_id(const pending_tx &ptx) const;
1423  void check_acc_out_precomp(const cryptonote::tx_out &o, const crypto::key_derivation &derivation, const std::vector<crypto::key_derivation> &additional_derivations, size_t i, tx_scan_info_t &tx_scan_info) const;
1424  void check_acc_out_precomp(const cryptonote::tx_out &o, const crypto::key_derivation &derivation, const std::vector<crypto::key_derivation> &additional_derivations, size_t i, const is_out_data *is_out_data, tx_scan_info_t &tx_scan_info) const;
1425  void check_acc_out_precomp_once(const cryptonote::tx_out &o, const crypto::key_derivation &derivation, const std::vector<crypto::key_derivation> &additional_derivations, size_t i, const is_out_data *is_out_data, tx_scan_info_t &tx_scan_info, bool &already_seen) const;
1426  void parse_block_round(const cryptonote::blobdata &blob, cryptonote::block &bl, crypto::hash &bl_id, bool &error) const;
1427  uint64_t get_upper_transaction_weight_limit() const;
1428  std::vector<uint64_t> get_unspent_amounts_vector() const;
1429  uint64_t get_dynamic_base_fee_estimate() const;
1430  float get_output_relatedness(const transfer_details &td0, const transfer_details &td1) const;
1431  std::vector<size_t> pick_preferred_rct_inputs(uint64_t needed_etn, uint32_t subaddr_account, const std::set<uint32_t> &subaddr_indices) const;
1432  void set_spent(size_t idx, uint64_t height, bool public_out = false);
1433  void set_unspent(size_t idx, bool public_out = false);
1434  void get_outs(std::vector<std::vector<get_outs_entry>> &outs, const std::vector<size_t> &selected_transfers, size_t fake_outputs_count, const uint8_t tx_version);
1435  bool tx_add_fake_output(std::vector<std::vector<tools::wallet2::get_outs_entry>> &outs, uint64_t global_index, const crypto::public_key& tx_public_key, const rct::key& mask, uint64_t real_index, bool unlocked) const;
1436  bool should_pick_a_second_output(bool use_rct, size_t n_transfers, const std::vector<size_t> &unused_transfers_indices, const std::vector<size_t> &unused_dust_indices) const;
1437  std::vector<size_t> get_only_rct(const std::vector<size_t> &unused_dust_indices, const std::vector<size_t> &unused_transfers_indices) const;
1438  void scan_output(const cryptonote::transaction &tx, bool miner_tx, const crypto::public_key &tx_pub_key, size_t i, tx_scan_info_t &tx_scan_info, int &num_vouts_received, std::unordered_map<cryptonote::subaddress_index, uint64_t> &tx_etn_got_in_outs, std::vector<size_t> &outs, bool pool);
1439  void trim_hashchain();
1440  crypto::key_image get_multisig_composite_key_image(size_t n) const;
1441  rct::multisig_kLRki get_multisig_composite_kLRki(size_t n, const std::unordered_set<crypto::public_key> &ignore_set, std::unordered_set<rct::key> &used_L, std::unordered_set<rct::key> &new_used_L) const;
1442  rct::multisig_kLRki get_multisig_kLRki(size_t n, const rct::key &k) const;
1443  rct::key get_multisig_k(size_t idx, const std::unordered_set<rct::key> &used_L) const;
1444  void update_multisig_rescan_info(const std::vector<std::vector<rct::key>> &multisig_k, const std::vector<std::vector<tools::wallet2::multisig_info>> &info, size_t n);
1445  bool add_rings(const crypto::chacha_key &key, const cryptonote::transaction_prefix &tx);
1446  bool add_rings(const cryptonote::transaction_prefix &tx);
1447  bool remove_rings(const cryptonote::transaction_prefix &tx);
1448  bool get_ring(const crypto::chacha_key &key, const crypto::key_image &key_image, std::vector<uint64_t> &outs);
1449  crypto::chacha_key get_ringdb_key();
1450  void setup_keys(const epee::wipeable_string &password);
1451  size_t get_transfer_details(const crypto::key_image &ki) const;
1452 
1453  void register_devices();
1454  hw::device& lookup_device(const std::string & device_descriptor);
1455 
1456  bool get_rct_distribution(uint64_t &start_height, std::vector<uint64_t> &distribution);
1457 
1458  uint64_t get_segregation_fork_height() const;
1459  void unpack_multisig_info(const std::vector<std::string>& info,
1460  std::vector<crypto::public_key> &public_keys,
1461  std::vector<crypto::secret_key> &secret_keys) const;
1462  bool unpack_extra_multisig_info(const std::vector<std::string>& info,
1463  std::vector<crypto::public_key> &signers,
1464  std::unordered_set<crypto::public_key> &pkeys) const;
1465 
1466  // This caches pubkeys (stealths) only and nothing to do with whether we own an output. Typically ran in a new thread whilst the wallet deals with new blocks (and tx) one by one.
1467  void cache_tx_data(const cryptonote::transaction& tx, const crypto::hash &txid, tx_cache_data &tx_cache_data) const;
1468  //it is a pair of maps: one is (amount, global idx):m_transfers index and the other is (tx hash, relative out index):m_transfers index
1469  std::shared_ptr<std::pair<std::map<std::pair<uint64_t, uint64_t>, size_t>, std::map<std::pair<std::array<char, 32>, size_t>, size_t>>> create_output_tracker_cache() const;
1470 
1471  void init_type(hw::device::device_type device_type);
1472  void setup_new_blockchain();
1473  void create_keys_file(const std::string &wallet_, bool watch_only, const epee::wipeable_string &password, bool create_address_file);
1474 
1475  wallet_device_callback * get_device_callback();
1476  void on_device_button_request(uint64_t code);
1477  void on_device_button_pressed();
1478  boost::optional<epee::wipeable_string> on_device_pin_request();
1479  boost::optional<epee::wipeable_string> on_device_passphrase_request(bool on_device);
1480  void on_device_progress(const hw::device_progress& event);
1481 
1482  std::string get_rpc_status(const std::string &s) const;
1483  void throw_on_rpc_response_error(const boost::optional<std::string> &status, const char *method) const;
1484 
1485  cryptonote::blobdata get_pruned_tx_blob(const cryptonote::blobdata &blobdata);
1486 
1487 
1488  cryptonote::account_base m_account;
1489  boost::optional<epee::net_utils::http::login> m_daemon_login;
1490  std::string m_daemon_address;
1491  std::string m_wallet_file;
1492  std::string m_keys_file;
1493  std::string m_mms_file;
1495  hashchain m_blockchain;
1496  std::unordered_map<crypto::hash, unconfirmed_transfer_details> m_unconfirmed_txs;
1497  std::unordered_map<crypto::hash, confirmed_transfer_details> m_confirmed_txs;
1498  std::unordered_multimap<crypto::hash, pool_payment_details> m_unconfirmed_payments;
1499  std::unordered_map<crypto::hash, crypto::secret_key> m_tx_keys;
1500  cryptonote::checkpoints m_checkpoints;
1501  uint64_t fallback_to_pow_checkpoint_height;
1502  std::string fallback_to_pow_checkpoint_hash;
1503  std::unordered_map<crypto::hash, std::vector<crypto::secret_key>> m_additional_tx_keys;
1504 
1505  transfer_container m_transfers;
1506  payment_container m_payments;
1507  std::unordered_map<crypto::key_image, size_t> m_key_images;
1508  std::unordered_map<crypto::public_key, size_t> m_pub_keys;
1509  std::unordered_map<std::pair<crypto::hash, size_t>, size_t, boost::hash<std::pair<crypto::hash, size_t>>> m_chainstate_indexes; // map of chainstate identifier (txhash, relative out index) to 'm_transfers index'
1510  cryptonote::account_public_address m_account_public_address;
1511  std::unordered_map<crypto::public_key, cryptonote::subaddress_index> m_subaddresses;
1512  std::vector<std::vector<std::string>> m_subaddress_labels;
1513  std::unordered_map<crypto::hash, std::string> m_tx_notes;
1514  std::unordered_map<std::string, std::string> m_attributes;
1515  std::vector<tools::wallet2::address_book_row> m_address_book;
1516  std::pair<std::map<std::string, std::string>, std::vector<std::string>> m_account_tags;
1517  uint64_t m_upper_transaction_weight_limit; //TODO: auto-calc this value or request from daemon, now use some fixed value
1518  const std::vector<std::vector<tools::wallet2::multisig_info>> *m_multisig_rescan_info;
1519  const std::vector<std::vector<rct::key>> *m_multisig_rescan_k;
1520  std::unordered_map<crypto::public_key, crypto::key_image> m_cold_key_images;
1521 
1522  std::atomic<bool> m_run;
1523 
1524  boost::recursive_mutex m_daemon_rpc_mutex;
1525 
1526  bool m_trusted_daemon;
1527  i_wallet2_callback* m_callback;
1528  hw::device::device_type m_key_device_type;
1529  cryptonote::network_type m_nettype;
1530  uint64_t m_kdf_rounds;
1531  std::string seed_language;
1532  bool is_old_file_format;
1533  bool m_watch_only;
1534  bool m_multisig;
1535  uint32_t m_multisig_threshold;
1536  std::vector<crypto::public_key> m_multisig_signers;
1537  //in case of general M/N multisig wallet we should perform N - M + 1 key exchange rounds and remember how many rounds are passed.
1538  uint32_t m_multisig_rounds_passed;
1539  std::vector<crypto::public_key> m_multisig_derivations;
1540  bool m_always_confirm_transfers;
1541  bool m_print_ring_members;
1542  bool m_store_tx_info;
1543  uint32_t m_default_mixin;
1544  uint32_t m_default_priority;
1545  RefreshType m_refresh_type;
1546  bool m_auto_refresh;
1547  bool m_first_refresh_done;
1548  uint64_t m_refresh_from_block_height;
1549  // If m_refresh_from_block_height is explicitly set to zero we need this to differentiate it from the case that
1550  // m_refresh_from_block_height was defaulted to zero.*/
1551  bool m_explicit_refresh_from_block_height;
1552  bool m_confirm_missing_payment_id;
1553  bool m_confirm_non_default_ring_size;
1554  AskPasswordType m_ask_password;
1555  uint32_t m_min_output_count;
1556  uint64_t m_min_output_value;
1557  bool m_merge_destinations;
1558  bool m_confirm_backlog;
1559  uint32_t m_confirm_backlog_threshold;
1560  bool m_confirm_export_overwrite;
1561  bool m_auto_low_priority;
1562  bool m_segregate_pre_fork_outputs;
1563  bool m_key_reuse_mitigation2;
1564  uint64_t m_segregation_height;
1565  bool m_ignore_fractional_outputs;
1566  bool m_track_uses;
1567  BackgroundMiningSetupType m_setup_background_mining;
1568  bool m_is_initialized;
1569  NodeRPCProxy m_node_rpc_proxy;
1570  std::unordered_set<crypto::hash> m_scanned_pool_txs[2];
1571  size_t m_subaddress_lookahead_major, m_subaddress_lookahead_minor;
1572  std::string m_device_name;
1573  std::string m_device_derivation_path;
1574  uint64_t m_device_last_key_image_sync;
1575  bool m_use_dns;
1576  bool m_offline;
1577 
1578  // Aux transaction data from device
1579  std::unordered_map<crypto::hash, std::string> m_tx_device;
1580 
1581  // Light wallet
1582  bool m_light_wallet; /* sends view key to daemon for scanning */
1583  uint64_t m_light_wallet_scanned_block_height;
1584  uint64_t m_light_wallet_blockchain_height;
1585  uint64_t m_light_wallet_per_kb_fee = FEE_PER_KB;
1586  bool m_light_wallet_connected;
1587  uint64_t m_light_wallet_balance;
1588  uint64_t m_light_wallet_unlocked_balance;
1589  // Light wallet info needed to populate m_payment requires 2 separate api calls (get_address_txs and get_unspent_outs)
1590  // We save the info from the first call in m_light_wallet_address_txs for easier lookup.
1591  std::unordered_map<crypto::hash, address_tx> m_light_wallet_address_txs;
1592  // store calculated key image for faster lookup
1593  std::unordered_map<crypto::public_key, std::map<uint64_t, crypto::key_image> > m_key_image_cache;
1594 
1595  std::string m_ring_database;
1596  bool m_ring_history_saved;
1597  std::unique_ptr<ringdb> m_ringdb;
1598  boost::optional<crypto::chacha_key> m_ringdb_key;
1599 
1600  uint64_t m_last_block_reward;
1601  std::unique_ptr<tools::file_locker> m_keys_file_locker;
1602 
1603  mms::message_store m_message_store;
1604  bool m_original_keys_available;
1605  cryptonote::account_public_address m_original_address;
1606  crypto::secret_key m_original_view_secret_key;
1607 
1608  crypto::chacha_key m_cache_key;
1609  boost::optional<epee::wipeable_string> m_encrypt_keys_after_refresh;
1610 
1611  bool m_unattended;
1612  bool m_devices_registered;
1613 
1614  std::shared_ptr<tools::Notify> m_tx_notify;
1615  std::unique_ptr<wallet_device_callback> m_device_callback;
1616 
1617  bool m_display_progress_indicator;
1618 
1619  uint32_t m_account_major_offset;
1620  };
1621 }
1623 BOOST_CLASS_VERSION(tools::wallet2::transfer_details, 12)
1624 BOOST_CLASS_VERSION(tools::wallet2::multisig_info, 1)
1625 BOOST_CLASS_VERSION(tools::wallet2::multisig_info::LR, 0)
1626 BOOST_CLASS_VERSION(tools::wallet2::multisig_tx_set, 1)
1627 BOOST_CLASS_VERSION(tools::wallet2::payment_details, 4)
1628 BOOST_CLASS_VERSION(tools::wallet2::pool_payment_details, 1)
1629 BOOST_CLASS_VERSION(tools::wallet2::unconfirmed_transfer_details, 8)
1630 BOOST_CLASS_VERSION(tools::wallet2::confirmed_transfer_details, 8)
1631 BOOST_CLASS_VERSION(tools::wallet2::address_book_row, 17)
1632 BOOST_CLASS_VERSION(tools::wallet2::reserve_proof_entry, 0)
1634 BOOST_CLASS_VERSION(tools::wallet2::signed_tx_set, 1)
1636 BOOST_CLASS_VERSION(tools::wallet2::pending_tx, 3)
1637 BOOST_CLASS_VERSION(tools::wallet2::multisig_sig, 0)
1638 
1639 namespace boost
1640 {
1641  namespace serialization
1642  {
1643  template <class Archive>
1644  inline typename std::enable_if<!Archive::is_loading::value, void>::type initialize_transfer_details(Archive &a, tools::wallet2::transfer_details &x, const boost::serialization::version_type ver)
1645  {
1646  }
1647  template <class Archive>
1648  inline typename std::enable_if<Archive::is_loading::value, void>::type initialize_transfer_details(Archive &a, tools::wallet2::transfer_details &x, const boost::serialization::version_type ver)
1649  {
1650  if (ver < 1)
1651  {
1652  x.m_mask = rct::identity();
1653  x.m_amount = x.m_tx.vout[x.m_internal_output_index].amount;
1654  }
1655  if (ver < 2)
1656  {
1657  x.m_spent_height = 0;
1658  }
1659  if (ver < 4)
1660  {
1661  x.m_rct = x.m_tx.vout[x.m_internal_output_index].amount == 0;
1662  }
1663  if (ver < 6)
1664  {
1665  x.m_key_image_known = true;
1666  }
1667  if (ver < 7)
1668  {
1669  x.m_pk_index = 0;
1670  }
1671  if (ver < 8)
1672  {
1673  x.m_subaddr_index = {};
1674  }
1675  if (ver < 9)
1676  {
1677  x.m_key_image_partial = false;
1678  x.m_multisig_k.clear();
1679  x.m_multisig_info.clear();
1680  }
1681  if (ver < 10)
1682  {
1683  x.m_key_image_request = false;
1684  }
1685  if (ver < 12)
1686  {
1687  x.m_frozen = false;
1688  }
1689  }
1690 
1691  template <class Archive>
1692  inline void serialize(Archive &a, tools::wallet2::transfer_details &x, const boost::serialization::version_type ver)
1693  {
1694  a & x.m_block_height;
1697  if (ver < 3)
1698  {
1700  a & tx;
1701  x.m_tx = (const cryptonote::transaction_prefix&)tx;
1703  }
1704  else
1705  {
1706  a & x.m_tx;
1707  }
1708  a & x.m_spent;
1709  a & x.m_key_image;
1710  if (ver < 1)
1711  {
1712  // ensure mask and amount are set
1713  initialize_transfer_details(a, x, ver);
1714  return;
1715  }
1716  a & x.m_mask;
1717  a & x.m_amount;
1718  if (ver < 2)
1719  {
1720  initialize_transfer_details(a, x, ver);
1721  return;
1722  }
1723  a & x.m_spent_height;
1724  if (ver < 3)
1725  {
1726  initialize_transfer_details(a, x, ver);
1727  return;
1728  }
1729  a & x.m_txid;
1730  if (ver < 4)
1731  {
1732  initialize_transfer_details(a, x, ver);
1733  return;
1734  }
1735  a & x.m_rct;
1736  if (ver < 5)
1737  {
1738  initialize_transfer_details(a, x, ver);
1739  return;
1740  }
1741  if (ver < 6)
1742  {
1743  // v5 did not properly initialize
1744  uint8_t u;
1745  a & u;
1746  x.m_key_image_known = true;
1747  return;
1748  }
1749  a & x.m_key_image_known;
1750  if (ver < 7)
1751  {
1752  initialize_transfer_details(a, x, ver);
1753  return;
1754  }
1755  a & x.m_pk_index;
1756  if (ver < 8)
1757  {
1758  initialize_transfer_details(a, x, ver);
1759  return;
1760  }
1761  a & x.m_subaddr_index;
1762  if (ver < 9)
1763  {
1764  initialize_transfer_details(a, x, ver);
1765  return;
1766  }
1767  a & x.m_multisig_info;
1768  a & x.m_multisig_k;
1769  a & x.m_key_image_partial;
1770  if (ver < 10)
1771  {
1772  initialize_transfer_details(a, x, ver);
1773  return;
1774  }
1775  a & x.m_key_image_request;
1776  if (ver < 11)
1777  {
1778  initialize_transfer_details(a, x, ver);
1779  return;
1780  }
1781  a & x.m_uses;
1782  if (ver < 12)
1783  {
1784  initialize_transfer_details(a, x, ver);
1785  return;
1786  }
1787  a & x.m_frozen;
1788  }
1789 
1790  template <class Archive>
1791  inline void serialize(Archive &a, tools::wallet2::multisig_info::LR &x, const boost::serialization::version_type ver)
1792  {
1793  a & x.m_L;
1794  a & x.m_R;
1795  }
1796 
1797  template <class Archive>
1798  inline void serialize(Archive &a, tools::wallet2::multisig_info &x, const boost::serialization::version_type ver)
1799  {
1800  a & x.m_signer;
1801  a & x.m_LR;
1802  a & x.m_partial_key_images;
1803  }
1804 
1805  template <class Archive>
1806  inline void serialize(Archive &a, tools::wallet2::multisig_tx_set &x, const boost::serialization::version_type ver)
1807  {
1808  a & x.m_ptx;
1809  a & x.m_signers;
1810  }
1811 
1812  template <class Archive>
1813  inline void serialize(Archive &a, tools::wallet2::unconfirmed_transfer_details &x, const boost::serialization::version_type ver)
1814  {
1815  a & x.m_change;
1816  a & x.m_sent_time;
1817  if (ver < 5)
1818  {
1820  a & tx;
1821  x.m_tx = (const cryptonote::transaction_prefix&)tx;
1822  }
1823  else
1824  {
1825  a & x.m_tx;
1826  }
1827  if (ver < 1)
1828  return;
1829  a & x.m_dests;
1830  a & x.m_payment_id;
1831  if (ver < 2)
1832  return;
1833  a & x.m_state;
1834  if (ver < 3)
1835  return;
1836  a & x.m_timestamp;
1837  if (ver < 4)
1838  return;
1839  a & x.m_amount_in;
1840  a & x.m_amount_out;
1841  if (ver < 6)
1842  {
1843  // v<6 may not have change accumulated in m_amount_out, which is a pain,
1844  // as it's readily understood to be sum of outputs.
1845  // We convert it to include change from v6
1846  if (!typename Archive::is_saving() && x.m_change != (uint64_t)-1)
1847  x.m_amount_out += x.m_change;
1848  }
1849  if (ver < 7)
1850  {
1851  x.m_subaddr_account = 0;
1852  return;
1853  }
1854  a & x.m_subaddr_account;
1855  a & x.m_subaddr_indices;
1856  if (ver < 8)
1857  return;
1858  a & x.m_rings;
1859  }
1860 
1861  template <class Archive>
1862  inline void serialize(Archive &a, tools::wallet2::confirmed_transfer_details &x, const boost::serialization::version_type ver)
1863  {
1864  a & x.m_amount_in;
1865  a & x.m_amount_out;
1866  a & x.m_change;
1867  a & x.m_block_height;
1868  if (ver < 1)
1869  return;
1870  a & x.m_dests;
1871  a & x.m_payment_id;
1872  if (ver < 2)
1873  return;
1874  a & x.m_timestamp;
1875  if (ver < 3)
1876  {
1877  // v<3 may not have change accumulated in m_amount_out, which is a pain,
1878  // as it's readily understood to be sum of outputs. Whether it got added
1879  // or not depends on whether it came from a unconfirmed_transfer_details
1880  // (not included) or not (included). We can't reliably tell here, so we
1881  // check whether either yields a "negative" fee, or use the other if so.
1882  // We convert it to include change from v3
1883  if (!typename Archive::is_saving() && x.m_change != (uint64_t)-1)
1884  {
1885  if (x.m_amount_in > (x.m_amount_out + x.m_change))
1886  x.m_amount_out += x.m_change;
1887  }
1888  }
1889  if (ver < 4)
1890  {
1891  if (!typename Archive::is_saving())
1892  x.m_unlock_time = 0;
1893  return;
1894  }
1895  a & x.m_unlock_time;
1896  if (ver < 5)
1897  {
1898  x.m_subaddr_account = 0;
1899  return;
1900  }
1901  a & x.m_subaddr_account;
1902  a & x.m_subaddr_indices;
1903  if (ver < 6)
1904  return;
1905  a & x.m_rings;
1906  if(ver < 7)
1907  return;
1908  a & x.m_is_migration;
1909  if(ver < 8)
1910  return;
1911  a & x.m_is_sc_migration;
1912  }
1913 
1914  template <class Archive>
1915  inline void serialize(Archive& a, tools::wallet2::payment_details& x, const boost::serialization::version_type ver)
1916  {
1917  a & x.m_tx_hash;
1918  a & x.m_amount;
1919  a & x.m_block_height;
1920  a & x.m_unlock_time;
1921  if (ver < 1)
1922  return;
1923  a & x.m_timestamp;
1924  if (ver < 2)
1925  {
1926  x.m_coinbase = false;
1927  x.m_subaddr_index = {};
1928  return;
1929  }
1930  a & x.m_subaddr_index;
1931  if (ver < 3)
1932  {
1933  x.m_coinbase = false;
1934  x.m_fee = 0;
1935  return;
1936  }
1937  a & x.m_fee;
1938  if (ver < 4)
1939  {
1940  x.m_coinbase = false;
1941  return;
1942  }
1943  a & x.m_coinbase;
1944  }
1945 
1946  template <class Archive>
1947  inline void serialize(Archive& a, tools::wallet2::pool_payment_details& x, const boost::serialization::version_type ver)
1948  {
1949  a & x.m_pd;
1950  a & x.m_double_spend_seen;
1952  }
1953 
1954  template <class Archive>
1955  inline void serialize(Archive& a, tools::wallet2::address_book_row& x, const boost::serialization::version_type ver)
1956  {
1957  a & x.m_address;
1958  a & x.m_payment_id;
1959  a & x.m_description;
1960  if (ver < 17)
1961  {
1962  x.m_is_subaddress = false;
1963  return;
1964  }
1965  a & x.m_is_subaddress;
1966  }
1967 
1968  template <class Archive>
1969  inline void serialize(Archive& a, tools::wallet2::reserve_proof_entry& x, const boost::serialization::version_type ver)
1970  {
1971  a & x.txid;
1972  a & x.index_in_tx;
1973  a & x.shared_secret;
1974  a & x.key_image;
1975  a & x.shared_secret_sig;
1976  a & x.key_image_sig;
1977  }
1978 
1979  template <class Archive>
1980  inline void serialize(Archive &a, tools::wallet2::unsigned_tx_set &x, const boost::serialization::version_type ver)
1981  {
1982  a & x.txes;
1983  a & x.transfers;
1984  }
1985 
1986  template <class Archive>
1987  inline void serialize(Archive &a, tools::wallet2::signed_tx_set &x, const boost::serialization::version_type ver)
1988  {
1989  a & x.ptx;
1990  a & x.key_images;
1991  if (ver < 1)
1992  return;
1993  a & x.tx_key_images;
1994  }
1995 
1996  template <class Archive>
1997  inline void serialize(Archive &a, tools::wallet2::tx_construction_data &x, const boost::serialization::version_type ver)
1998  {
1999  a & x.sources;
2000  a & x.change_dts;
2001  a & x.splitted_dsts;
2002  if (ver < 2)
2003  {
2004  // load list to vector
2005  std::list<size_t> selected_transfers;
2006  a & selected_transfers;
2007  x.selected_transfers.clear();
2008  x.selected_transfers.reserve(selected_transfers.size());
2009  for (size_t t: selected_transfers)
2010  x.selected_transfers.push_back(t);
2011  }
2012  a & x.extra;
2013  a & x.unlock_time;
2014  a & x.use_rct;
2015  a & x.dests;
2016  if (ver < 1)
2017  {
2018  x.subaddr_account = 0;
2019  return;
2020  }
2021  a & x.subaddr_account;
2022  a & x.subaddr_indices;
2023  if (ver < 2)
2024  {
2025  if (!typename Archive::is_saving())
2027  return;
2028  }
2029  a & x.selected_transfers;
2030  if (ver < 3)
2031  {
2032  if (!typename Archive::is_saving())
2034  return;
2035  }
2036  if (ver < 4)
2037  {
2038  bool use_bulletproofs = x.rct_config.range_proof_type != rct::RangeProofBorromean;
2039  a & use_bulletproofs;
2040  if (!typename Archive::is_saving())
2041  x.rct_config = { use_bulletproofs ? rct::RangeProofBulletproof : rct::RangeProofBorromean, 0 };
2042  return;
2043  }
2044  a & x.rct_config;
2045  }
2046 
2047  template <class Archive>
2048  inline void serialize(Archive &a, tools::wallet2::multisig_sig &x, const boost::serialization::version_type ver)
2049  {
2050  a & x.sigs;
2051  a & x.ignore;
2052  a & x.used_L;
2053  a & x.signing_keys;
2054  a & x.msout;
2055  }
2056 
2057  template <class Archive>
2058  inline void serialize(Archive &a, tools::wallet2::pending_tx &x, const boost::serialization::version_type ver)
2059  {
2060  a & x.tx;
2061  a & x.dust;
2062  a & x.fee;
2063  a & x.dust_added_to_fee;
2064  a & x.change_dts;
2065  if (ver < 2)
2066  {
2067  // load list to vector
2068  std::list<size_t> selected_transfers;
2069  a & selected_transfers;
2070  x.selected_transfers.clear();
2071  x.selected_transfers.reserve(selected_transfers.size());
2072  for (size_t t: selected_transfers)
2073  x.selected_transfers.push_back(t);
2074  }
2075  a & x.key_images;
2076  a & x.tx_key;
2077  a & x.dests;
2078  a & x.construction_data;
2079  if (ver < 1)
2080  return;
2081  a & x.additional_tx_keys;
2082  if (ver < 2)
2083  return;
2084  a & x.selected_transfers;
2085  if (ver < 3)
2086  return;
2087  a & x.multisig_sigs;
2088  }
2089  }
2090 }
2091 
2092 namespace tools
2093 {
2094 
2095  namespace detail
2096  {
2097  //----------------------------------------------------------------------------------------------------
2098  inline void digit_split_strategy(const std::vector<cryptonote::tx_destination_entry>& dsts,
2099  const cryptonote::tx_destination_entry& change_dst, uint64_t dust_threshold,
2100  std::vector<cryptonote::tx_destination_entry>& splitted_dsts, std::vector<cryptonote::tx_destination_entry> &dust_dsts)
2101  {
2102  splitted_dsts.clear();
2103  dust_dsts.clear();
2104 
2105  for(auto& de: dsts)
2106  {
2108  [&](uint64_t chunk) { splitted_dsts.push_back(cryptonote::tx_destination_entry(chunk, de.addr, de.is_subaddress)); },
2109  [&](uint64_t a_dust) { splitted_dsts.push_back(cryptonote::tx_destination_entry(a_dust, de.addr, de.is_subaddress)); } );
2110  }
2111 
2113  [&](uint64_t chunk) {
2114  if (chunk <= dust_threshold)
2115  dust_dsts.push_back(cryptonote::tx_destination_entry(chunk, change_dst.addr, change_dst.is_subaddress));
2116  else
2117  splitted_dsts.push_back(cryptonote::tx_destination_entry(chunk, change_dst.addr, change_dst.is_subaddress));
2118  },
2119  [&](uint64_t a_dust) { dust_dsts.push_back(cryptonote::tx_destination_entry(a_dust, change_dst.addr, change_dst.is_subaddress)); } );
2120  }
2121  //----------------------------------------------------------------------------------------------------
2122  inline void null_split_strategy(const std::vector<cryptonote::tx_destination_entry>& dsts,
2123  const cryptonote::tx_destination_entry& change_dst, uint64_t dust_threshold,
2124  std::vector<cryptonote::tx_destination_entry>& splitted_dsts, std::vector<cryptonote::tx_destination_entry> &dust_dsts)
2125  {
2126  splitted_dsts = dsts;
2127 
2128  dust_dsts.clear();
2129  uint64_t change = change_dst.amount;
2130 
2131  if (0 != change)
2132  {
2133  splitted_dsts.push_back(cryptonote::tx_destination_entry(change, change_dst.addr, false));
2134  }
2135  }
2136  //----------------------------------------------------------------------------------------------------
2138  {
2139  std::string indexes;
2140  std::for_each(src.outputs.begin(), src.outputs.end(), [&](const cryptonote::tx_source_entry::output_entry& s_e) { indexes += boost::to_string(s_e.first) + " "; });
2141  LOG_PRINT_L0("amount=" << cryptonote::print_etn(src.amount) << ", real_output=" <<src.real_output << ", real_output_in_tx_index=" << src.real_output_in_tx_index << ", indexes: " << indexes);
2142  }
2143  //----------------------------------------------------------------------------------------------------
2144  }
2145  //----------------------------------------------------------------------------------------------------
2146 }
bool reconnect_device()
Definition: wallet2.cpp:1390
const char * res
Definition: hmac_keccak.cpp:41
uint64_t balance_all(bool public_blockchain) const
Definition: wallet2.cpp:6292
std::unordered_map< crypto::public_key, crypto::key_image > tx_key_images
Definition: wallet2.h:507
bool watch_only() const
Definition: wallet2.h:825
static bool parse_long_payment_id(const std::string &payment_id_str, crypto::hash &payment_id)
Definition: wallet2.cpp:5712
void rescan_spent()
Definition: wallet2.cpp:6417
std::vector< crypto::public_key > get_subaddress_spend_public_keys(uint32_t account, uint32_t begin, uint32_t end) const
void add_checkpoint(uint64_t height, std::string hash)
Definition: wallet2.cpp:13766
std::vector< crypto::key_image > key_images
Definition: wallet2.h:506
std::string get_reserve_proof(const boost::optional< std::pair< uint32_t, uint64_t >> &account_minreserve, const std::string &message)
Generates a proof that proves the reserve of unspent funds.
Definition: wallet2.cpp:11669
void get_unconfirmed_payments(std::list< std::pair< crypto::hash, wallet2::pool_payment_details >> &unconfirmed_payments, const boost::optional< uint32_t > &subaddr_account=boost::none, const std::set< uint32_t > &subaddr_indices={}) const
Definition: wallet2.cpp:6408
cryptonote::transaction tx
Definition: wallet2.h:466
crypto::chacha_iv iv
Definition: wallet2.h:523
AskPasswordType ask_password() const
Definition: wallet2.h:1079
bool sign_multisig_tx(multisig_tx_set &exported_txs, std::vector< crypto::hash > &txids)
Definition: wallet2.cpp:7607
void setup_background_mining(BackgroundMiningSetupType value)
Definition: wallet2.h:1108
void callback(i_wallet2_callback *callback)
Definition: wallet2.h:763
void set_tx_notify(const std::shared_ptr< tools::Notify > &notify)
Definition: wallet2.h:1377
bool invoke_http_bin(const boost::string_ref uri, const t_request &out_struct, t_response &result_struct, t_transport &transport, std::chrono::milliseconds timeout=std::chrono::seconds(15), const boost::string_ref method="GET")
const boost::optional< epee::net_utils::http::login > & get_daemon_login() const
Definition: wallet2.h:1165
const uint32_t T[512]
size_t get_num_subaddresses(uint32_t index_major) const
Definition: wallet2.h:802
const crypto::hash & operator[](size_t idx) const
Definition: wallet2.h:186
void get_payments(const crypto::hash &payment_id, std::list< wallet2::payment_details > &payments, uint64_t min_height=0, const boost::optional< uint32_t > &subaddr_account=boost::none, const std::set< uint32_t > &subaddr_indices={}) const
Definition: wallet2.cpp:6320
uint64_t unlocked_balance(uint32_t subaddr_index_major, bool public_blockchain, uint64_t *blocks_to_unlock=NULL) const
Definition: wallet2.cpp:6172
crypto::public_key get_tx_pub_key_from_received_outs(const tools::wallet2::transfer_details &td) const
Definition: wallet2.cpp:12143
cryptonote::blobdata export_multisig()
Definition: wallet2.cpp:12994
bool invoke_http_json(const boost::string_ref uri, const t_request &req, t_response &res, std::chrono::milliseconds timeout=std::chrono::seconds(15), const boost::string_ref http_method="GET")
Definition: wallet2.h:1319
bool get_seed(epee::wipeable_string &electrum_words, const epee::wipeable_string &passphrase=epee::wipeable_string()) const
Definition: wallet2.cpp:1301
payment_container export_payments() const
Definition: wallet2.cpp:12665
mms::multisig_wallet_state get_multisig_wallet_state() const
Definition: wallet2.cpp:13615
virtual boost::optional< epee::wipeable_string > on_device_passphrase_request(bool on_device)
Definition: wallet2.h:142
bool key_on_device() const
Definition: wallet2.h:830
void auto_low_priority(bool value)
Definition: wallet2.h:1094
bool frozen(size_t idx) const
Definition: wallet2.cpp:1598
void set_tx_device_aux(const crypto::hash &txid, const std::string &aux)
Definition: wallet2.cpp:12000
void commit_tx(pending_tx &ptx_vector)
Definition: wallet2.cpp:6887
static std::unique_ptr< wallet2 > make_dummy(const boost::program_options::variables_map &vm, bool unattended, const std::function< boost::optional< password_container >(const char *, bool)> &password_prompter)
Just parses variables.
Definition: wallet2.cpp:1261
virtual boost::optional< epee::wipeable_string > on_get_password(const char *reason)
Definition: wallet2.h:132
static std::string device_derivation_path_option(const boost::program_options::variables_map &vm)
Definition: wallet2.cpp:1188
cryptonote::subaddress_index m_subaddr_index
Definition: wallet2.h:362
bool ignore_fractional_outputs() const
Definition: wallet2.h:1101
uint64_t cold_key_image_sync(uint64_t &spent, uint64_t &unspent)
Definition: wallet2.cpp:10694
std::string get_tx_device_aux(const crypto::hash &txid) const
Definition: wallet2.cpp:12005
void trim(size_t height)
Definition: wallet2.h:191
const std::string & get_seed_language() const
Gets the seed language.
Definition: wallet2.cpp:1417
void confirm_non_default_ring_size(bool always)
Definition: wallet2.h:1104
std::pair< size_t, size_t > get_subaddress_lookahead() const
Definition: wallet2.h:808
bool is_output_blackballed(const std::pair< uint64_t, uint64_t > &output) const
Definition: wallet2.cpp:8206
static void wallet_exists(const std::string &file_path, bool &keys_file_exists, bool &wallet_file_exists)
Check if wallet keys and bin files exist.
Definition: wallet2.cpp:5697
cryptonote::subaddress_index m_subaddr_index
Definition: wallet2.h:318
const std::string get_ring_database() const
Definition: wallet2.h:1341
std::vector< size_t > select_available_unmixable_outputs()
Definition: wallet2.cpp:10858
void confirm_missing_payment_id(bool always)
Definition: wallet2.h:1078
void default_mixin(uint32_t m)
Definition: wallet2.h:1072
uint64_t get_approximate_blockchain_height() const
Calculates the approximate blockchain height from current date/time.
Definition: wallet2.cpp:11965
bool sign_tx(const std::string &unsigned_filename, const std::string &signed_filename, std::vector< wallet2::pending_tx > &ptx, std::function< bool(const unsigned_tx_set &)> accept_func=NULL, bool export_raw=false)
Definition: wallet2.cpp:7102
bool confirm_export_overwrite() const
Definition: wallet2.h:1091
boost::optional< epee::wipeable_string > on_passphrase_request(bool on_device) override
Definition: wallet2.cpp:1089
enum tools::wallet2::unconfirmed_transfer_details::@63 m_state
std::vector< cryptonote::tx_destination_entry > dests
Definition: wallet2.h:474
std::vector< crypto::secret_key > additional_tx_keys
Definition: wallet2.h:473
std::vector< rct::key > m_multisig_k
Definition: wallet2.h:320
std::vector< LR > m_LR
Definition: wallet2.h:278
size_t import_multisig(std::vector< cryptonote::blobdata > info)
Definition: wallet2.cpp:13067
int get_fee_algorithm() const
Definition: wallet2.cpp:7824
void auto_refresh(bool r)
Definition: wallet2.h:1076
crypto::public_key shared_secret
Definition: wallet2.h:556
::std::string string
Definition: gtest-port.h:1097
crypto::public_key get_multisig_signing_public_key(size_t idx) const
Definition: wallet2.cpp:12914
void device_derivation_path(const std::string &device_derivation_path)
Definition: wallet2.h:1112
CXA_THROW_INFO_T void(* dest)(void *))
Definition: stack_trace.cpp:91
epee::misc_utils::struct_init< response_t > response
POD_CLASS key_derivation
Definition: crypto.h:98
std::vector< std::pair< uint64_t, crypto::hash > > m_uses
Definition: wallet2.h:322
void get_hard_fork_info(uint8_t version, uint64_t &earliest_height) const
Definition: wallet2.cpp:10714
static bool query_device(hw::device::device_type &device_type, const std::string &keys_file_name, const epee::wipeable_string &password, uint64_t kdf_rounds=1)
determine the key storage for the specified wallet file
Definition: wallet2.cpp:4807
void merge_destinations(bool merge)
Definition: wallet2.h:1085
bool save_tx(const std::vector< pending_tx > &ptx_vector, const std::string &filename) const
Definition: wallet2.cpp:6975
std::string path() const
Definition: wallet2.cpp:6027
std::string print_etn(uint64_t amount, unsigned int decimal_point)
bool is_transfer_unlocked(const transfer_details &td) const
Definition: wallet2.cpp:6565
uint64_t balance(uint32_t subaddr_index_major, bool public_blockchain) const
Definition: wallet2.cpp:6162
std::vector< size_t > selected_transfers
Definition: wallet2.h:470
bool is_unattended() const
Definition: wallet2.h:1274
bool parse_uri(const std::string &uri, std::string &address, std::string &payment_id, uint64_t &amount, std::string &tx_description, std::string &recipient_name, std::vector< std::string > &unknown_parameters, std::string &error)
Definition: wallet2.cpp:13309
bool segregate_pre_fork_outputs() const
Definition: wallet2.h:1095
std::string sign(const std::string &data) const
Definition: wallet2.cpp:12076
bool invoke_http_json(const boost::string_ref uri, const t_request &out_struct, t_response &result_struct, t_transport &transport, std::chrono::milliseconds timeout=std::chrono::seconds(15), const boost::string_ref method="GET")
static constexpr const std::chrono::seconds rpc_timeout
Definition: wallet2.h:216
void decompose_amount_into_digits(uint64_t amount, uint64_t dust_threshold, const chunk_handler_t &chunk_handler, const dust_handler_t &dust_handler)
wallet2(cryptonote::network_type nettype=cryptonote::MAINNET, uint64_t kdf_rounds=1, bool unattended=false)
Definition: wallet2.cpp:1102
void decrypt_keys(const crypto::chacha_key &key)
Definition: wallet2.cpp:4752
bool check_connection(uint32_t *version=NULL, bool *ssl=NULL, uint32_t timeout=200000)
Definition: wallet2.cpp:5758
uint64_t height
Definition: blockchain.cpp:91
void stop()
Definition: wallet2.h:760
std::string exchange_multisig_keys(const epee::wipeable_string &password, const std::vector< std::string > &info)
Definition: wallet2.cpp:5280
virtual boost::optional< epee::wipeable_string > on_device_pin_request()
Definition: wallet2.h:141
const cryptonote::account_base & get_account() const
Definition: wallet2.h:735
bool is_synced() const
Definition: wallet2.cpp:13480
std::string key_images
Definition: wallet2.h:471
std::vector< cryptonote::transaction > txes
Definition: wallet2.h:568
boost::optional< cryptonote::subaddress_receive_info > received
Definition: wallet2.h:296
bool load_multisig_tx(cryptonote::blobdata blob, multisig_tx_set &exported_txs, std::function< bool(const multisig_tx_set &)> accept_func=NULL)
Definition: wallet2.cpp:7549
std::string get_daemon_address() const
Definition: wallet2.cpp:11926
void track_uses(bool value)
Definition: wallet2.h:1106
bool get_tx_key_cached(const crypto::hash &txid, crypto::secret_key &tx_key, std::vector< crypto::secret_key > &additional_tx_keys) const
Definition: wallet2.cpp:10911
const mms::message_store & get_message_store() const
Definition: wallet2.h:1368
bool invoke_http_json_rpc(const boost::string_ref uri, std::string method_name, const t_request &out_struct, t_response &result_struct, t_transport &transport, std::chrono::milliseconds timeout=std::chrono::seconds(15), const boost::string_ref http_method="GET", const std::string &req_id="0")
std::vector< wallet2::pending_tx > create_transactions_all(uint64_t below, const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector< uint8_t > &extra, uint32_t subaddr_account, std::set< uint32_t > subaddr_indices, const bool migrate=false)
Definition: wallet2.cpp:10359
std::string make_multisig(const epee::wipeable_string &password, const std::vector< std::string > &info, uint32_t threshold)
Creates a multisig wallet.
Definition: wallet2.cpp:5466
std::vector< pending_tx > ptx
Definition: wallet2.h:505
crypto::key_derivation derivation
Definition: wallet2.h:576
void refill(const crypto::hash &hash)
Definition: wallet2.h:192
void light_wallet_get_outs(std::vector< std::vector< get_outs_entry >> &outs, const std::vector< size_t > &selected_transfers, size_t fake_outputs_count)
Definition: wallet2.cpp:8268
uint64_t index_in_tx
Definition: wallet2.h:555
crypto::key_image ki
Definition: wallet2.h:291
const char * key
Definition: hmac_keccak.cpp:39
static std::pair< std::unique_ptr< wallet2 >, password_container > make_from_json(const boost::program_options::variables_map &vm, bool unattended, const std::string &json_file, const std::function< boost::optional< password_container >(const char *, bool)> &password_prompter)
Uses stdin and stdout. Returns a wallet2 if no errors.
Definition: wallet2.cpp:1227
cryptonote::tx_destination_entry change_dts
Definition: wallet2.h:423
void print_source_entry(const cryptonote::tx_source_entry &src)
Definition: wallet2.h:2137
#define LOG_PRINT_L0(x)
Definition: misc_log_ex.h:99
wallet_keys_unlocker(wallet2 &w, const boost::optional< tools::password_container > &password)
Definition: wallet2.cpp:1034
crypto namespace.
Definition: crypto.cpp:58
void store_tx_info(bool store)
Definition: wallet2.h:1070
STL namespace.
std::string get_keys_file() const
Definition: wallet2.cpp:11921
unsigned short uint16_t
Definition: stdint.h:125
Definition: wallet2.h:552
cryptonote::account_public_address m_address
Definition: wallet2.h:546
bool explicit_refresh_from_block_height() const
Definition: wallet2.h:746
Non-owning sequence of data. Does not deep copy.
Definition: span.h:56
std::vector< cryptonote::tx_destination_entry > m_dests
Definition: wallet2.h:400
bool load_tx(const std::string &signed_filename, std::vector< tools::wallet2::pending_tx > &ptx, std::function< bool(const signed_tx_set &)> accept_func=NULL)
Definition: wallet2.cpp:7321
void restore(const std::string &wallet_, const epee::wipeable_string &password, const std::string &device_name, bool create_address_file=false)
Restore a wallet hold by an HW.
Definition: wallet2.cpp:5110
#define FEE_PER_KB
bool confirm_non_default_ring_size() const
Definition: wallet2.h:1103
bool light_wallet() const
Checks if light wallet. A light wallet sends view key to a server where the blockchain is scanned...
Definition: wallet2.h:777
uint32_t account_major_offset() const
Definition: wallet2.h:811
mms::message_store & get_message_store()
Definition: wallet2.h:1367
void change_password(const std::string &filename, const epee::wipeable_string &original_password, const epee::wipeable_string &new_password)
Definition: wallet2.cpp:4320
std::unordered_multimap< crypto::hash, payment_details > payment_container
Definition: wallet2.h:450
void null_split_strategy(const std::vector< cryptonote::tx_destination_entry > &dsts, const cryptonote::tx_destination_entry &change_dst, uint64_t dust_threshold, std::vector< cryptonote::tx_destination_entry > &splitted_dsts, std::vector< cryptonote::tx_destination_entry > &dust_dsts)
Definition: wallet2.h:2122
const std::string & device_name() const
Definition: wallet2.h:1109
std::string get_spend_proof(const crypto::hash &txid, const std::string &message)
Definition: wallet2.cpp:11047
uint64_t get_light_wallet_scanned_block_height() const
Definition: wallet2.h:779
void get_unconfirmed_payments_out(std::list< std::pair< crypto::hash, wallet2::unconfirmed_transfer_details >> &unconfirmed_payments, const boost::optional< uint32_t > &subaddr_account=boost::none, const std::set< uint32_t > &subaddr_indices={}) const
Definition: wallet2.cpp:6396
bool light_wallet_get_address_info(tools::COMMAND_RPC_GET_ADDRESS_INFO::response &response)
Definition: wallet2.cpp:9438
void key_reuse_mitigation2(bool value)
Definition: wallet2.h:1098
unsigned char uint8_t
Definition: stdint.h:124
void on_progress(const hw::device_progress &event) override
Definition: wallet2.cpp:1096
cryptonote::network_type nettype() const
Definition: wallet2.h:824
virtual void on_lw_unconfirmed_etn_received(uint64_t height, const crypto::hash &txid, uint64_t amount)
Definition: wallet2.h:136
boost::optional< cryptonote::subaddress_index > get_subaddress_index(const cryptonote::account_public_address &address) const
Definition: wallet2.cpp:1437
uint64_t amount
std::vector< std::pair< uint64_t, uint64_t > > estimate_backlog(const std::vector< std::pair< double, double >> &fee_levels)
Definition: wallet2.cpp:13489
size_t import_outputs_from_str(const std::string &outputs_st)
Definition: wallet2.cpp:12828
std::vector< is_out_data > public_outs
Definition: wallet2.h:596
cryptonote::account_public_address addr_for_dust
Definition: wallet2.h:166
void add_subaddress_account(const std::string &label, const bool update_account_tags=true)
Definition: wallet2.cpp:1463
crypto::public_key pkey
Definition: wallet2.h:575
std::unordered_set< crypto::public_key > m_signers
Definition: wallet2.h:513
struct hash_func hashes[]
void get_payments_out(std::list< std::pair< crypto::hash, wallet2::confirmed_transfer_details >> &confirmed_payments, uint64_t min_height, uint64_t max_height=(uint64_t) -1, const boost::optional< uint32_t > &subaddr_account=boost::none, const std::set< uint32_t > &subaddr_indices={}) const
Definition: wallet2.cpp:6346
const std::pair< crypto::hash, size_t > get_chainstate_index() const
Definition: wallet2.h:327
void set_offline(bool offline=true)
Definition: wallet2.cpp:5810
void set_trusted_daemon(bool trusted)
Definition: wallet2.h:766
void set_attribute(const std::string &key, const std::string &value)
Definition: wallet2.cpp:12013
std::string get_tx_note(const crypto::hash &txid) const
Definition: wallet2.cpp:11992
void confirm_backlog(bool always)
Definition: wallet2.h:1088
size_t real_output
static std::string device_name_option(const boost::program_options::variables_map &vm)
Definition: wallet2.cpp:1183
bool load_multisig_tx_from_file(const std::string &filename, multisig_tx_set &exported_txs, std::function< bool(const multisig_tx_set &)> accept_func=NULL)
Definition: wallet2.cpp:7583
std::unordered_set< crypto::public_key > signing_keys
Definition: wallet2.h:457
static bool verify_extra_multisig_info(const std::string &data, std::unordered_set< crypto::public_key > &pkeys, crypto::public_key &signer)
Definition: wallet2.cpp:5586
uint64_t get_bytes_sent() const
Definition: wallet2.cpp:13756
bool key_reuse_mitigation2() const
Definition: wallet2.h:1097
bool print_ring_members() const
Definition: wallet2.h:1067
void set_seed_language(const std::string &language)
Sets the seed language.
Definition: wallet2.cpp:1425
BackgroundMiningSetupType
Definition: wallet2.h:231
virtual void on_device_button_pressed()
Definition: wallet2.h:140
uint64_t get_base_fee() const
Definition: wallet2.cpp:7785
static std::string get_human_readable_timestamp(uint64_t ts)
Check if wallet file path is valid format.
Definition: wallet2.h:1039
virtual void on_pool_tx_removed(const crypto::hash &txid)
Definition: wallet2.h:145
bool always_confirm_transfers() const
Definition: wallet2.h:1065
#define END_SERIALIZE()
self-explanatory
uint64_t import_key_images(const std::vector< std::pair< crypto::key_image, crypto::signature >> &signed_key_images, size_t offset, uint64_t &spent, uint64_t &unspent, bool check_spent=true)
Definition: wallet2.cpp:12333
const std::string & device_derivation_path() const
Definition: wallet2.h:1111
bool use_fork_rules(uint8_t version, int64_t early_blocks=0) const
Definition: wallet2.cpp:10720
uint32_t get_confirm_backlog_threshold() const
Definition: wallet2.h:1090
std::vector< cryptonote::tx_destination_entry > m_dests
Definition: wallet2.h:385
std::vector< cryptonote::tx_source_entry > sources
Definition: wallet2.h:422
void on_button_pressed() override
Definition: wallet2.cpp:1076
std::map< uint32_t, uint64_t > balance_per_subaddress(uint32_t subaddr_index_major, bool public_blockchain=false) const
Definition: wallet2.cpp:6188
std::vector< crypto::key_image > m_partial_key_images
Definition: wallet2.h:279
bool unblackball_output(const std::pair< uint64_t, uint64_t > &output)
Definition: wallet2.cpp:8198
bool is_in_bounds(size_t idx) const
Definition: wallet2.h:185
wallet_device_callback(wallet2 *wallet)
Definition: wallet2.h:152
bool has_multisig_partial_key_images() const
Definition: wallet2.cpp:5647
bool is_deprecated() const
Tells if the wallet file is deprecated.
Definition: wallet2.cpp:1546
std::vector< tx_construction_data > txes
Definition: wallet2.h:499
std::vector< is_out_data > primary
Definition: wallet2.h:589
Holds cryptonote related classes and helpers.
Definition: ban.cpp:40
uint64_t get_max_ring_size() const
Definition: wallet2.cpp:7851
bool light_wallet_login(bool &new_address)
Definition: wallet2.cpp:9240
bool light_wallet_parse_rct_str(const std::string &rct_string, const crypto::public_key &tx_pub_key, uint64_t internal_output_index, rct::key &decrypted_mask, rct::key &rct_commit, bool decrypt) const
Definition: wallet2.cpp:9642
std::vector< size_t > select_available_outputs_from_histogram(uint64_t count, bool atleast, bool unlocked, bool allow_rct)
Definition: wallet2.cpp:10792
virtual void on_skip_transaction(uint64_t height, const crypto::hash &txid, const cryptonote::transaction &tx)
Definition: wallet2.h:131
std::unordered_set< rct::key > used_L
Definition: wallet2.h:456
return true
const crypto::hash & genesis() const
Definition: wallet2.h:183
std::vector< wallet2::pending_tx > create_transactions_2(std::vector< cryptonote::tx_destination_entry > dsts, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector< uint8_t > &extra, uint32_t subaddr_account, std::set< uint32_t > subaddr_indices)
Definition: wallet2.cpp:9725
virtual void on_lw_new_block(uint64_t height)
Definition: wallet2.h:134
size_t pop_best_value_from(const transfer_container &transfers, std::vector< size_t > &unused_dust_indices, const std::vector< size_t > &selected_transfers, bool smallest=false) const
Definition: wallet2.cpp:6691
mdb_size_t count(MDB_cursor *cur)
time_t time
Definition: blockchain.cpp:93
cryptonote::account_public_address get_subaddress(const cryptonote::subaddress_index &index) const
Definition: wallet2.cpp:1430
std::string get_address_as_str() const
Definition: wallet2.h:798
std::string pod_to_hex(const t_pod_type &s)
Definition: string_tools.h:317
void get_payments_out_migration(std::list< std::pair< crypto::hash, wallet2::confirmed_transfer_details >> &confirmed_payments, uint64_t min_height, uint64_t max_height=(uint64_t) -1, const boost::optional< uint32_t > &subaddr_account=boost::none, const std::set< uint32_t > &subaddr_indices={}) const
Definition: wallet2.cpp:6363
void set_refresh_type(RefreshType refresh_type)
Definition: wallet2.h:821
bool export_key_images(const std::string &filename) const
Definition: wallet2.cpp:12191
std::vector< transfer_details > transfer_container
Definition: wallet2.h:449
declaration and default definition for the functions used the API
Definition: expect.cpp:33
void segregate_pre_fork_outputs(bool value)
Definition: wallet2.h:1096
bool finalize_multisig(const epee::wipeable_string &password, const std::vector< std::string > &info)
Finalizes creation of a multisig wallet.
Definition: wallet2.cpp:5516
void store_to(const std::string &path, const epee::wipeable_string &password)
store_to Stores wallet to another file(s), deleting old ones
Definition: wallet2.cpp:6038
virtual void on_unconfirmed_etn_received(uint64_t height, const crypto::hash &txid, const cryptonote::transaction &tx, uint64_t amount, const cryptonote::subaddress_index &subaddr_index)
Definition: wallet2.h:129
bool unlock_keys_file()
Definition: wallet2.cpp:8225
unsigned int uint32_t
Definition: stdint.h:126
bool is_tx_spendtime_unlocked(uint64_t unlock_time, uint64_t block_height) const
Definition: wallet2.cpp:6584
uint32_t get_min_output_count() const
Definition: wallet2.h:1082
bool unset_ring(const std::vector< crypto::key_image > &key_images)
Definition: wallet2.cpp:8072
std::vector< size_t > select_available_outputs(const std::function< bool(const transfer_details &td)> &f) const
Definition: wallet2.cpp:10755
bool auto_refresh() const
Definition: wallet2.h:1075
std::pair< size_t, wallet2::transfer_container > transfers
Definition: wallet2.h:500
std::set< uint32_t > subaddr_indices
Definition: wallet2.h:432
Various Tools.
Definition: tools.cpp:31
uint64_t get_device_last_key_image_sync() const
Definition: wallet2.h:907
bool track_uses() const
Definition: wallet2.h:1105
confirmed_transfer_details(const unconfirmed_transfer_details &utd, uint64_t height)
Definition: wallet2.h:411
bool light_wallet_import_wallet_request(tools::COMMAND_RPC_IMPORT_WALLET_REQUEST::response &response)
Definition: wallet2.cpp:9269
void set_tx_note(const crypto::hash &txid, const std::string &note)
Definition: wallet2.cpp:11987
void set_light_wallet(bool light_wallet)
Definition: wallet2.h:778
bool is_trusted_daemon() const
Definition: wallet2.h:765
void confirm_export_overwrite(bool always)
Definition: wallet2.h:1092
virtual void on_lw_etn_spent(uint64_t height, const crypto::hash &txid, uint64_t amount)
Definition: wallet2.h:137
uint64_t get_refresh_from_block_height() const
Definition: wallet2.h:743
uint64_t get_daemon_blockchain_height(std::string &err) const
Definition: wallet2.cpp:11931
uint64_t get_min_output_value() const
Definition: wallet2.h:1084
#define CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_BLOCKS
void thaw(size_t idx)
Definition: wallet2.cpp:1591
static bool verify_password(const std::string &keys_file_name, const epee::wipeable_string &password, bool no_spend_key, hw::device &hwdev, uint64_t kdf_rounds)
verify password for specified wallet keys file.
Definition: wallet2.cpp:4699
std::string export_outputs_to_str(bool all=false) const
Definition: wallet2.cpp:12744
bool init(std::string daemon_address="http://localhost:8080", boost::optional< epee::net_utils::http::login > daemon_login=boost::none, boost::asio::ip::tcp::endpoint proxy={}, uint64_t upper_transaction_weight_limit=0, bool trusted_daemon=true, epee::net_utils::ssl_options_t ssl_options=epee::net_utils::ssl_support_t::e_ssl_support_autodetect, std::string blockchain_db_path="")
Definition: wallet2.cpp:1282
unsigned __int64 uint64_t
Definition: stdint.h:136
void get_payments_out_sc_migration(std::list< std::pair< crypto::hash, wallet2::confirmed_transfer_details >> &confirmed_payments, uint64_t min_height, uint64_t max_height=(uint64_t) -1, const boost::optional< uint32_t > &subaddr_account=boost::none, const std::set< uint32_t > &subaddr_indices={}) const
Definition: wallet2.cpp:6380
std::vector< cryptonote::tx_destination_entry > splitted_dsts
Definition: wallet2.h:424
std::string get_subaddress_as_str(const cryptonote::subaddress_index &index) const
Definition: wallet2.cpp:1452
std::vector< multisig_sig > multisig_sigs
Definition: wallet2.h:475
std::string sign_tx_dump_to_str(unsigned_tx_set &exported_txs, std::vector< wallet2::pending_tx > &ptx, signed_tx_set &signed_txes)
Definition: wallet2.cpp:7295
#define BEGIN_SERIALIZE_OBJECT()
begins the environment of the DSL for described the serialization of an object
BOOST_CLASS_VERSION(nodetool::node_server< cryptonote::t_cryptonote_protocol_handler< tests::proxy_core > >, 1)
void ignore_fractional_outputs(bool value)
Definition: wallet2.h:1102
void remove_obsolete_pool_txs(const std::vector< crypto::hash > &tx_hashes)
Definition: wallet2.cpp:3136
cryptonote::COMMAND_RPC_GET_BLOCKS_FAST::block_output_indices o_indices
Definition: wallet2.h:569
bool empty() const
Definition: wallet2.h:190
std::vector< is_out_data > additional
Definition: wallet2.h:590
bool store_tx_info() const
Definition: wallet2.h:1069
cryptonote::transaction_prefix m_tx
Definition: wallet2.h:304
bool add_address_book_row(const cryptonote::account_public_address &address, const crypto::hash &payment_id, const std::string &description, bool is_subaddress)
Definition: wallet2.cpp:3451
uint64_t amount
tx_dust_policy(uint64_t a_dust_threshold=0, bool an_add_to_fee=true, cryptonote::account_public_address an_addr_for_dust=cryptonote::account_public_address())
Definition: wallet2.h:168
void clear()
Definition: wallet2.h:189
bool parse_tx_from_str(const std::string &signed_tx_st, std::vector< tools::wallet2::pending_tx > &ptx, std::function< bool(const signed_tx_set &)> accept_func)
Definition: wallet2.cpp:7342
#define false
Definition: stdbool.h:38
std::string decrypt_with_view_secret_key(const std::string &ciphertext, bool authenticated=true) const
Definition: wallet2.cpp:13250
std::string get_wallet_file() const
Definition: wallet2.cpp:11916
static void init_options(boost::program_options::options_description &desc_params)
Definition: wallet2.cpp:1193
virtual void on_lw_etn_received(uint64_t height, const crypto::hash &txid, uint64_t amount)
Definition: wallet2.h:135
bool public_transactions_required() const
Definition: wallet2.h:900
uint64_t get_light_wallet_blockchain_height() const
Definition: wallet2.h:780
std::vector< uint8_t > extra
Definition: wallet2.h:426
crypto::hash & operator[](size_t idx)
Definition: wallet2.h:187
std::tuple< uint64_t, crypto::public_key, rct::key > get_outs_entry
Definition: wallet2.h:562
void set_subaddress_lookahead(size_t major, size_t minor)
Definition: wallet2.cpp:1535
std::vector< wallet2::pending_tx > create_transactions_from(const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, std::vector< size_t > unused_transfers_indices, std::vector< size_t > unused_dust_indices, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector< uint8_t > &extra, const uint8_t tx_version)
Definition: wallet2.cpp:10439
boost::optional< epee::wipeable_string > on_pin_request() override
Definition: wallet2.cpp:1082
bool set_ring_database(const std::string &filename)
Definition: wallet2.cpp:7956
void serialize(t_archive &a, const unsigned int ver)
Definition: wallet2.h:195
tx_construction_data construction_data
Definition: wallet2.h:477
void discard_unmixable_outputs()
Definition: wallet2.cpp:10901
bool get_tx_key(const crypto::hash &txid, crypto::secret_key &tx_key, std::vector< crypto::secret_key > &additional_tx_keys)
Definition: wallet2.cpp:10924
bool set_blackballed_outputs(const std::vector< std::pair< uint64_t, uint64_t >> &outputs, bool add=false)
Definition: wallet2.cpp:8183
POD_CLASS public_key
Definition: crypto.h:76
tools::wallet2::tx_construction_data tx_construction_data
Definition: protocol.hpp:156
uint64_t get_num_rct_outputs()
Definition: wallet2.cpp:10831
version
Supported socks variants.
Definition: socks.h:57
void light_wallet_get_unspent_outs()
Definition: wallet2.cpp:9284
size_t size() const
Definition: wallet2.h:181
static bool wallet_valid_path_format(const std::string &file_path)
Definition: wallet2.cpp:5707
void expand_subaddresses(const cryptonote::subaddress_index &index, const bool udpate_account_tags=true)
Definition: wallet2.cpp:1478
cryptonote::block block
Definition: wallet2.h:567
bool is_keys_file_locked() const
Definition: wallet2.cpp:8236
virtual void on_etn_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: wallet2.h:128
std::string message("Message requiring signing")
static bool parse_short_payment_id(const std::string &payment_id_str, crypto::hash8 &payment_id)
Definition: wallet2.cpp:5725
size_t pop_best_value(std::vector< size_t > &unused_dust_indices, const std::vector< size_t > &selected_transfers, bool smallest=false) const
Definition: wallet2.cpp:6740
void set_subaddress_label(const cryptonote::subaddress_index &index, const std::string &label)
Definition: wallet2.cpp:1528
void set_account_tag_description(const std::string &tag, const std::string &description)
Set the label of the given tag.
Definition: wallet2.cpp:12069
void set_refresh_from_block_height(uint64_t height)
Definition: wallet2.h:742
virtual void on_device_button_request(uint64_t code)
Definition: wallet2.h:139
std::string get_multisig_info() const
Definition: wallet2.cpp:5529
bool set_daemon(std::string daemon_address="http://localhost:8080", boost::optional< epee::net_utils::http::login > daemon_login=boost::none, bool trusted_daemon=true, epee::net_utils::ssl_options_t ssl_options=epee::net_utils::ssl_support_t::e_ssl_support_autodetect)
Definition: wallet2.cpp:1268
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition: pointer.h:1124
void set_min_output_value(uint64_t value)
Definition: wallet2.h:1083
bool check_tx_proof(const crypto::hash &txid, const cryptonote::account_public_address &address, bool is_subaddress, const std::string &message, const std::string &sig_str, uint64_t &received, bool &in_pool, uint64_t &confirmations)
Definition: wallet2.cpp:11527
rct::multisig_out msout
Definition: wallet2.h:458
account_public_address addr
cryptonote::transaction_prefix m_tx
Definition: wallet2.h:380
std::string blobdata
Definition: blobdatatype.h:39
crypto::public_key get_subaddress_spend_public_key(const cryptonote::subaddress_index &index) const
Definition: wallet2.cpp:1445
static std::pair< std::unique_ptr< wallet2 >, password_container > make_new(const boost::program_options::variables_map &vm, bool unattended, const std::function< boost::optional< password_container >(const char *, bool)> &password_prompter)
Uses stdin and stdout. Returns a wallet2 and password for wallet with no file if no errors...
Definition: wallet2.cpp:1250
const transfer_details & get_transfer_details(size_t idx) const
Definition: wallet2.cpp:10852
CXA_THROW_INFO_T * info
Definition: stack_trace.cpp:91
size_t offset() const
Definition: wallet2.h:182
static std::pair< std::unique_ptr< wallet2 >, password_container > make_from_file(const boost::program_options::variables_map &vm, bool unattended, const std::string &wallet_file, const std::function< boost::optional< password_container >(const char *, bool)> &password_prompter)
Uses stdin and stdout. Returns a wallet2 and password for wallet_file if no errors.
Definition: wallet2.cpp:1233
virtual void on_new_block(uint64_t height, const cryptonote::block &block)
Definition: wallet2.h:127
void rewrite(const std::string &wallet_name, const epee::wipeable_string &password)
Rewrites to the wallet file for wallet upgrade (doesn&#39;t generate key, assumes it&#39;s already there) ...
Definition: wallet2.cpp:5670
crypto::public_key get_multisig_signer_public_key() const
Definition: wallet2.cpp:12898
bool confirm_backlog() const
Definition: wallet2.h:1087
bool is_deterministic() const
Checks if deterministic wallet.
Definition: wallet2.cpp:1293
bool invoke_http_bin(const boost::string_ref uri, const t_request &req, t_response &res, std::chrono::milliseconds timeout=std::chrono::seconds(15), const boost::string_ref http_method="GET")
Definition: wallet2.h:1326
cryptonote::account_public_address get_address() const
Definition: wallet2.h:793
std::pair< size_t, std::vector< tools::wallet2::transfer_details > > export_outputs(bool all=false) const
Definition: wallet2.cpp:12723
bool check_reserve_proof(const cryptonote::account_public_address &address, const std::string &message, const std::string &sig_str, uint64_t &total, uint64_t &spent)
Verifies a proof of reserve.
Definition: wallet2.cpp:11790
void segregation_height(uint64_t height)
Definition: wallet2.h:1100
void digit_split_strategy(const std::vector< cryptonote::tx_destination_entry > &dsts, const cryptonote::tx_destination_entry &change_dst, uint64_t dust_threshold, std::vector< cryptonote::tx_destination_entry > &splitted_dsts, std::vector< cryptonote::tx_destination_entry > &dust_dsts)
Definition: wallet2.h:2098
POD_CLASS signature
Definition: crypto.h:108
void freeze(size_t idx)
Definition: wallet2.cpp:1584
size_t get_num_subaddress_accounts() const
Definition: wallet2.h:801
key identity()
Definition: rctOps.h:73
POD_CLASS hash8
Definition: hash.h:53
void encrypt_keys(const crypto::chacha_key &key)
Definition: wallet2.cpp:4746
crypto::public_key key
crypto::signature shared_secret_sig
Definition: wallet2.h:558
gamma_picker(const std::vector< uint64_t > &rct_offsets)
Definition: wallet2.cpp:1011
bool synced_to_v10() const
Definition: wallet2.h:899
string daemon_address
Definition: transfers.cpp:42
std::string make_uri(const std::string &address, const std::string &payment_id, uint64_t amount, const std::string &tx_description, const std::string &recipient_name, std::string &error) const
Definition: wallet2.cpp:13255
uint64_t get_fee_multiplier(uint32_t priority, int fee_algorithm=-1) const
Definition: wallet2.cpp:7732
bool light_wallet_key_image_is_ours(const crypto::key_image &key_image, const crypto::public_key &tx_public_key, uint64_t out_index)
Definition: wallet2.cpp:9667
bool parse_unsigned_tx_from_str(const std::string &unsigned_tx_st, unsigned_tx_set &exported_txs) const
Definition: wallet2.cpp:7033
void load(const std::string &wallet, const epee::wipeable_string &password)
Definition: wallet2.cpp:5833
uint64_t estimate_blockchain_height()
Definition: wallet2.cpp:4990
void on_button_request(uint64_t code=0) override
Definition: wallet2.cpp:1070
POD_CLASS key_image
Definition: crypto.h:102
bool get_rings(const crypto::hash &txid, std::vector< std::pair< crypto::key_image, std::vector< uint64_t >>> &outs)
Definition: wallet2.cpp:8034
bool get_ring(const crypto::key_image &key_image, std::vector< uint64_t > &outs)
Definition: wallet2.cpp:8057
bool confirm_missing_payment_id() const
Definition: wallet2.h:1077
uint64_t get_blockchain_height_by_date(uint16_t year, uint8_t month, uint8_t day)
Definition: wallet2.cpp:13393
static const char * tr(const char *str)
Definition: wallet2.cpp:994
uint64_t hash_m_transfers(int64_t transfer_height, crypto::hash &hash) const
Definition: wallet2.cpp:13710
T decrypt(const std::string &ciphertext, const crypto::secret_key &skey, bool authenticated=true) const
Definition: wallet2.cpp:13223
void import_blockchain(const std::tuple< size_t, crypto::hash, std::vector< crypto::hash >> &bc)
Definition: wallet2.cpp:12703
bool merge_destinations() const
Definition: wallet2.h:1086
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1225
void set_description(const std::string &description)
Definition: wallet2.cpp:12026
uint64_t segregation_height() const
Definition: wallet2.h:1099
std::vector< size_t > select_available_mixable_outputs()
Definition: wallet2.cpp:10864
i_wallet2_callback * callback() const
Definition: wallet2.h:762
std::vector< cryptonote::tx_destination_entry > dests
Definition: wallet2.h:430
size_t real_output_in_tx_index
std::string dump_tx_to_str(const std::vector< pending_tx > &ptx_vector) const
Definition: wallet2.cpp:6984
static bool has_testnet_option(const boost::program_options::variables_map &vm)
Definition: wallet2.cpp:1173
void set_account_tag(const std::set< uint32_t > &account_indices, const std::string &tag)
Set a tag to the given accounts.
Definition: wallet2.cpp:12056
bool check_spend_proof(const crypto::hash &txid, const std::string &message, const std::string &sig_str)
Definition: wallet2.cpp:11163
crypto::hash get_transaction_hash(const transaction &t)
void always_confirm_transfers(bool always)
Definition: wallet2.h:1066
void finish_rescan_bc_keep_key_images(uint64_t transfer_height, const crypto::hash &hash)
Definition: wallet2.cpp:13734
void crop(size_t height)
Definition: wallet2.h:188
signed __int64 int64_t
Definition: stdint.h:135
std::unordered_set< crypto::public_key > ignore
Definition: wallet2.h:455
std::vector< std::pair< crypto::key_image, std::vector< uint64_t > > > m_rings
Definition: wallet2.h:391
bool verify(const std::string &data, const cryptonote::account_public_address &address, const std::string &signature) const
Definition: wallet2.cpp:12086
static bool has_stagenet_option(const boost::program_options::variables_map &vm)
Definition: wallet2.cpp:1178
bool has_unknown_key_images() const
Definition: wallet2.cpp:5657
crypto::key_image m_key_image
Definition: wallet2.h:311
std::vector< output_entry > outputs
void hash_m_transfer(const transfer_details &transfer, crypto::hash &hash) const
Definition: wallet2.cpp:13699
std::vector< address_book_row > get_address_book() const
GUI Address book get/store.
Definition: wallet2.h:1150
bool invoke_http_json_rpc(const boost::string_ref uri, const std::string &method_name, const t_request &req, t_response &res, std::chrono::milliseconds timeout=std::chrono::seconds(15), const boost::string_ref http_method="GET", const std::string &req_id="0")
Definition: wallet2.h:1333
RefreshType get_refresh_type() const
Definition: wallet2.h:822
crypto::signature key_image_sig
Definition: wallet2.h:559
std::vector< cryptonote::tx_extra_field > tx_extra_fields
Definition: wallet2.h:593
uint64_t dust_threshold
Definition: wallet2.h:164
std::string save_multisig_tx(multisig_tx_set txs)
Definition: wallet2.cpp:7431
crypto::hash txid
Definition: wallet2.h:554
std::set< uint32_t > m_subaddr_indices
Definition: wallet2.h:405
void check_tx_key(const crypto::hash &txid, const crypto::secret_key &tx_key, const std::vector< crypto::secret_key > &additional_tx_keys, const cryptonote::account_public_address &address, uint64_t &received, bool &in_pool, uint64_t &confirmations)
Definition: wallet2.cpp:11276
size_t get_num_transfer_details() const
Definition: wallet2.h:1155
void enable_dns(bool enable)
Definition: wallet2.h:1383
size_t import_outputs(const std::pair< size_t, std::vector< tools::wallet2::transfer_details >> &outputs)
Definition: wallet2.cpp:12763
RangeProofType range_proof_type
Definition: rctTypes.h:237
bool delete_address_book_row(std::size_t row_id)
Definition: wallet2.cpp:3466
std::string sign_multisig_participant(const std::string &data) const
sign_multisig_participant signs given message with the multisig public signer key ...
Definition: wallet2.cpp:12109
cryptonote::account_base & get_account()
Definition: wallet2.h:734
POD_CLASS hash
Definition: hash.h:50
cryptonote::tx_destination_entry change_dts
Definition: wallet2.h:469
void device_name(const std::string &device_name)
Definition: wallet2.h:1110
uint64_t get_blockchain_current_height() const
Definition: wallet2.h:898
std::string get_integrated_address_as_str(const crypto::hash8 &payment_id) const
Definition: wallet2.cpp:1458
void account_major_offset(uint32_t offset)
Definition: wallet2.h:810
bool load_unsigned_tx(const std::string &unsigned_filename, unsigned_tx_set &exported_txs) const
Definition: wallet2.cpp:7014
void rescan_blockchain(bool hard, bool refresh=true, bool keep_key_images=false)
Definition: wallet2.cpp:6540
crypto::secret_key tx_key
Definition: wallet2.h:472
const char *const ATTRIBUTE_DESCRIPTION
Definition: wallet2.h:1309
A container for blockchain checkpoints.
Definition: checkpoints.h:51
const char * address
Definition: multisig.cpp:37
void set_confirm_backlog_threshold(uint32_t threshold)
Definition: wallet2.h:1089
uint64_t get_bytes_received() const
Definition: wallet2.cpp:13761
const char * spendkey
Definition: multisig.cpp:38
std::string to_string(t_connection_type type)
void print_ring_members(bool value)
Definition: wallet2.h:1068
bool find_and_save_rings(bool force=true)
Definition: wallet2.cpp:8109
crypto::key_image key_image
Definition: wallet2.h:557
std::vector< pending_tx > create_unmixable_sweep_transactions()
Definition: wallet2.cpp:10870
std::pair< uint64_t, rct::ctkey > output_entry
void set_tx_key(const crypto::hash &txid, const crypto::secret_key &tx_key, const std::vector< crypto::secret_key > &additional_tx_keys)
Definition: wallet2.cpp:11000
crypto::chacha_iv iv
Definition: wallet2.h:534
bool get_multisig_seed(epee::wipeable_string &seed, const epee::wipeable_string &passphrase=std::string(), bool raw=true) const
Definition: wallet2.cpp:1327
bool sanity_check(const std::vector< wallet2::pending_tx > &ptx_vector, std::vector< cryptonote::tx_destination_entry > dsts) const
Definition: wallet2.cpp:10280
std::vector< boost::optional< cryptonote::subaddress_receive_info > > received
Definition: wallet2.h:577
std::vector< wallet2::pending_tx > create_transactions_single(const crypto::key_image &ki, const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector< uint8_t > &extra)
Definition: wallet2.cpp:10416
void refresh(bool trusted_daemon)
Definition: wallet2.cpp:3060
std::enable_if< Archive::is_loading::value, void >::type initialize_transfer_details(Archive &a, tools::wallet2::transfer_details &x, const boost::serialization::version_type ver)
Definition: wallet2.h:1648
bool set_ring(const crypto::key_image &key_image, const std::vector< uint64_t > &outs, bool relative)
Definition: wallet2.cpp:8063
std::vector< pending_tx > m_ptx
Definition: wallet2.h:512
const std::pair< std::map< std::string, std::string >, std::vector< std::string > > & get_account_tags()
Get the list of registered account tags.
Definition: wallet2.cpp:12036
void cold_tx_aux_import(const std::vector< pending_tx > &ptx, const std::vector< std::string > &tx_device_aux)
Definition: wallet2.cpp:10655
bool blackball_output(const std::pair< uint64_t, uint64_t > &output)
Definition: wallet2.cpp:8175
#define FIELD(f)
tags the field with the variable name and then serializes it
uint32_t get_default_priority() const
Definition: wallet2.h:1073
void import_payments_out(const std::list< std::pair< crypto::hash, wallet2::confirmed_transfer_details >> &confirmed_payments)
Definition: wallet2.cpp:12682
void push_back(const crypto::hash &hash)
Definition: wallet2.h:184
cryptonote::keypair in_ephemeral
Definition: wallet2.h:290
std::map< uint32_t, std::pair< uint64_t, uint64_t > > unlocked_balance_per_subaddress(uint32_t subaddr_index_major, bool public_blockchain=false) const
Definition: wallet2.cpp:6249
uint64_t adjust_mixin(uint64_t mixin) const
Definition: wallet2.cpp:7860
virtual void on_etn_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: wallet2.h:130
uint64_t get_fee_quantization_mask() const
Definition: wallet2.cpp:7807
std::string get_description() const
Definition: wallet2.cpp:12031
void write_watch_only_wallet(const std::string &wallet_name, const epee::wipeable_string &password, std::string &new_keys_filename)
Writes to a file named based on the normal wallet (doesn&#39;t generate key, assumes it&#39;s already there) ...
Definition: wallet2.cpp:5686
std::string get_attribute(const std::string &key) const
Definition: wallet2.cpp:12018
uint64_t get_last_block_reward() const
Definition: wallet2.h:906
bool sign_multisig_tx_from_file(const std::string &filename, std::vector< crypto::hash > &txids, std::function< bool(const multisig_tx_set &)> accept_func)
Definition: wallet2.cpp:7718
void explicit_refresh_from_block_height(bool expl)
Definition: wallet2.h:745
crypto::public_key m_signer
Definition: wallet2.h:277
uint64_t unlocked_balance_all(bool public_blockchain, uint64_t *blocks_to_unlock=NULL) const
Definition: wallet2.cpp:6300
uint32_t adjust_priority(uint32_t priority)
Definition: wallet2.cpp:7877
error
Tracks LMDB error codes.
Definition: error.h:44
hw::device::device_type get_device_type() const
Definition: wallet2.h:831
bool lock_keys_file()
Definition: wallet2.cpp:8214
void ask_password(AskPasswordType ask)
Definition: wallet2.h:1080
uint32_t default_mixin() const
Definition: wallet2.h:1071
void check_tx_key_helper(const crypto::hash &txid, const crypto::key_derivation &derivation, const std::vector< crypto::key_derivation > &additional_derivations, const cryptonote::account_public_address &address, uint64_t &received, bool &in_pool, uint64_t &confirmations)
Definition: wallet2.cpp:11323
const crypto::public_key & get_public_key() const
Definition: wallet2.h:326
std::tuple< size_t, crypto::hash, std::vector< crypto::hash > > export_blockchain() const
Definition: wallet2.cpp:12691
void transfer_selected(const std::vector< cryptonote::tx_destination_entry > &dsts, const std::vector< size_t > &selected_transfers, size_t fake_outputs_count, std::vector< std::vector< tools::wallet2::get_outs_entry >> &outs, uint64_t unlock_time, uint64_t fee, const std::vector< uint8_t > &extra, T destination_split_strategy, const tx_dust_policy &dust_policy, cryptonote::transaction &tx, pending_tx &ptx)
Definition: wallet2.cpp:8952
std::string encrypt(const char *plaintext, size_t len, const crypto::secret_key &skey, bool authenticated=true) const
Definition: wallet2.cpp:13181
std::string get_tx_proof(const crypto::hash &txid, const cryptonote::account_public_address &address, bool is_subaddress, const std::string &message)
Definition: wallet2.cpp:11371
void set_default_priority(uint32_t p)
Definition: wallet2.h:1074
bool sign_multisig_tx_to_file(multisig_tx_set &exported_txs, const std::string &filename, std::vector< crypto::hash > &txids)
Definition: wallet2.cpp:7710
std::string encrypt_with_view_secret_key(const std::string &plaintext, bool authenticated=true) const
Definition: wallet2.cpp:13217
virtual void on_device_progress(const hw::device_progress &event)
Definition: wallet2.h:143
void set_min_output_count(uint32_t count)
Definition: wallet2.h:1081
bool parse_multisig_tx_from_str(std::string multisig_tx_st, multisig_tx_set &exported_txs) const
Definition: wallet2.cpp:7505
void generate(const std::string &wallet_, const epee::wipeable_string &password, const epee::wipeable_string &multisig_data, bool create_address_file=false)
Generates a wallet or restores one.
Definition: wallet2.cpp:4869
virtual ~i_wallet2_callback()
Definition: wallet2.h:146
void update_pool_state(bool refreshed=false)
Definition: wallet2.cpp:3164
static bool parse_payment_id(const std::string &payment_id_str, crypto::hash &payment_id)
Definition: wallet2.cpp:5738
void cold_sign_tx(const std::vector< pending_tx > &ptx_vector, signed_tx_set &exported_txs, std::vector< cryptonote::address_parse_info > &dsts_info, std::vector< std::string > &tx_device_aux)
Definition: wallet2.cpp:10665
static bool verify_multisig_info(const std::string &data, crypto::secret_key &skey, crypto::public_key &pkey)
Definition: wallet2.cpp:5548
void add_subaddress(uint32_t index_major, const std::string &label)
Definition: wallet2.cpp:1470
bool auto_low_priority() const
Definition: wallet2.h:1093
multisig_tx_set make_multisig_tx_set(const std::vector< pending_tx > &ptx_vector) const
Definition: wallet2.cpp:7477
uint64_t get_daemon_blockchain_target_height(std::string &err)
Definition: wallet2.cpp:11949
std::vector< size_t > selected_transfers
Definition: wallet2.h:425
bool verify_with_public_key(const std::string &data, const crypto::public_key &public_key, const std::string &signature) const
verify_with_public_key verifies message was signed with given public key
Definition: wallet2.cpp:12121
BackgroundMiningSetupType setup_background_mining() const
Definition: wallet2.h:1107
void import_payments(const payment_container &payments)
Definition: wallet2.cpp:12674
std::string get_subaddress_label(const cryptonote::subaddress_index &index) const
Definition: wallet2.cpp:1518
void light_wallet_get_address_txs()
Definition: wallet2.cpp:9454
void serialize(t_archive &a, const unsigned int ver)
Definition: wallet2.h:910
bool multisig(bool *ready=NULL, uint32_t *threshold=NULL, uint32_t *total=NULL) const
Definition: wallet2.cpp:5634
std::vector< multisig_info > m_multisig_info
Definition: wallet2.h:321
uint64_t get_min_ring_size() const
Definition: wallet2.cpp:7836
void get_transfers(wallet2::transfer_container &incoming_transfers) const
Definition: wallet2.cpp:6315
uint8_t threshold
Definition: blockchain.cpp:92
std::vector< std::pair< crypto::key_image, std::vector< uint64_t > > > m_rings
Definition: wallet2.h:406