Electroneum
Loading...
Searching...
No Matches
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
78class Serialization_portability_wallet_Test;
80
81namespace 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
103private:
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) {}
132 virtual boost::optional<epee::wipeable_string> on_get_password(const char *reason) { return boost::none; }
133 // Light wallet callbacks
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) {}
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
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;
210 {
211 friend class ::Serialization_portability_wallet_Test;
212 friend class ::wallet_accessor_test;
215 public:
216 static constexpr const std::chrono::seconds rpc_timeout = std::chrono::minutes(3) + std::chrono::seconds(30);
217
224
230
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)
275 };
276
277 crypto::public_key m_signer;
278 std::vector<LR> m_LR;
279 std::vector<crypto::key_image> m_partial_key_images; // one per key the participant has
280
283 FIELD(m_LR)
286 };
287
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
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
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)
351 };
352
364
366 {
369 };
370
377
379 {
385 std::vector<cryptonote::tx_destination_entry> m_dests;
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
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;
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
439 FIELD(extra)
443 FIELD(dests)
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
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)
519 };
520
522 {
523 crypto::chacha_iv iv;
524 std::string account_data;
525
527 FIELD(iv)
530 };
531
533 {
534 crypto::chacha_iv iv;
535 std::string cache_data;
536
538 FIELD(iv)
541 };
542
543 // GUI Address book
551
561
562 typedef std::tuple<uint64_t, crypto::public_key, rct::key> get_outs_entry;
563
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
662 std::string make_multisig(const epee::wipeable_string &password,
663 const std::vector<std::string> &info,
670 std::string make_multisig(const epee::wipeable_string &password,
671 const std::vector<crypto::secret_key> &view_keys,
672 const std::vector<crypto::public_key> &spend_keys,
674 std::string exchange_multisig_keys(const epee::wipeable_string &password,
675 const std::vector<std::string> &info);
679 std::string exchange_multisig_keys(const epee::wipeable_string &password,
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);
693 std::string get_multisig_info() const;
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);
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; }
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
792 cryptonote::account_public_address get_subaddress(const cryptonote::subaddress_index& index) const;
794 boost::optional<cryptonote::subaddress_index> get_subaddress_index(const cryptonote::account_public_address& address) const;
795 crypto::public_key get_subaddress_spend_public_key(const cryptonote::subaddress_index& index) const;
796 std::vector<crypto::public_key> get_subaddress_spend_public_keys(uint32_t account, uint32_t begin, uint32_t end) const;
797 std::string get_subaddress_as_str(const cryptonote::subaddress_index& index) const;
798 std::string get_address_as_str() const { return get_subaddress_as_str({0, 0}); }
799 std::string get_integrated_address_as_str(const crypto::hash8& payment_id) 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);
805 std::string get_subaddress_label(const cryptonote::subaddress_index& index) const;
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;
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);
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; }
1112 void device_derivation_path(const std::string &device_derivation_path) { m_device_derivation_path = 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
1125 std::string get_spend_proof(const crypto::hash &txid, const std::string &message);
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);
1145 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);
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
1154 uint64_t get_num_rct_outputs();
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;
1164 std::string get_daemon_address() const;
1165 const boost::optional<epee::net_utils::http::login>& get_daemon_login() const { return m_daemon_login; }
1166 uint64_t get_daemon_blockchain_height(std::string& err) const;
1167 uint64_t get_daemon_blockchain_target_height(std::string& err);
1171 uint64_t get_approximate_blockchain_height() const;
1172 uint64_t estimate_blockchain_height();
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
1217 std::string sign_multisig_participant(const std::string& data) const;
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);
1232 payment_container export_payments() const;
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);
1243 crypto::public_key get_tx_pub_key_from_received_outs(const tools::wallet2::transfer_details &td) const;
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;
1271 uint64_t adjust_mixin(uint64_t mixin) const;
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
1278 void light_wallet_get_unspent_outs();
1279 // fetch txs and store in m_payments
1280 void light_wallet_get_address_txs();
1281 // get_address_info
1282 bool light_wallet_get_address_info(tools::COMMAND_RPC_GET_ADDRESS_INFO::response &response);
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
1286 bool light_wallet_import_wallet_request(tools::COMMAND_RPC_IMPORT_WALLET_REQUEST::response &response);
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;
1364 void add_checkpoint(uint64_t height, std::string hash);
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; };
1369 mms::multisig_wallet_state get_multisig_wallet_state() const;
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}
1622BOOST_CLASS_VERSION(tools::wallet2, 29)
1623BOOST_CLASS_VERSION(tools::wallet2::transfer_details, 12)
1624BOOST_CLASS_VERSION(tools::wallet2::multisig_info, 1)
1625BOOST_CLASS_VERSION(tools::wallet2::multisig_info::LR, 0)
1626BOOST_CLASS_VERSION(tools::wallet2::multisig_tx_set, 1)
1627BOOST_CLASS_VERSION(tools::wallet2::payment_details, 4)
1628BOOST_CLASS_VERSION(tools::wallet2::pool_payment_details, 1)
1629BOOST_CLASS_VERSION(tools::wallet2::unconfirmed_transfer_details, 8)
1630BOOST_CLASS_VERSION(tools::wallet2::confirmed_transfer_details, 8)
1631BOOST_CLASS_VERSION(tools::wallet2::address_book_row, 17)
1632BOOST_CLASS_VERSION(tools::wallet2::reserve_proof_entry, 0)
1633BOOST_CLASS_VERSION(tools::wallet2::unsigned_tx_set, 0)
1634BOOST_CLASS_VERSION(tools::wallet2::signed_tx_set, 1)
1635BOOST_CLASS_VERSION(tools::wallet2::tx_construction_data, 4)
1636BOOST_CLASS_VERSION(tools::wallet2::pending_tx, 3)
1637BOOST_CLASS_VERSION(tools::wallet2::multisig_sig, 0)
1638
1639namespace 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
1714 return;
1715 }
1716 a & x.m_mask;
1717 a & x.m_amount;
1718 if (ver < 2)
1719 {
1721 return;
1722 }
1723 a & x.m_spent_height;
1724 if (ver < 3)
1725 {
1727 return;
1728 }
1729 a & x.m_txid;
1730 if (ver < 4)
1731 {
1733 return;
1734 }
1735 a & x.m_rct;
1736 if (ver < 5)
1737 {
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 {
1753 return;
1754 }
1755 a & x.m_pk_index;
1756 if (ver < 8)
1757 {
1759 return;
1760 }
1761 a & x.m_subaddr_index;
1762 if (ver < 9)
1763 {
1765 return;
1766 }
1767 a & x.m_multisig_info;
1768 a & x.m_multisig_k;
1770 if (ver < 10)
1771 {
1773 return;
1774 }
1776 if (ver < 11)
1777 {
1779 return;
1780 }
1781 a & x.m_uses;
1782 if (ver < 12)
1783 {
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;
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;
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 }
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;
2082 if (ver < 2)
2083 return;
2085 if (ver < 3)
2086 return;
2087 a & x.multisig_sigs;
2088 }
2089 }
2090}
2091
2092namespace 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}
uint64_t height
uint8_t version
time_t time
uint8_t threshold
A container for blockchain checkpoints.
Definition checkpoints.h:52
Non-owning sequence of data. Does not deep copy.
Definition span.h:57
gamma_picker(const std::vector< uint64_t > &rct_offsets)
Definition wallet2.cpp:1011
void crop(size_t height)
Definition wallet2.h:188
crypto::hash & operator[](size_t idx)
Definition wallet2.h:187
bool is_in_bounds(size_t idx) const
Definition wallet2.h:185
size_t offset() const
Definition wallet2.h:182
void trim(size_t height)
Definition wallet2.h:191
void push_back(const crypto::hash &hash)
Definition wallet2.h:184
bool empty() const
Definition wallet2.h:190
const crypto::hash & operator[](size_t idx) const
Definition wallet2.h:186
void serialize(t_archive &a, const unsigned int ver)
Definition wallet2.h:195
void refill(const crypto::hash &hash)
Definition wallet2.h:192
size_t size() const
Definition wallet2.h:181
const crypto::hash & genesis() const
Definition wallet2.h:183
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
virtual void on_lw_unconfirmed_etn_received(uint64_t height, const crypto::hash &txid, uint64_t amount)
Definition wallet2.h:136
virtual boost::optional< epee::wipeable_string > on_device_pin_request()
Definition wallet2.h:141
virtual void on_device_button_pressed()
Definition wallet2.h:140
virtual boost::optional< epee::wipeable_string > on_get_password(const char *reason)
Definition wallet2.h:132
virtual void on_pool_tx_removed(const crypto::hash &txid)
Definition wallet2.h:145
virtual void on_device_button_request(uint64_t code)
Definition wallet2.h:139
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
virtual void on_new_block(uint64_t height, const cryptonote::block &block)
Definition wallet2.h:127
virtual ~i_wallet2_callback()
Definition wallet2.h:146
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
virtual void on_lw_etn_spent(uint64_t height, const crypto::hash &txid, uint64_t amount)
Definition wallet2.h:137
virtual void on_skip_transaction(uint64_t height, const crypto::hash &txid, const cryptonote::transaction &tx)
Definition wallet2.h:131
virtual void on_lw_etn_received(uint64_t height, const crypto::hash &txid, uint64_t amount)
Definition wallet2.h:135
virtual boost::optional< epee::wipeable_string > on_device_passphrase_request(bool on_device)
Definition wallet2.h:142
virtual void on_lw_new_block(uint64_t height)
Definition wallet2.h:134
virtual void on_device_progress(const hw::device_progress &event)
Definition wallet2.h:143
const mms::message_store & get_message_store() const
Definition wallet2.h:1368
uint64_t get_max_ring_size() const
Definition wallet2.cpp:7851
std::string exchange_multisig_keys(const epee::wipeable_string &password, const std::vector< std::string > &info)
Definition wallet2.cpp:5280
bool sanity_check(const std::vector< wallet2::pending_tx > &ptx_vector, std::vector< cryptonote::tx_destination_entry > dsts) const
bool parse_unsigned_tx_from_str(const std::string &unsigned_tx_st, unsigned_tx_set &exported_txs) const
Definition wallet2.cpp:7033
uint32_t get_confirm_backlog_threshold() const
Definition wallet2.h:1090
static bool has_testnet_option(const boost::program_options::variables_map &vm)
Definition wallet2.cpp:1173
cryptonote::blobdata export_multisig()
bool segregate_pre_fork_outputs() const
Definition wallet2.h:1095
void auto_refresh(bool r)
Definition wallet2.h:1076
void key_reuse_mitigation2(bool value)
Definition wallet2.h:1098
bool is_unattended() const
Definition wallet2.h:1274
bool load_unsigned_tx(const std::string &unsigned_filename, unsigned_tx_set &exported_txs) const
Definition wallet2.cpp:7014
crypto::public_key get_multisig_signing_public_key(size_t idx) const
bool watch_only() const
Definition wallet2.h:825
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
uint64_t get_base_fee() const
Definition wallet2.cpp:7785
void set_trusted_daemon(bool trusted)
Definition wallet2.h:766
bool merge_destinations() const
Definition wallet2.h:1086
void always_confirm_transfers(bool always)
Definition wallet2.h:1066
bool sign_multisig_tx_to_file(multisig_tx_set &exported_txs, const std::string &filename, std::vector< crypto::hash > &txids)
Definition wallet2.cpp:7710
size_t import_multisig(std::vector< cryptonote::blobdata > info)
void load(const std::string &wallet, const epee::wipeable_string &password)
Definition wallet2.cpp:5833
crypto::public_key get_multisig_signer_public_key(const crypto::secret_key &spend_skey) const
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
void default_mixin(uint32_t m)
Definition wallet2.h:1072
std::string encrypt(const char *plaintext, size_t len, const crypto::secret_key &skey, bool authenticated=true) const
uint64_t cold_key_image_sync(uint64_t &spent, uint64_t &unspent)
const boost::optional< epee::net_utils::http::login > & get_daemon_login() const
Definition wallet2.h:1165
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)
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
void track_uses(bool value)
Definition wallet2.h:1106
void set_default_priority(uint32_t p)
Definition wallet2.h:1074
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
void enable_dns(bool enable)
Definition wallet2.h:1383
void callback(i_wallet2_callback *callback)
Definition wallet2.h:763
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::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
void merge_destinations(bool merge)
Definition wallet2.h:1085
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
void set_tx_notify(const std::shared_ptr< tools::Notify > &notify)
Definition wallet2.h:1377
wallet2(cryptonote::network_type nettype=cryptonote::MAINNET, uint64_t kdf_rounds=1, bool unattended=false)
Definition wallet2.cpp:1102
uint64_t get_min_output_value() const
Definition wallet2.h:1084
std::vector< pending_tx > create_unmixable_sweep_transactions()
void explicit_refresh_from_block_height(bool expl)
Definition wallet2.h:745
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
uint64_t segregation_height() const
Definition wallet2.h:1099
bool ignore_fractional_outputs() const
Definition wallet2.h:1101
bool check_connection(uint32_t *version=NULL, bool *ssl=NULL, uint32_t timeout=200000)
Definition wallet2.cpp:5758
bool is_synced() const
void ask_password(AskPasswordType ask)
Definition wallet2.h:1080
friend class wallet_device_callback
Definition wallet2.h:214
BackgroundMiningSetupType setup_background_mining() const
Definition wallet2.h:1107
void confirm_missing_payment_id(bool always)
Definition wallet2.h:1078
static std::string device_derivation_path_option(const boost::program_options::variables_map &vm)
Definition wallet2.cpp:1188
std::tuple< uint64_t, crypto::public_key, rct::key > get_outs_entry
Definition wallet2.h:562
std::string encrypt(const epee::span< char > &span, const crypto::secret_key &skey, bool authenticated=true) const
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
size_t get_num_subaddress_accounts() const
Definition wallet2.h:801
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
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
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
std::string get_attribute(const std::string &key) const
void device_name(const std::string &device_name)
Definition wallet2.h:1110
const std::string & device_derivation_path() const
Definition wallet2.h:1111
bool confirm_backlog() const
Definition wallet2.h:1087
bool sign_multisig_tx(multisig_tx_set &exported_txs, std::vector< crypto::hash > &txids)
Definition wallet2.cpp:7607
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)
@ AskPasswordToDecrypt
Definition wallet2.h:228
@ AskPasswordOnAction
Definition wallet2.h:227
void set_min_output_count(uint32_t count)
Definition wallet2.h:1081
bool sign_tx(unsigned_tx_set &exported_txs, const std::string &signed_filename, std::vector< wallet2::pending_tx > &ptx, bool export_raw=false)
cryptonote::account_base & get_account()
Definition wallet2.h:734
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
void setup_background_mining(BackgroundMiningSetupType value)
Definition wallet2.h:1108
const cryptonote::account_base & get_account() const
Definition wallet2.h:735
bool confirm_non_default_ring_size() const
Definition wallet2.h:1103
static std::string device_name_option(const boost::program_options::variables_map &vm)
Definition wallet2.cpp:1183
void set_light_wallet(bool light_wallet)
Definition wallet2.h:778
std::pair< size_t, size_t > get_subaddress_lookahead() const
Definition wallet2.h:808
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)
size_t get_num_transfer_details() const
Definition wallet2.h:1155
uint64_t get_min_ring_size() const
Definition wallet2.cpp:7836
uint64_t get_fee_multiplier(uint32_t priority, int fee_algorithm=-1) const
Definition wallet2.cpp:7732
void set_refresh_from_block_height(uint64_t height)
Definition wallet2.h:742
bool print_ring_members() const
Definition wallet2.h:1067
uint32_t account_major_offset() const
Definition wallet2.h:811
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
std::vector< std::pair< uint64_t, uint64_t > > estimate_backlog(const std::vector< std::pair< double, double > > &fee_levels)
void get_transfers(wallet2::transfer_container &incoming_transfers) const
Definition wallet2.cpp:6315
AskPasswordType ask_password() const
Definition wallet2.h:1079
uint64_t get_blockchain_height_by_date(uint16_t year, uint8_t month, uint8_t day)
static bool verify_multisig_info(const std::string &data, crypto::secret_key &skey, crypto::public_key &pkey)
Definition wallet2.cpp:5548
void device_derivation_path(const std::string &device_derivation_path)
Definition wallet2.h:1112
std::vector< transfer_details > transfer_container
Definition wallet2.h:449
void confirm_non_default_ring_size(bool always)
Definition wallet2.h:1104
bool always_confirm_transfers() const
Definition wallet2.h:1065
uint64_t get_light_wallet_blockchain_height() const
Definition wallet2.h:780
static std::string get_human_readable_timestamp(uint64_t ts)
Check if wallet file path is valid format.
Definition wallet2.h:1039
bool track_uses() const
Definition wallet2.h:1105
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
uint64_t get_last_block_reward() const
Definition wallet2.h:906
@ RefreshOptimizeCoinbase
Definition wallet2.h:220
void confirm_backlog(bool always)
Definition wallet2.h:1088
void stop()
Definition wallet2.h:760
void set_refresh_type(RefreshType refresh_type)
Definition wallet2.h:821
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
const char *const ATTRIBUTE_DESCRIPTION
Definition wallet2.h:1309
const std::string get_ring_database() const
Definition wallet2.h:1341
void set_attribute(const std::string &key, const std::string &value)
bool key_reuse_mitigation2() const
Definition wallet2.h:1097
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)
void auto_low_priority(bool value)
Definition wallet2.h:1094
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
uint32_t get_default_priority() const
Definition wallet2.h:1073
uint64_t get_device_last_key_image_sync() const
Definition wallet2.h:907
uint32_t get_min_output_count() const
Definition wallet2.h:1082
uint64_t get_fee_quantization_mask() const
Definition wallet2.cpp:7807
bool finalize_multisig(const epee::wipeable_string &password, const std::vector< std::string > &info)
Finalizes creation of a multisig wallet.
Definition wallet2.cpp:5516
std::string decrypt_with_view_secret_key(const std::string &ciphertext, bool authenticated=true) const
size_t get_num_subaddresses(uint32_t index_major) const
Definition wallet2.h:802
std::vector< address_book_row > get_address_book() const
GUI Address book get/store.
Definition wallet2.h:1150
uint64_t get_blockchain_current_height() const
Definition wallet2.h:898
bool store_tx_info() const
Definition wallet2.h:1069
void serialize(t_archive &a, const unsigned int ver)
Definition wallet2.h:910
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)
T decrypt(const std::string &ciphertext, const crypto::secret_key &skey, bool authenticated=true) const
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
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)
RefreshType get_refresh_type() const
Definition wallet2.h:822
uint32_t adjust_priority(uint32_t priority)
Definition wallet2.cpp:7877
friend class wallet_keys_unlocker
Definition wallet2.h:213
uint64_t get_refresh_from_block_height() const
Definition wallet2.h:743
BackgroundMiningSetupType
Definition wallet2.h:231
@ BackgroundMiningMaybe
Definition wallet2.h:232
@ BackgroundMiningYes
Definition wallet2.h:233
bool key_on_device() const
Definition wallet2.h:830
cryptonote::account_public_address get_subaddress(const cryptonote::subaddress_index &index) const
Definition wallet2.cpp:1430
void generate(const std::string &wallet, const epee::wipeable_string &password, const cryptonote::account_public_address &account_public_address, const crypto::secret_key &viewkey=crypto::secret_key(), bool create_address_file=false)
Creates a watch only wallet from a public address and a view secret key.
mms::message_store & get_message_store()
Definition wallet2.h:1367
bool confirm_missing_payment_id() const
Definition wallet2.h:1077
void confirm_export_overwrite(bool always)
Definition wallet2.h:1092
void rewrite(const std::string &wallet_name, const epee::wipeable_string &password)
Rewrites to the wallet file for wallet upgrade (doesn't generate key, assumes it's already there).
Definition wallet2.cpp:5670
bool auto_refresh() const
Definition wallet2.h:1075
static bool has_stagenet_option(const boost::program_options::variables_map &vm)
Definition wallet2.cpp:1178
bool is_trusted_daemon() const
Definition wallet2.h:765
void segregation_height(uint64_t height)
Definition wallet2.h:1100
bool explicit_refresh_from_block_height() const
Definition wallet2.h:746
bool confirm_export_overwrite() const
Definition wallet2.h:1091
std::string get_subaddress_as_str(const cryptonote::subaddress_index &index) const
Definition wallet2.cpp:1452
void segregate_pre_fork_outputs(bool value)
Definition wallet2.h:1096
void store_tx_info(bool store)
Definition wallet2.h:1070
hw::device::device_type get_device_type() const
Definition wallet2.h:831
void set_confirm_backlog_threshold(uint32_t threshold)
Definition wallet2.h:1089
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't generate key, assumes it's already there).
Definition wallet2.cpp:5686
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
std::string encrypt_with_view_secret_key(const std::string &plaintext, bool authenticated=true) const
bool auto_low_priority() const
Definition wallet2.h:1093
bool parse_multisig_tx_from_str(std::string multisig_tx_st, multisig_tx_set &exported_txs) const
Definition wallet2.cpp:7505
crypto::secret_key generate(const std::string &wallet, const epee::wipeable_string &password, const crypto::secret_key &recovery_param=crypto::secret_key(), bool recover=false, bool two_random=false, bool create_address_file=false)
Generates a wallet or restores one.
bool public_transactions_required() const
Definition wallet2.h:900
std::unordered_multimap< crypto::hash, payment_details > payment_container
Definition wallet2.h:450
bool synced_to_v10() const
Definition wallet2.h:899
i_wallet2_callback * callback() const
Definition wallet2.h:762
void cold_tx_aux_import(const std::vector< pending_tx > &ptx, const std::vector< std::string > &tx_device_aux)
uint64_t adjust_mixin(uint64_t mixin) const
Definition wallet2.cpp:7860
static constexpr const std::chrono::seconds rpc_timeout
Definition wallet2.h:216
void generate(const std::string &wallet, const epee::wipeable_string &password, const cryptonote::account_public_address &account_public_address, const crypto::secret_key &spendkey, const crypto::secret_key &viewkey, bool create_address_file=false)
Creates a wallet from a public address and a spend/view secret key pair.
static void init_options(boost::program_options::options_description &desc_params)
Definition wallet2.cpp:1193
void account_major_offset(uint32_t offset)
Definition wallet2.h:810
void print_ring_members(bool value)
Definition wallet2.h:1068
std::string get_address_as_str() const
Definition wallet2.h:798
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
void discard_unmixable_outputs()
uint32_t default_mixin() const
Definition wallet2.h:1071
std::vector< crypto::public_key > get_subaddress_spend_public_keys(uint32_t account, uint32_t begin, uint32_t end) const
uint64_t get_light_wallet_scanned_block_height() const
Definition wallet2.h:779
void set_min_output_value(uint64_t value)
Definition wallet2.h:1083
std::string path() const
Definition wallet2.cpp:6027
cryptonote::network_type nettype() const
Definition wallet2.h:824
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
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
cryptonote::account_public_address get_address() const
Definition wallet2.h:793
std::string get_multisig_info() const
Definition wallet2.cpp:5529
void ignore_fractional_outputs(bool value)
Definition wallet2.h:1102
const std::string & device_name() const
Definition wallet2.h:1109
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
boost::optional< epee::wipeable_string > on_passphrase_request(bool on_device) override
Definition wallet2.cpp:1089
void on_button_pressed() override
Definition wallet2.cpp:1076
void on_button_request(uint64_t code=0) override
Definition wallet2.cpp:1070
wallet_device_callback(wallet2 *wallet)
Definition wallet2.h:152
void on_progress(const hw::device_progress &event) override
Definition wallet2.cpp:1096
boost::optional< epee::wipeable_string > on_pin_request() override
Definition wallet2.cpp:1082
wallet_keys_unlocker(wallet2 &w, const boost::optional< tools::password_container > &password)
Definition wallet2.cpp:1034
#define tr(x)
BOOST_CLASS_VERSION(nodetool::node_server< cryptonote::t_cryptonote_protocol_handler< tests::proxy_core > >, 1)
#define CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_BLOCKS
#define FEE_PER_KB
std::string message("Message requiring signing")
const char * res
const char * key
#define LOG_PRINT_L0(x)
Definition misc_log_ex.h:99
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:1644
crypto namespace.
Definition crypto.cpp:58
std::enable_if< std::is_pod< T >::value, T >::type rand()
Definition crypto.h:216
POD_CLASS signature
Definition crypto.h:108
epee::mlocked< tools::scrubbed< ec_scalar > > secret_key
Definition crypto.h:82
POD_CLASS hash8
Definition hash.h:53
POD_CLASS key_derivation
Definition crypto.h:101
POD_CLASS public_key
Definition crypto.h:79
POD_CLASS key_image
Definition crypto.h:105
POD_CLASS hash
Definition hash.h:50
Holds cryptonote related classes and helpers.
Definition ban.cpp:40
void decompose_amount_into_digits(uint64_t amount, uint64_t dust_threshold, const chunk_handler_t &chunk_handler, const dust_handler_t &dust_handler)
crypto::hash get_transaction_hash(const transaction &t)
std::string blobdata
std::string print_etn(uint64_t amount, unsigned int decimal_point)
declaration and default definition for the functions used the API
Definition expect.cpp:34
http_simple_client_template< blocked_mode_client > http_simple_client
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")
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")
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")
std::string pod_to_hex(const t_pod_type &s)
@ RangeProofBorromean
Definition rctTypes.h:235
@ RangeProofBulletproof
Definition rctTypes.h:235
key identity()
Definition rctOps.h:73
STL namespace.
void print_source_entry(const cryptonote::tx_source_entry &src)
Definition wallet2.h:2137
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
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
Various Tools.
Definition tools.cpp:31
const GenericPointer< typename T::ValueType > T2 value
Definition pointer.h:1225
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1124
void serialize(Archive &a, unsigned_tx_set &x, const boost::serialization::version_type ver)
#define BEGIN_SERIALIZE_OBJECT()
#define true
#define FIELD(f)
#define false
#define END_SERIALIZE()
CXA_THROW_INFO_T void(* dest)(void *))
CXA_THROW_INFO_T * info
unsigned short uint16_t
Definition stdint.h:125
signed __int64 int64_t
Definition stdint.h:135
unsigned int uint32_t
Definition stdint.h:126
unsigned char uint8_t
Definition stdint.h:124
unsigned __int64 uint64_t
Definition stdint.h:136
uint64_t amount
account_public_address addr
uint64_t amount
size_t real_output
std::vector< output_entry > outputs
std::pair< uint64_t, rct::ctkey > output_entry
size_t real_output_in_tx_index
RangeProofType range_proof_type
Definition rctTypes.h:237
epee::misc_utils::struct_init< response_t > response
epee::misc_utils::struct_init< response_t > response
cryptonote::account_public_address addr_for_dust
Definition wallet2.h:166
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
uint64_t dust_threshold
Definition wallet2.h:164
cryptonote::account_public_address m_address
Definition wallet2.h:546
std::vector< std::pair< crypto::key_image, std::vector< uint64_t > > > m_rings
Definition wallet2.h:406
confirmed_transfer_details(const unconfirmed_transfer_details &utd, uint64_t height)
Definition wallet2.h:411
std::vector< cryptonote::tx_destination_entry > m_dests
Definition wallet2.h:400
std::vector< boost::optional< cryptonote::subaddress_receive_info > > received
Definition wallet2.h:577
crypto::public_key pkey
Definition wallet2.h:575
crypto::key_derivation derivation
Definition wallet2.h:576
crypto::public_key m_signer
Definition wallet2.h:277
std::vector< crypto::key_image > m_partial_key_images
Definition wallet2.h:279
std::vector< LR > m_LR
Definition wallet2.h:278
std::unordered_set< crypto::public_key > ignore
Definition wallet2.h:455
rct::multisig_out msout
Definition wallet2.h:458
std::unordered_set< crypto::public_key > signing_keys
Definition wallet2.h:457
std::unordered_set< rct::key > used_L
Definition wallet2.h:456
std::unordered_set< crypto::public_key > m_signers
Definition wallet2.h:513
std::vector< pending_tx > m_ptx
Definition wallet2.h:512
cryptonote::COMMAND_RPC_GET_BLOCKS_FAST::block_output_indices o_indices
Definition wallet2.h:569
cryptonote::block block
Definition wallet2.h:567
std::vector< cryptonote::transaction > txes
Definition wallet2.h:568
cryptonote::subaddress_index m_subaddr_index
Definition wallet2.h:362
tx_construction_data construction_data
Definition wallet2.h:477
std::vector< size_t > selected_transfers
Definition wallet2.h:470
crypto::secret_key tx_key
Definition wallet2.h:472
std::vector< cryptonote::tx_destination_entry > dests
Definition wallet2.h:474
std::vector< multisig_sig > multisig_sigs
Definition wallet2.h:475
cryptonote::transaction tx
Definition wallet2.h:466
std::vector< crypto::secret_key > additional_tx_keys
Definition wallet2.h:473
cryptonote::tx_destination_entry change_dts
Definition wallet2.h:469
Definition wallet2.h:553
crypto::public_key shared_secret
Definition wallet2.h:556
crypto::signature key_image_sig
Definition wallet2.h:559
crypto::signature shared_secret_sig
Definition wallet2.h:558
uint64_t index_in_tx
Definition wallet2.h:555
crypto::key_image key_image
Definition wallet2.h:557
crypto::hash txid
Definition wallet2.h:554
std::unordered_map< crypto::public_key, crypto::key_image > tx_key_images
Definition wallet2.h:507
std::vector< crypto::key_image > key_images
Definition wallet2.h:506
std::vector< pending_tx > ptx
Definition wallet2.h:505
const crypto::public_key & get_public_key() const
Definition wallet2.h:326
crypto::key_image m_key_image
Definition wallet2.h:311
std::vector< std::pair< uint64_t, crypto::hash > > m_uses
Definition wallet2.h:322
const std::pair< crypto::hash, size_t > get_chainstate_index() const
Definition wallet2.h:327
std::vector< multisig_info > m_multisig_info
Definition wallet2.h:321
cryptonote::subaddress_index m_subaddr_index
Definition wallet2.h:318
cryptonote::transaction_prefix m_tx
Definition wallet2.h:304
std::vector< rct::key > m_multisig_k
Definition wallet2.h:320
std::vector< cryptonote::tx_extra_field > tx_extra_fields
Definition wallet2.h:593
std::vector< is_out_data > primary
Definition wallet2.h:589
std::vector< is_out_data > public_outs
Definition wallet2.h:596
std::vector< is_out_data > additional
Definition wallet2.h:590
std::vector< uint8_t > extra
Definition wallet2.h:426
std::vector< cryptonote::tx_source_entry > sources
Definition wallet2.h:422
std::vector< cryptonote::tx_destination_entry > splitted_dsts
Definition wallet2.h:424
std::vector< cryptonote::tx_destination_entry > dests
Definition wallet2.h:430
std::vector< size_t > selected_transfers
Definition wallet2.h:425
std::set< uint32_t > subaddr_indices
Definition wallet2.h:432
cryptonote::tx_destination_entry change_dts
Definition wallet2.h:423
boost::optional< cryptonote::subaddress_receive_info > received
Definition wallet2.h:296
cryptonote::keypair in_ephemeral
Definition wallet2.h:290
enum tools::wallet2::unconfirmed_transfer_details::@320170243027143365014242201170062371014272002365 m_state
cryptonote::transaction_prefix m_tx
Definition wallet2.h:380
std::vector< std::pair< crypto::key_image, std::vector< uint64_t > > > m_rings
Definition wallet2.h:391
std::vector< cryptonote::tx_destination_entry > m_dests
Definition wallet2.h:385
std::vector< tx_construction_data > txes
Definition wallet2.h:499
std::pair< size_t, wallet2::transfer_container > transfers
Definition wallet2.h:500
struct hash_func hashes[]
const char * address
Definition multisig.cpp:37
const char * spendkey
Definition multisig.cpp:38
string daemon_address
Definition transfers.cpp:42
#define T(x)