Monero
wallet.h
Go to the documentation of this file.
1 // Copyright (c) 2014-2022, The Monero Project
2 //
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without modification, are
6 // permitted provided that the following conditions are met:
7 //
8 // 1. Redistributions of source code must retain the above copyright notice, this list of
9 // conditions and the following disclaimer.
10 //
11 // 2. Redistributions in binary form must reproduce the above copyright notice, this list
12 // of conditions and the following disclaimer in the documentation and/or other
13 // materials provided with the distribution.
14 //
15 // 3. Neither the name of the copyright holder nor the names of its contributors may be
16 // used to endorse or promote products derived from this software without specific
17 // prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
20 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
22 // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26 // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
27 // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 //
29 // Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
30 
31 #ifndef WALLET_IMPL_H
32 #define WALLET_IMPL_H
33 
34 #include "wallet/api/wallet2_api.h"
35 #include "wallet/wallet2.h"
36 
37 #include <string>
38 #include <boost/thread/mutex.hpp>
39 #include <boost/thread/thread.hpp>
40 #include <boost/thread/condition_variable.hpp>
41 
42 
43 namespace Monero {
44 class TransactionHistoryImpl;
45 class PendingTransactionImpl;
46 class UnsignedTransactionImpl;
47 class AddressBookImpl;
48 class SubaddressImpl;
49 class SubaddressAccountImpl;
50 struct Wallet2CallbackImpl;
51 
52 class WalletImpl : public Wallet
53 {
54 public:
55  WalletImpl(NetworkType nettype = MAINNET, uint64_t kdf_rounds = 1);
56  ~WalletImpl();
57  bool create(const std::string &path, const std::string &password,
58  const std::string &language);
59  bool createWatchOnly(const std::string &path, const std::string &password,
60  const std::string &language) const override;
61  bool open(const std::string &path, const std::string &password);
62  bool recover(const std::string &path,const std::string &password,
63  const std::string &seed, const std::string &seed_offset = {});
65  const std::string &password,
66  const std::string &language,
67  const std::string &address_string,
68  const std::string &viewkey_string,
69  const std::string &spendkey_string = "");
70  // following two methods are deprecated since they create passwordless wallets
71  // use the two equivalent methods above
72  bool recover(const std::string &path, const std::string &seed);
73  // deprecated: use recoverFromKeysWithPassword() instead
74  bool recoverFromKeys(const std::string &path,
75  const std::string &language,
76  const std::string &address_string,
77  const std::string &viewkey_string,
78  const std::string &spendkey_string = "");
80  const std::string &password,
81  const std::string &device_name);
82  Device getDeviceType() const override;
83  bool close(bool store = true);
84  std::string seed(const std::string& seed_offset = "") const override;
85  std::string getSeedLanguage() const override;
86  void setSeedLanguage(const std::string &arg) override;
87  // void setListener(Listener *) {}
88  int status() const override;
89  std::string errorString() const override;
90  void statusWithErrorString(int& status, std::string& errorString) const override;
91  bool setPassword(const std::string &password) override;
92  const std::string& getPassword() const override;
93  bool setDevicePin(const std::string &password) override;
94  bool setDevicePassphrase(const std::string &password) override;
95  std::string address(uint32_t accountIndex = 0, uint32_t addressIndex = 0) const override;
96  std::string integratedAddress(const std::string &payment_id) const override;
97  std::string secretViewKey() const override;
98  std::string publicViewKey() const override;
99  std::string secretSpendKey() const override;
100  std::string publicSpendKey() const override;
101  std::string publicMultisigSignerKey() const override;
102  std::string path() const override;
103  void stop() override;
104  bool store(const std::string &path) override;
105  std::string filename() const override;
106  std::string keysFilename() const override;
107  bool init(const std::string &daemon_address, uint64_t upper_transaction_size_limit = 0, const std::string &daemon_username = "", const std::string &daemon_password = "", bool use_ssl = false, bool lightWallet = false, const std::string &proxy_address = "") override;
108  bool connectToDaemon() override;
109  ConnectionStatus connected() const override;
110  void setTrustedDaemon(bool arg) override;
111  bool trustedDaemon() const override;
112  bool setProxy(const std::string &address) override;
113  uint64_t balance(uint32_t accountIndex = 0) const override;
114  uint64_t unlockedBalance(uint32_t accountIndex = 0) const override;
115  uint64_t blockChainHeight() const override;
116  uint64_t approximateBlockChainHeight() const override;
117  uint64_t estimateBlockChainHeight() const override;
118  uint64_t daemonBlockChainHeight() const override;
119  uint64_t daemonBlockChainTargetHeight() const override;
120  bool synchronized() const override;
121  bool refresh() override;
122  void refreshAsync() override;
123  bool rescanBlockchain() override;
124  void rescanBlockchainAsync() override;
125  void setAutoRefreshInterval(int millis) override;
126  int autoRefreshInterval() const override;
127  void setRefreshFromBlockHeight(uint64_t refresh_from_block_height) override;
128  uint64_t getRefreshFromBlockHeight() const override { return m_wallet->get_refresh_from_block_height(); };
129  void setRecoveringFromSeed(bool recoveringFromSeed) override;
130  void setRecoveringFromDevice(bool recoveringFromDevice) override;
131  void setSubaddressLookahead(uint32_t major, uint32_t minor) override;
132  bool watchOnly() const override;
133  bool isDeterministic() const override;
134  bool rescanSpent() override;
135  NetworkType nettype() const override {return static_cast<NetworkType>(m_wallet->nettype());}
136  void hardForkInfo(uint8_t &version, uint64_t &earliest_height) const override;
137  bool useForkRules(uint8_t version, int64_t early_blocks) const override;
138 
139  void addSubaddressAccount(const std::string& label) override;
140  size_t numSubaddressAccounts() const override;
141  size_t numSubaddresses(uint32_t accountIndex) const override;
142  void addSubaddress(uint32_t accountIndex, const std::string& label) override;
143  std::string getSubaddressLabel(uint32_t accountIndex, uint32_t addressIndex) const override;
144  void setSubaddressLabel(uint32_t accountIndex, uint32_t addressIndex, const std::string &label) override;
145 
146  MultisigState multisig() const override;
147  std::string getMultisigInfo() const override;
148  std::string makeMultisig(const std::vector<std::string>& info, uint32_t threshold) override;
149  std::string exchangeMultisigKeys(const std::vector<std::string> &info, const bool force_update_use_with_caution = false) override;
150  bool exportMultisigImages(std::string& images) override;
151  size_t importMultisigImages(const std::vector<std::string>& images) override;
152  bool hasMultisigPartialKeyImages() const override;
153  PendingTransaction* restoreMultisigTransaction(const std::string& signData) override;
154 
155  PendingTransaction * createTransactionMultDest(const std::vector<std::string> &dst_addr, const std::string &payment_id,
156  optional<std::vector<uint64_t>> amount, uint32_t mixin_count,
158  uint32_t subaddr_account = 0,
159  std::set<uint32_t> subaddr_indices = {}) override;
160  PendingTransaction * createTransaction(const std::string &dst_addr, const std::string &payment_id,
161  optional<uint64_t> amount, uint32_t mixin_count,
163  uint32_t subaddr_account = 0,
164  std::set<uint32_t> subaddr_indices = {}) override;
165  virtual PendingTransaction * createSweepUnmixableTransaction() override;
166  bool submitTransaction(const std::string &fileName) override;
167  virtual UnsignedTransaction * loadUnsignedTx(const std::string &unsigned_filename) override;
168  bool exportKeyImages(const std::string &filename, bool all = false) override;
169  bool importKeyImages(const std::string &filename) override;
170  bool exportOutputs(const std::string &filename, bool all = false) override;
171  bool importOutputs(const std::string &filename) override;
172  bool scanTransactions(const std::vector<std::string> &txids) override;
173 
174  bool setupBackgroundSync(const BackgroundSyncType background_sync_type, const std::string &wallet_password, const optional<std::string> &background_cache_password = optional<std::string>()) override;
175  BackgroundSyncType getBackgroundSyncType() const override;
176  bool startBackgroundSync() override;
177  bool stopBackgroundSync(const std::string &wallet_password) override;
178  bool isBackgroundSyncing() const override;
179  bool isBackgroundWallet() const override;
180 
181  virtual void disposeTransaction(PendingTransaction * t) override;
182  virtual uint64_t estimateTransactionFee(const std::vector<std::pair<std::string, uint64_t>> &destinations,
183  PendingTransaction::Priority priority) const override;
184  virtual TransactionHistory * history() override;
185  virtual AddressBook * addressBook() override;
186  virtual Subaddress * subaddress() override;
187  virtual SubaddressAccount * subaddressAccount() override;
188  virtual void setListener(WalletListener * l) override;
189  virtual uint32_t defaultMixin() const override;
190  virtual void setDefaultMixin(uint32_t arg) override;
191 
192  virtual bool setCacheAttribute(const std::string &key, const std::string &val) override;
193  virtual std::string getCacheAttribute(const std::string &key) const override;
194 
195  virtual void setOffline(bool offline) override;
196  virtual bool isOffline() const override;
197 
198  virtual bool setUserNote(const std::string &txid, const std::string &note) override;
199  virtual std::string getUserNote(const std::string &txid) const override;
200  virtual std::string getTxKey(const std::string &txid) const override;
201  virtual bool checkTxKey(const std::string &txid, std::string tx_key, const std::string &address, uint64_t &received, bool &in_pool, uint64_t &confirmations) override;
202  virtual std::string getTxProof(const std::string &txid, const std::string &address, const std::string &message) const override;
203  virtual bool checkTxProof(const std::string &txid, const std::string &address, const std::string &message, const std::string &signature, bool &good, uint64_t &received, bool &in_pool, uint64_t &confirmations) override;
204  virtual std::string getSpendProof(const std::string &txid, const std::string &message) const override;
205  virtual bool checkSpendProof(const std::string &txid, const std::string &message, const std::string &signature, bool &good) const override;
206  virtual std::string getReserveProof(bool all, uint32_t account_index, uint64_t amount, const std::string &message) const override;
207  virtual bool checkReserveProof(const std::string &address, const std::string &message, const std::string &signature, bool &good, uint64_t &total, uint64_t &spent) const override;
208  virtual std::string signMessage(const std::string &message, const std::string &address) override;
209  virtual bool verifySignedMessage(const std::string &message, const std::string &address, const std::string &signature) const override;
210  virtual std::string signMultisigParticipant(const std::string &message) const override;
211  virtual bool verifyMessageWithPublicKey(const std::string &message, const std::string &publicKey, const std::string &signature) const override;
212  virtual void startRefresh() override;
213  virtual void pauseRefresh() override;
214  virtual 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) override;
215  virtual 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 override;
216  virtual std::string getDefaultDataDir() const override;
217  virtual bool lightWalletLogin(bool &isNewWallet) const override;
218  virtual bool lightWalletImportWalletRequest(std::string &payment_id, uint64_t &fee, bool &new_request, bool &request_fulfilled, std::string &payment_address, std::string &status) override;
219  virtual bool blackballOutputs(const std::vector<std::string> &outputs, bool add) override;
220  virtual bool blackballOutput(const std::string &amount, const std::string &offset) override;
221  virtual bool unblackballOutput(const std::string &amount, const std::string &offset) override;
222  virtual bool getRing(const std::string &key_image, std::vector<uint64_t> &ring) const override;
223  virtual bool getRings(const std::string &txid, std::vector<std::pair<std::string, std::vector<uint64_t>>> &rings) const override;
224  virtual bool setRing(const std::string &key_image, const std::vector<uint64_t> &ring, bool relative) override;
225  virtual void segregatePreForkOutputs(bool segregate) override;
226  virtual void segregationHeight(uint64_t height) override;
227  virtual void keyReuseMitigation2(bool mitigation) override;
228  virtual bool lockKeysFile() override;
229  virtual bool unlockKeysFile() override;
230  virtual bool isKeysFileLocked() override;
231  virtual uint64_t coldKeyImageSync(uint64_t &spent, uint64_t &unspent) override;
232  virtual void deviceShowAddress(uint32_t accountIndex, uint32_t addressIndex, const std::string &paymentId) override;
233  virtual bool reconnectDevice() override;
234  virtual uint64_t getBytesReceived() override;
235  virtual uint64_t getBytesSent() override;
236 
237 private:
238  void clearStatus() const;
239  void setStatusError(const std::string& message) const;
240  void setStatusCritical(const std::string& message) const;
241  void setStatus(int status, const std::string& message) const;
242  void refreshThreadFunc();
243  void doRefresh();
244  bool daemonSynced() const;
245  void stopRefresh();
246  bool isNewWallet() const;
248  bool doInit(const std::string &daemon_address, const std::string &proxy_address, uint64_t upper_transaction_size_limit = 0, bool ssl = false);
249  bool checkBackgroundSync(const std::string &message) const;
250 
251 private:
253  friend class UnsignedTransactionImpl;
255  friend struct Wallet2CallbackImpl;
256  friend class AddressBookImpl;
257  friend class SubaddressImpl;
258  friend class SubaddressAccountImpl;
259 
260  std::unique_ptr<tools::wallet2> m_wallet;
261  mutable boost::mutex m_statusMutex;
262  mutable int m_status;
264  // TODO: harden password handling in the wallet API, see relevant discussion
265  // https://github.com/monero-project/monero-gui/issues/1537
266  // https://github.com/feather-wallet/feather/issues/72#issuecomment-1405602142
267  // https://github.com/monero-project/monero/pull/8619#issuecomment-1632951461
269  std::unique_ptr<TransactionHistoryImpl> m_history;
270  std::unique_ptr<Wallet2CallbackImpl> m_wallet2Callback;
271  std::unique_ptr<AddressBookImpl> m_addressBook;
272  std::unique_ptr<SubaddressImpl> m_subaddress;
273  std::unique_ptr<SubaddressAccountImpl> m_subaddressAccount;
274 
275  // multi-threaded refresh stuff
276  std::atomic<bool> m_refreshEnabled;
277  std::atomic<bool> m_refreshThreadDone;
278  std::atomic<int> m_refreshIntervalMillis;
279  std::atomic<bool> m_refreshShouldRescan;
280  // synchronizing refresh loop;
281  boost::mutex m_refreshMutex;
282 
283  // synchronizing sync and async refresh
284  boost::mutex m_refreshMutex2;
285  boost::condition_variable m_refreshCV;
286  boost::thread m_refreshThread;
287  // flag indicating wallet is recovering from seed
288  // so it shouldn't be considered as new and pull blocks (slow-refresh)
289  // instead of pulling hashes (fast-refresh)
290  std::atomic<bool> m_recoveringFromSeed;
291  std::atomic<bool> m_recoveringFromDevice;
292  std::atomic<bool> m_synchronized;
293  std::atomic<bool> m_rebuildWalletCache;
294  // cache connection status to avoid unnecessary RPC calls
295  mutable std::atomic<bool> m_is_connected;
296  boost::optional<epee::net_utils::http::login> m_daemon_login{};
297 };
298 
299 
300 } // namespace
301 
302 #endif
virtual bool lightWalletLogin(bool &isNewWallet) const override
Light wallet authenticate and login.
Definition: wallet.cpp:999
WalletImpl(NetworkType nettype=MAINNET, uint64_t kdf_rounds=1)
Definition: wallet.cpp:453
virtual Subaddress * subaddress() override
Definition: wallet.cpp:1957
bool startBackgroundSync() override
startBackgroundSync - sync the chain in the background with just view key
Definition: wallet.cpp:1425
uint64_t daemonBlockChainHeight() const override
daemonBlockChainHeight - returns daemon blockchain height
Definition: wallet.cpp:1078
size_t importMultisigImages(const std::vector< std::string > &images) override
importMultisigImages - imports other participants&#39; multisig images
Definition: wallet.cpp:1581
bool setupBackgroundSync(const BackgroundSyncType background_sync_type, const std::string &wallet_password, const optional< std::string > &background_cache_password=optional< std::string >()) override
setupBackgroundSync - setup background sync mode with just a view key
Definition: wallet.cpp:1383
virtual bool setCacheAttribute(const std::string &key, const std::string &val) override
setCacheAttribute - attach an arbitrary string to a wallet cache attribute
Definition: wallet.cpp:1985
bool recoverFromKeysWithPassword(const std::string &path, const std::string &password, const std::string &language, const std::string &address_string, const std::string &viewkey_string, const std::string &spendkey_string="")
Definition: wallet.cpp:614
virtual UnsignedTransaction * loadUnsignedTx(const std::string &unsigned_filename) override
loadUnsignedTx - creates transaction from unsigned tx file
Definition: wallet.cpp:1182
std::string secretViewKey() const override
secretViewKey - returns secret view key
Definition: wallet.cpp:922
std::string getSubaddressLabel(uint32_t accountIndex, uint32_t addressIndex) const override
getSubaddressLabel - gets the label of the specified subaddress
Definition: wallet.cpp:1479
virtual void segregationHeight(uint64_t height) override
sets the height where segregation should occur
Definition: wallet.cpp:2793
void refreshAsync() override
refreshAsync - refreshes wallet asynchronously.
Definition: wallet.cpp:1141
std::unique_ptr< SubaddressImpl > m_subaddress
Definition: wallet.h:272
void statusWithErrorString(int &status, std::string &errorString) const override
returns both error and error string atomically. suggested to use in instead of status() and errorStri...
Definition: wallet.cpp:861
virtual std::string getTxProof(const std::string &txid, const std::string &address, const std::string &message) const override
Definition: wallet.cpp:2112
boost::optional< epee::net_utils::http::login > m_daemon_login
Definition: wallet.h:296
virtual 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 override
Definition: wallet.cpp:2601
Device
Definition: wallet2_api.h:430
std::string errorString() const override
in case error status, returns error string
Definition: wallet.cpp:855
bool exportMultisigImages(std::string &images) override
exportMultisigImages - exports transfers&#39; key images
Definition: wallet.cpp:1565
virtual 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) override
Definition: wallet.cpp:2596
void setRecoveringFromSeed(bool recoveringFromSeed) override
setRecoveringFromSeed - set state recover form seed
Definition: wallet.cpp:1036
void doRefresh()
Definition: wallet.cpp:2462
virtual bool lightWalletImportWalletRequest(std::string &payment_id, uint64_t &fee, bool &new_request, bool &request_fulfilled, std::string &payment_address, std::string &status) override
Initiates a light wallet import wallet request.
Definition: wallet.cpp:1004
::std::string string
Definition: gtest-port.h:1097
int m_status
Definition: wallet.h:262
l
Definition: base.py:3
virtual uint64_t estimateTransactionFee(const std::vector< std::pair< std::string, uint64_t >> &destinations, PendingTransaction::Priority priority) const override
Estimates transaction fee.
Definition: wallet.cpp:1925
void setRecoveringFromDevice(bool recoveringFromDevice) override
setRecoveringFromDevice - set state to recovering from device
Definition: wallet.cpp:1041
void setAutoRefreshInterval(int millis) override
setAutoRefreshInterval - setup interval for automatic refresh.
Definition: wallet.cpp:1166
t
Definition: console.py:33
void refreshThreadFunc()
Definition: wallet.cpp:2431
std::atomic< bool > m_recoveringFromSeed
Definition: wallet.h:290
void setStatus(int status, const std::string &message) const
Definition: wallet.cpp:2424
std::atomic< bool > m_rebuildWalletCache
Definition: wallet.h:293
virtual bool reconnectDevice() override
attempt to reconnect to hardware device
Definition: wallet.cpp:2840
bool createWatchOnly(const std::string &path, const std::string &password, const std::string &language) const override
createWatchOnly - Creates a watch only wallet
Definition: wallet.cpp:539
uint64_t estimateBlockChainHeight() const override
estimateBlockChainHeight - returns estimate blockchain height. More accurate than approximateBlockCha...
Definition: wallet.cpp:1073
void rescanBlockchainAsync() override
rescanBlockchainAsync - rescans wallet asynchronously, starting from genesys
Definition: wallet.cpp:1158
std::string publicMultisigSignerKey() const override
publicMultisigSignerKey - returns public signer key
Definition: wallet.cpp:942
std::string path() const override
Definition: wallet.cpp:952
virtual uint32_t defaultMixin() const override
defaultMixin - returns number of mixins used in transactions
Definition: wallet.cpp:1973
bool setDevicePassphrase(const std::string &password) override
Definition: wallet.cpp:897
bool recoverFromDevice(const std::string &path, const std::string &password, const std::string &device_name)
Definition: wallet.cpp:710
bool hasMultisigPartialKeyImages() const override
hasMultisigPartialKeyImages - checks if wallet needs to import multisig key images from other partici...
Definition: wallet.cpp:1609
const char * key
Definition: hmac_keccak.cpp:40
Definition: wallet2_api.h:58
bool daemonSynced() const
Definition: wallet.cpp:1119
uint64_t approximateBlockChainHeight() const override
approximateBlockChainHeight - returns approximate blockchain height calculated from date/time ...
Definition: wallet.cpp:1068
bool create(const std::string &path, const std::string &password, const std::string &language)
Definition: wallet.cpp:502
virtual bool unblackballOutput(const std::string &amount, const std::string &offset) override
unblackballs an output
Definition: wallet.cpp:2710
int status() const override
returns wallet status (Status_Ok | Status_Error)
Definition: wallet.cpp:849
std::unique_ptr< AddressBookImpl > m_addressBook
Definition: wallet.h:271
bool exportOutputs(const std::string &filename, bool all=false) override
importOutputs - exports outputs to file
Definition: wallet.cpp:1275
std::atomic< bool > m_is_connected
Definition: wallet.h:295
PendingTransaction * createTransactionMultDest(const std::vector< std::string > &dst_addr, const std::string &payment_id, optional< std::vector< uint64_t >> amount, uint32_t mixin_count, PendingTransaction::Priority priority=PendingTransaction::Priority_Low, uint32_t subaddr_account=0, std::set< uint32_t > subaddr_indices={}) override
createTransactionMultDest creates transaction with multiple destinations. if dst_addr is an integrate...
Definition: wallet.cpp:1661
virtual PendingTransaction * createSweepUnmixableTransaction() override
createSweepUnmixableTransaction creates transaction with unmixable outputs.
Definition: wallet.cpp:1835
std::string publicViewKey() const override
publicViewKey - returns public view key
Definition: wallet.cpp:927
std::tuple< uint64_t, uint64_t, std::vector< tools::wallet2::transfer_details > > outputs
Definition: cold-outputs.cpp:53
void setStatusCritical(const std::string &message) const
Definition: wallet.cpp:2419
Interface for wallet operations.
Definition: wallet2_api.h:428
virtual void pauseRefresh() override
pauseRefresh - pause refresh thread
Definition: wallet.cpp:2517
unsigned char uint8_t
Definition: stdint.h:124
virtual uint64_t getBytesReceived() override
get bytes received
Definition: wallet.cpp:2857
Definition: address_book.cpp:40
std::unique_ptr< TransactionHistoryImpl > m_history
Definition: wallet.h:269
bool watchOnly() const override
watchOnly - checks if wallet is watch only
Definition: wallet.cpp:2387
void setStatusError(const std::string &message) const
Definition: wallet.cpp:2414
boost::condition_variable m_refreshCV
Definition: wallet.h:285
Definition: wallet2_api.h:47
virtual bool verifySignedMessage(const std::string &message, const std::string &address, const std::string &signature) const override
verifySignedMessage - verify a signature matches a given message
Definition: wallet.cpp:2288
boost::thread m_refreshThread
Definition: wallet.h:286
virtual bool checkTxProof(const std::string &txid, const std::string &address, const std::string &message, const std::string &signature, bool &good, uint64_t &received, bool &in_pool, uint64_t &confirmations) override
Definition: wallet.cpp:2143
virtual std::string getSpendProof(const std::string &txid, const std::string &message) const override
Definition: wallet.cpp:2172
virtual SubaddressAccount * subaddressAccount() override
Definition: wallet.cpp:1962
std::string address(uint32_t accountIndex=0, uint32_t addressIndex=0) const override
Definition: wallet.cpp:908
bool setPassword(const std::string &password) override
Definition: wallet.cpp:867
std::string secretSpendKey() const override
secretSpendKey - returns secret spend key
Definition: wallet.cpp:932
bool setDevicePin(const std::string &password) override
Definition: wallet.cpp:886
bool importKeyImages(const std::string &filename) override
importKeyImages - imports key images from file
Definition: wallet.cpp:1250
virtual std::string getTxKey(const std::string &txid) const override
Definition: wallet.cpp:2025
virtual void keyReuseMitigation2(bool mitigation) override
secondary key reuse mitigation
Definition: wallet.cpp:2798
bool init(const std::string &daemon_address, uint64_t upper_transaction_size_limit=0, const std::string &daemon_username="", const std::string &daemon_password="", bool use_ssl=false, bool lightWallet=false, const std::string &proxy_address="") override
init - initializes wallet with daemon connection params. if daemon_address is local address...
Definition: wallet.cpp:990
boost::mutex m_refreshMutex2
Definition: wallet.h:284
std::unique_ptr< SubaddressAccountImpl > m_subaddressAccount
Definition: wallet.h:273
virtual void startRefresh() override
StartRefresh - Start/resume refresh thread (refresh every 10 seconds)
Definition: wallet.cpp:2496
Priority
Definition: wallet2_api.h:81
void setSeedLanguage(const std::string &arg) override
Definition: wallet.cpp:842
bool trustedDaemon() const override
Definition: wallet.cpp:2377
virtual bool isOffline() const override
Definition: wallet.cpp:2635
Device getDeviceType() const override
Queries backing device for wallet keys.
Definition: wallet.cpp:727
size_t numSubaddressAccounts() const override
numSubaddressAccounts - returns the number of existing subaddress accounts
Definition: wallet.cpp:1465
Definition: wallet2_api.h:83
virtual bool verifyMessageWithPublicKey(const std::string &message, const std::string &publicKey, const std::string &signature) const override
verifyMessageWithPublicKey verifies that message was signed with the given public key ...
Definition: wallet.cpp:2319
uint64_t balance(uint32_t accountIndex=0) const override
Definition: wallet.cpp:1051
MultisigState multisig() const override
multisig - returns current state of multisig wallet creation process
Definition: wallet.cpp:1509
Definition: subaddress.h:36
std::string publicSpendKey() const override
publicSpendKey - returns public spend key
Definition: wallet.cpp:937
virtual std::string signMessage(const std::string &message, const std::string &address) override
Definition: wallet.cpp:2265
virtual bool setUserNote(const std::string &txid, const std::string &note) override
setUserNote - attach an arbitrary string note to a txid
Definition: wallet.cpp:2000
std::atomic< int > m_refreshIntervalMillis
Definition: wallet.h:278
void setRefreshFromBlockHeight(uint64_t refresh_from_block_height) override
setRefreshFromBlockHeight - start refresh from block height on recover
Definition: wallet.cpp:1029
std::string m_password
Definition: wallet.h:268
static void add(ge_p3 &p3, const ge_cached &other)
Definition: multiexp.cc:144
std::string m_errorString
Definition: wallet.h:263
unsigned int uint32_t
Definition: stdint.h:126
int autoRefreshInterval() const override
autoRefreshInterval - returns automatic refresh interval in millis
Definition: wallet.cpp:1177
virtual uint64_t coldKeyImageSync(uint64_t &spent, uint64_t &unspent) override
cold-device protocol key image sync
Definition: wallet.cpp:2818
const std::string & getPassword() const override
Definition: wallet.cpp:881
static void error(const std::string &category, const std::string &str)
Definition: wallet.cpp:448
ConnectionStatus
Definition: wallet2_api.h:442
bool store(const std::string &path) override
store - stores wallet to file.
Definition: wallet.cpp:962
Definition: transaction_history.h:38
virtual uint64_t getBytesSent() override
get bytes sent
Definition: wallet.cpp:2862
virtual bool getRings(const std::string &txid, std::vector< std::pair< std::string, std::vector< uint64_t >>> &rings) const override
gets the rings used for a txid, if any
Definition: wallet.cpp:2749
bool close(bool store=true)
Definition: wallet.cpp:799
bool useForkRules(uint8_t version, int64_t early_blocks) const override
check if hard fork rules should be used
Definition: wallet.cpp:2645
bool isBackgroundWallet() const override
isBackgroundWallet - returns true if the wallet is a background wallet
Definition: wallet.cpp:2402
std::string filename() const override
filename - returns wallet filename
Definition: wallet.cpp:980
unsigned __int64 uint64_t
Definition: stdint.h:136
~WalletImpl()
Definition: wallet.cpp:483
virtual std::string signMultisigParticipant(const std::string &message) const override
signMultisigParticipant signs given message with the multisig public signer key
Definition: wallet.cpp:2298
void stop() override
stop - interrupts wallet refresh() loop once (doesn&#39;t stop background refresh thread) ...
Definition: wallet.cpp:957
virtual bool checkTxKey(const std::string &txid, std::string tx_key, const std::string &address, uint64_t &received, bool &in_pool, uint64_t &confirmations) override
Definition: wallet.cpp:2064
virtual void deviceShowAddress(uint32_t accountIndex, uint32_t addressIndex, const std::string &paymentId) override
shows address on device display
Definition: wallet.cpp:2823
virtual bool checkReserveProof(const std::string &address, const std::string &message, const std::string &signature, bool &good, uint64_t &total, uint64_t &spent) const override
Definition: wallet.cpp:2238
Definition: wallet.h:52
NetworkType
Definition: wallet2_api.h:46
void setSubaddressLookahead(uint32_t major, uint32_t minor) override
setSubaddressLookahead - set size of subaddress lookahead
Definition: wallet.cpp:1046
std::string seed(const std::string &seed_offset="") const override
Definition: wallet.cpp:827
virtual bool getRing(const std::string &key_image, std::vector< uint64_t > &ring) const override
gets the ring used for a key image, if any
Definition: wallet.cpp:2732
bool importOutputs(const std::string &filename) override
importOutputs - imports outputs from file
Definition: wallet.cpp:1307
virtual std::string getCacheAttribute(const std::string &key) const override
getCacheAttribute - return an arbitrary string attached to a wallet cache attribute ...
Definition: wallet.cpp:1993
uint64_t blockChainHeight() const override
blockChainHeight - returns current blockchain height
Definition: wallet.cpp:1061
bool refresh() override
refresh - refreshes the wallet, updating transactions from daemon
Definition: wallet.cpp:1132
std::atomic< bool > m_refreshShouldRescan
Definition: wallet.h:279
version
Supported socks variants.
Definition: socks.h:57
virtual bool lockKeysFile() override
locks/unlocks the keys file; returns true on success
Definition: wallet.cpp:2803
void pendingTxPostProcess(PendingTransactionImpl *pending)
Definition: wallet.cpp:2537
boost::mutex m_statusMutex
Definition: wallet.h:261
bool open(const std::string &path, const std::string &password)
Definition: wallet.cpp:732
std::string getSeedLanguage() const override
Definition: wallet.cpp:837
bool connectToDaemon() override
connectToDaemon - connects to the daemon. TODO: check if it can be removed
Definition: wallet.cpp:2342
Definition: pending_transaction.h:41
virtual std::string getReserveProof(bool all, uint32_t account_index, uint64_t amount, const std::string &message) const override
getReserveProof - Generates a proof that proves the reserve of unspent funds Parameters account_index...
Definition: wallet.cpp:2217
ConnectionStatus connected() const override
connected - checks if the wallet connected to the daemon
Definition: wallet.cpp:2354
virtual void disposeTransaction(PendingTransaction *t) override
disposeTransaction - destroys transaction object
Definition: wallet.cpp:1920
NetworkType nettype() const override
Definition: wallet.h:135
PendingTransaction * restoreMultisigTransaction(const std::string &signData) override
restoreMultisigTransaction creates PendingTransaction from signData
Definition: wallet.cpp:1623
std::string getMultisigInfo() const override
getMultisigInfo
Definition: wallet.cpp:1518
POD_CLASS signature
Definition: crypto.h:98
Definition: subaddress_account.h:36
bool stopBackgroundSync(const std::string &wallet_password) override
stopBackgroundSync - bring back spend key and process background synced txs
Definition: wallet.cpp:1442
virtual void setOffline(bool offline) override
Definition: wallet.cpp:2630
virtual bool blackballOutputs(const std::vector< std::string > &outputs, bool add) override
blackballs a set of outputs
Definition: wallet.cpp:2650
virtual void setListener(WalletListener *l) override
Definition: wallet.cpp:1967
bool scanTransactions(const std::vector< std::string > &txids) override
scanTransactions - scan a list of transaction ids, this operation may reveal the txids to the remote ...
Definition: wallet.cpp:1341
string daemon_address
Definition: transfers.cpp:41
std::atomic< bool > m_refreshThreadDone
Definition: wallet.h:277
BackgroundSyncType getBackgroundSyncType() const override
getBackgroundSyncType - get mode the wallet background syncs in
Definition: wallet.cpp:1414
std::unique_ptr< tools::wallet2 > m_wallet
Definition: wallet.h:260
virtual void setDefaultMixin(uint32_t arg) override
setDefaultMixin - setum number of mixins to be used for new transactions
Definition: wallet.cpp:1978
std::string keysFilename() const override
keysFilename - returns keys filename. usually this formed as "wallet_filename".keys ...
Definition: wallet.cpp:985
bool rescanBlockchain() override
rescanBlockchain - rescans the wallet, updating transactions from daemon
Definition: wallet.cpp:1148
POD_CLASS key_image
Definition: crypto.h:92
virtual TransactionHistory * history() override
Definition: wallet.cpp:1947
std::string exchangeMultisigKeys(const std::vector< std::string > &info, const bool force_update_use_with_caution=false) override
exchange_multisig_keys - provides additional key exchange round for arbitrary multisig schemes (like ...
Definition: wallet.cpp:1551
BackgroundSyncType
Definition: wallet2_api.h:448
bool isBackgroundSyncing() const override
isBackgroundSyncing - returns true if the wallet is background syncing
Definition: wallet.cpp:2397
Definition: address_book.h:38
void addSubaddressAccount(const std::string &label) override
addSubaddressAccount - appends a new subaddress account at the end of the last major index of existin...
Definition: wallet.cpp:1459
virtual std::string getDefaultDataDir() const override
Definition: wallet.cpp:2606
virtual AddressBook * addressBook() override
Definition: wallet.cpp:1952
void setSubaddressLabel(uint32_t accountIndex, uint32_t addressIndex, const std::string &label) override
setSubaddressLabel - sets the label of the specified subaddress
Definition: wallet.cpp:1494
signed __int64 int64_t
Definition: stdint.h:135
std::string integratedAddress(const std::string &payment_id) const override
integratedAddress - returns integrated address for current wallet address and given payment_id...
Definition: wallet.cpp:913
virtual bool setRing(const std::string &key_image, const std::vector< uint64_t > &ring, bool relative) override
sets the ring used for a key image
Definition: wallet.cpp:2771
uint64_t unlockedBalance(uint32_t accountIndex=0) const override
Definition: wallet.cpp:1056
void hardForkInfo(uint8_t &version, uint64_t &earliest_height) const override
returns current hard fork info
Definition: wallet.cpp:2640
Transaction-like interface for sending money.
Definition: wallet2_api.h:73
Definition: wallet2_api.h:324
Definition: wallet.cpp:153
virtual void segregatePreForkOutputs(bool segregate) override
sets whether pre-fork outs are to be segregated
Definition: wallet.cpp:2788
Definition: uri.py:1
PendingTransaction * createTransaction(const std::string &dst_addr, const std::string &payment_id, optional< uint64_t > amount, uint32_t mixin_count, PendingTransaction::Priority priority=PendingTransaction::Priority_Low, uint32_t subaddr_account=0, std::set< uint32_t > subaddr_indices={}) override
createTransaction creates transaction. if dst_addr is an integrated address, payment_id is ignored ...
Definition: wallet.cpp:1828
uint64_t daemonBlockChainTargetHeight() const override
daemonBlockChainTargetHeight - returns daemon blockchain target height
Definition: wallet.cpp:1097
virtual bool isKeysFileLocked() override
returns true if the keys file is locked
Definition: wallet.cpp:2813
static int priority(Level level)
Definition: easylogging++.cc:2128
Definition: unsigned_transaction.h:41
static void info(const std::string &category, const std::string &str)
Definition: wallet.cpp:440
virtual bool unlockKeysFile() override
Definition: wallet.cpp:2808
bool exportKeyImages(const std::string &filename, bool all=false) override
exportKeyImages - exports key images to file
Definition: wallet.cpp:1223
bool isDeterministic() const override
isDeterministic - checks if wallet keys are deterministic
Definition: wallet.cpp:2392
friend class PendingTransactionImpl
Definition: wallet.h:252
std::unique_ptr< Wallet2CallbackImpl > m_wallet2Callback
Definition: wallet.h:270
bool recover(const std::string &path, const std::string &password, const std::string &seed, const std::string &seed_offset={})
Definition: wallet.cpp:763
virtual std::string getUserNote(const std::string &txid) const override
getUserNote - return an arbitrary string note attached to a txid
Definition: wallet.cpp:2013
std::atomic< bool > m_refreshEnabled
Definition: wallet.h:276
void clearStatus() const
Definition: wallet.cpp:2407
void stopRefresh()
Definition: wallet.cpp:2507
std::string makeMultisig(const std::vector< std::string > &info, uint32_t threshold) override
makeMultisig - switches wallet in multisig state. The one and only creation phase for N / N wallets ...
Definition: wallet.cpp:1532
std::atomic< bool > m_synchronized
Definition: wallet.h:292
tuple message
Definition: gtest_output_test.py:331
bool doInit(const std::string &daemon_address, const std::string &proxy_address, uint64_t upper_transaction_size_limit=0, bool ssl=false)
Definition: wallet.cpp:2552
bool setProxy(const std::string &address) override
Definition: wallet.cpp:2382
bool rescanSpent() override
Definition: wallet.cpp:2611
bool submitTransaction(const std::string &fileName) override
submitTransaction - submits transaction in signed tx file
Definition: wallet.cpp:1203
boost::mutex m_refreshMutex
Definition: wallet.h:281
void addSubaddress(uint32_t accountIndex, const std::string &label) override
addSubaddress - appends a new subaddress at the end of the last minor index of the specified subaddre...
Definition: wallet.cpp:1473
virtual bool checkSpendProof(const std::string &txid, const std::string &message, const std::string &signature, bool &good) const override
Definition: wallet.cpp:2195
void setTrustedDaemon(bool arg) override
Definition: wallet.cpp:2372
bool isNewWallet() const
Definition: wallet.cpp:2527
std::atomic< bool > m_recoveringFromDevice
Definition: wallet.h:291
bool recoverFromKeys(const std::string &path, const std::string &language, const std::string &address_string, const std::string &viewkey_string, const std::string &spendkey_string="")
Definition: wallet.cpp:605
uint64_t getRefreshFromBlockHeight() const override
getRestoreHeight - get wallet creation height
Definition: wallet.h:128
virtual bool blackballOutput(const std::string &amount, const std::string &offset) override
blackballs an output
Definition: wallet.cpp:2688
size_t numSubaddresses(uint32_t accountIndex) const override
numSubaddresses - returns the number of existing subaddresses associated with the specified subaddres...
Definition: wallet.cpp:1469
bool checkBackgroundSync(const std::string &message) const
Definition: wallet.cpp:2578