Monero
wallet.h
Go to the documentation of this file.
1 // Copyright (c) 2014-2018, 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);
64  bool recoverFromKeysWithPassword(const std::string &path,
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 = "");
79  bool recoverFromDevice(const std::string &path,
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 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  std::string address(uint32_t accountIndex = 0, uint32_t addressIndex = 0) const override;
93  std::string integratedAddress(const std::string &payment_id) const override;
94  std::string secretViewKey() const override;
95  std::string publicViewKey() const override;
96  std::string secretSpendKey() const override;
97  std::string publicSpendKey() const override;
98  std::string publicMultisigSignerKey() const override;
99  std::string path() const override;
100  bool store(const std::string &path) override;
101  std::string filename() const override;
102  std::string keysFilename() const override;
103  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) override;
104  bool connectToDaemon() override;
105  ConnectionStatus connected() const override;
106  void setTrustedDaemon(bool arg) override;
107  bool trustedDaemon() const override;
108  uint64_t balance(uint32_t accountIndex = 0) const override;
109  uint64_t unlockedBalance(uint32_t accountIndex = 0) const override;
110  uint64_t blockChainHeight() const override;
111  uint64_t approximateBlockChainHeight() const override;
112  uint64_t estimateBlockChainHeight() const override;
113  uint64_t daemonBlockChainHeight() const override;
114  uint64_t daemonBlockChainTargetHeight() const override;
115  bool synchronized() const override;
116  bool refresh() override;
117  void refreshAsync() override;
118  void setAutoRefreshInterval(int millis) override;
119  int autoRefreshInterval() const override;
120  void setRefreshFromBlockHeight(uint64_t refresh_from_block_height) override;
121  uint64_t getRefreshFromBlockHeight() const override { return m_wallet->get_refresh_from_block_height(); };
122  void setRecoveringFromSeed(bool recoveringFromSeed) override;
123  void setRecoveringFromDevice(bool recoveringFromDevice) override;
124  void setSubaddressLookahead(uint32_t major, uint32_t minor) override;
125  bool watchOnly() const override;
126  bool rescanSpent() override;
127  NetworkType nettype() const override {return static_cast<NetworkType>(m_wallet->nettype());}
128  void hardForkInfo(uint8_t &version, uint64_t &earliest_height) const override;
129  bool useForkRules(uint8_t version, int64_t early_blocks) const override;
130 
131  void addSubaddressAccount(const std::string& label) override;
132  size_t numSubaddressAccounts() const override;
133  size_t numSubaddresses(uint32_t accountIndex) const override;
134  void addSubaddress(uint32_t accountIndex, const std::string& label) override;
135  std::string getSubaddressLabel(uint32_t accountIndex, uint32_t addressIndex) const override;
136  void setSubaddressLabel(uint32_t accountIndex, uint32_t addressIndex, const std::string &label) override;
137 
138  MultisigState multisig() const override;
139  std::string getMultisigInfo() const override;
140  std::string makeMultisig(const std::vector<std::string>& info, uint32_t threshold) override;
141  std::string exchangeMultisigKeys(const std::vector<std::string> &info) override;
142  bool finalizeMultisig(const std::vector<std::string>& extraMultisigInfo) override;
143  bool exportMultisigImages(std::string& images) override;
144  size_t importMultisigImages(const std::vector<std::string>& images) override;
145  bool hasMultisigPartialKeyImages() const override;
146  PendingTransaction* restoreMultisigTransaction(const std::string& signData) override;
147 
148  PendingTransaction * createTransaction(const std::string &dst_addr, const std::string &payment_id,
149  optional<uint64_t> amount, uint32_t mixin_count,
151  uint32_t subaddr_account = 0,
152  std::set<uint32_t> subaddr_indices = {}) override;
153  virtual PendingTransaction * createSweepUnmixableTransaction() override;
154  bool submitTransaction(const std::string &fileName) override;
155  virtual UnsignedTransaction * loadUnsignedTx(const std::string &unsigned_filename) override;
156  bool exportKeyImages(const std::string &filename) override;
157  bool importKeyImages(const std::string &filename) override;
158 
159  virtual void disposeTransaction(PendingTransaction * t) override;
160  virtual TransactionHistory * history() override;
161  virtual AddressBook * addressBook() override;
162  virtual Subaddress * subaddress() override;
163  virtual SubaddressAccount * subaddressAccount() override;
164  virtual void setListener(WalletListener * l) override;
165  virtual uint32_t defaultMixin() const override;
166  virtual void setDefaultMixin(uint32_t arg) override;
167  virtual bool setUserNote(const std::string &txid, const std::string &note) override;
168  virtual std::string getUserNote(const std::string &txid) const override;
169  virtual std::string getTxKey(const std::string &txid) const override;
170  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;
171  virtual std::string getTxProof(const std::string &txid, const std::string &address, const std::string &message) const override;
172  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;
173  virtual std::string getSpendProof(const std::string &txid, const std::string &message) const override;
174  virtual bool checkSpendProof(const std::string &txid, const std::string &message, const std::string &signature, bool &good) const override;
175  virtual std::string getReserveProof(bool all, uint32_t account_index, uint64_t amount, const std::string &message) const override;
176  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;
177  virtual std::string signMessage(const std::string &message) override;
178  virtual bool verifySignedMessage(const std::string &message, const std::string &address, const std::string &signature) const override;
179  virtual std::string signMultisigParticipant(const std::string &message) const override;
180  virtual bool verifyMessageWithPublicKey(const std::string &message, const std::string &publicKey, const std::string &signature) const override;
181  virtual void startRefresh() override;
182  virtual void pauseRefresh() override;
183  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;
184  virtual std::string getDefaultDataDir() const override;
185  virtual bool lightWalletLogin(bool &isNewWallet) const override;
186  virtual bool lightWalletImportWalletRequest(std::string &payment_id, uint64_t &fee, bool &new_request, bool &request_fulfilled, std::string &payment_address, std::string &status) override;
187  virtual bool blackballOutputs(const std::vector<std::string> &outputs, bool add) override;
188  virtual bool blackballOutput(const std::string &amount, const std::string &offset) override;
189  virtual bool unblackballOutput(const std::string &amount, const std::string &offset) override;
190  virtual bool getRing(const std::string &key_image, std::vector<uint64_t> &ring) const override;
191  virtual bool getRings(const std::string &txid, std::vector<std::pair<std::string, std::vector<uint64_t>>> &rings) const override;
192  virtual bool setRing(const std::string &key_image, const std::vector<uint64_t> &ring, bool relative) override;
193  virtual void segregatePreForkOutputs(bool segregate) override;
194  virtual void segregationHeight(uint64_t height) override;
195  virtual void keyReuseMitigation2(bool mitigation) override;
196  virtual bool lockKeysFile() override;
197  virtual bool unlockKeysFile() override;
198  virtual bool isKeysFileLocked() override;
199 
200 private:
201  void clearStatus() const;
202  void setStatusError(const std::string& message) const;
203  void setStatusCritical(const std::string& message) const;
204  void setStatus(int status, const std::string& message) const;
205  void refreshThreadFunc();
206  void doRefresh();
207  bool daemonSynced() const;
208  void stopRefresh();
209  bool isNewWallet() const;
210  bool doInit(const std::string &daemon_address, uint64_t upper_transaction_size_limit = 0, bool ssl = false);
211 
212 private:
214  friend class UnsignedTransactionImpl;
216  friend struct Wallet2CallbackImpl;
217  friend class AddressBookImpl;
218  friend class SubaddressImpl;
219  friend class SubaddressAccountImpl;
220 
221  std::unique_ptr<tools::wallet2> m_wallet;
222  mutable boost::mutex m_statusMutex;
223  mutable int m_status;
224  mutable std::string m_errorString;
225  std::string m_password;
226  std::unique_ptr<TransactionHistoryImpl> m_history;
227  std::unique_ptr<Wallet2CallbackImpl> m_wallet2Callback;
228  std::unique_ptr<AddressBookImpl> m_addressBook;
229  std::unique_ptr<SubaddressImpl> m_subaddress;
230  std::unique_ptr<SubaddressAccountImpl> m_subaddressAccount;
231 
232  // multi-threaded refresh stuff
233  std::atomic<bool> m_refreshEnabled;
234  std::atomic<bool> m_refreshThreadDone;
235  std::atomic<int> m_refreshIntervalMillis;
236  // synchronizing refresh loop;
237  boost::mutex m_refreshMutex;
238 
239  // synchronizing sync and async refresh
240  boost::mutex m_refreshMutex2;
241  boost::condition_variable m_refreshCV;
242  boost::thread m_refreshThread;
243  // flag indicating wallet is recovering from seed
244  // so it shouldn't be considered as new and pull blocks (slow-refresh)
245  // instead of pulling hashes (fast-refresh)
246  std::atomic<bool> m_recoveringFromSeed;
247  std::atomic<bool> m_recoveringFromDevice;
248  std::atomic<bool> m_synchronized;
249  std::atomic<bool> m_rebuildWalletCache;
250  // cache connection status to avoid unnecessary RPC calls
251  mutable std::atomic<bool> m_is_connected;
252  boost::optional<epee::net_utils::http::login> m_daemon_login{};
253 };
254 
255 
256 } // namespace
257 
258 namespace Bitmonero = Monero;
259 
260 #endif
261 
virtual bool lightWalletLogin(bool &isNewWallet) const override
Light wallet authenticate and login.
Definition: wallet.cpp:873
WalletImpl(NetworkType nettype=MAINNET, uint64_t kdf_rounds=1)
Definition: wallet.cpp:375
virtual Subaddress * subaddress() override
Definition: wallet.cpp:1585
uint64_t daemonBlockChainHeight() const override
daemonBlockChainHeight - returns daemon blockchain height
Definition: wallet.cpp:950
size_t importMultisigImages(const std::vector< std::string > &images) override
importMultisigImages - imports other participants' multisig images
Definition: wallet.cpp:1245
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:530
virtual UnsignedTransaction * loadUnsignedTx(const std::string &unsigned_filename) override
loadUnsignedTx - creates transaction from unsigned tx file
Definition: wallet.cpp:1036
std::string secretViewKey() const override
secretViewKey - returns secret view key
Definition: wallet.cpp:801
std::string getSubaddressLabel(uint32_t accountIndex, uint32_t addressIndex) const override
getSubaddressLabel - gets the label of the specified subaddress
Definition: wallet.cpp:1135
virtual void segregationHeight(uint64_t height) override
sets the height where segregation should occur
Definition: wallet.cpp:2283
void refreshAsync() override
refreshAsync - refreshes wallet asynchronously.
Definition: wallet.cpp:1013
std::unique_ptr< SubaddressImpl > m_subaddress
Definition: wallet.h:229
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:769
virtual std::string getTxProof(const std::string &txid, const std::string &address, const std::string &message) const override
Definition: wallet.cpp:1707
boost::optional< epee::net_utils::http::login > m_daemon_login
Definition: wallet.h:252
Device
Definition: wallet2_api.h:376
std::string errorString() const override
in case error status, returns error string
Definition: wallet.cpp:763
bool exportMultisigImages(std::string &images) override
exportMultisigImages - exports transfers' key images
Definition: wallet.cpp:1229
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:2102
void setRecoveringFromSeed(bool recoveringFromSeed) override
setRecoveringFromSeed - set state recover form seed
Definition: wallet.cpp:908
bool finalizeMultisig(const std::vector< std::string > &extraMultisigInfo) override
finalizeMultisig - finalizes N - 1 / N multisig wallets creation
Definition: wallet.cpp:1211
void doRefresh()
Definition: wallet.cpp:2003
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:878
int m_status
Definition: wallet.h:223
void setRecoveringFromDevice(bool recoveringFromDevice) override
setRecoveringFromDevice - set state to recovering from device
Definition: wallet.cpp:913
void setAutoRefreshInterval(int millis) override
setAutoRefreshInterval - setup interval for automatic refresh.
Definition: wallet.cpp:1020
uint64_t height
Definition: blockchain.cpp:89
void refreshThreadFunc()
Definition: wallet.cpp:1973
std::atomic< bool > m_recoveringFromSeed
Definition: wallet.h:246
void setStatus(int status, const std::string &message) const
Definition: wallet.cpp:1966
std::atomic< bool > m_rebuildWalletCache
Definition: wallet.h:249
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:455
uint64_t estimateBlockChainHeight() const override
estimateBlockChainHeight - returns estimate blockchain height. More accurate than approximateBlockCha...
Definition: wallet.cpp:945
std::string publicMultisigSignerKey() const override
publicMultisigSignerKey - returns public signer key
Definition: wallet.cpp:821
std::string path() const override
Definition: wallet.cpp:831
virtual uint32_t defaultMixin() const override
defaultMixin - returns number of mixins used in transactions
Definition: wallet.cpp:1601
bool recoverFromDevice(const std::string &path, const std::string &password, const std::string &device_name)
Definition: wallet.cpp:626
bool hasMultisigPartialKeyImages() const override
hasMultisigPartialKeyImages - checks if wallet needs to import multisig key images from other partici...
Definition: wallet.cpp:1273
Definition: wallet2_api.h:56
bool daemonSynced() const
Definition: wallet.cpp:991
uint64_t approximateBlockChainHeight() const override
approximateBlockChainHeight - returns approximate blockchain height calculated from date/time
Definition: wallet.cpp:940
bool create(const std::string &path, const std::string &password, const std::string &language)
Definition: wallet.cpp:418
virtual bool unblackballOutput(const std::string &amount, const std::string &offset) override
unblackballs an output
Definition: wallet.cpp:2200
int status() const override
returns wallet status (Status_Ok | Status_Error)
Definition: wallet.cpp:757
std::unique_ptr< AddressBookImpl > m_addressBook
Definition: wallet.h:228
std::atomic< bool > m_is_connected
Definition: wallet.h:251
virtual PendingTransaction * createSweepUnmixableTransaction() override
createSweepUnmixableTransaction creates transaction with unmixable outputs.
Definition: wallet.cpp:1488
std::string publicViewKey() const override
publicViewKey - returns public view key
Definition: wallet.cpp:806
void setStatusCritical(const std::string &message) const
Definition: wallet.cpp:1961
Interface for wallet operations. TODO: check if /include/IWallet.h is still actual.
Definition: wallet2_api.h:374
virtual void pauseRefresh() override
pauseRefresh - pause refresh thread
Definition: wallet.cpp:2055
Definition: address_book.cpp:40
std::unique_ptr< TransactionHistoryImpl > m_history
Definition: wallet.h:226
bool watchOnly() const override
watchOnly - checks if wallet is watch only
Definition: wallet.cpp:1944
void setStatusError(const std::string &message) const
Definition: wallet.cpp:1956
boost::condition_variable m_refreshCV
Definition: wallet.h:241
Definition: wallet2_api.h:45
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:1856
bool exportKeyImages(const std::string &filename) override
exportKeyImages - exports key images to file
Definition: wallet.cpp:1071
boost::thread m_refreshThread
Definition: wallet.h:242
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:1735
bool recover(const std::string &path, const std::string &password, const std::string &seed)
Definition: wallet.cpp:679
virtual std::string getSpendProof(const std::string &txid, const std::string &message) const override
Definition: wallet.cpp:1764
virtual SubaddressAccount * subaddressAccount() override
Definition: wallet.cpp:1590
std::string address(uint32_t accountIndex=0, uint32_t addressIndex=0) const override
Definition: wallet.cpp:787
bool setPassword(const std::string &password) override
Definition: wallet.cpp:775
std::string secretSpendKey() const override
secretSpendKey - returns secret spend key
Definition: wallet.cpp:811
bool importKeyImages(const std::string &filename) override
importKeyImages - imports key images from file
Definition: wallet.cpp:1096
virtual std::string getTxKey(const std::string &txid) const override
Definition: wallet.cpp:1632
virtual void keyReuseMitigation2(bool mitigation) override
secondary key reuse mitigation
Definition: wallet.cpp:2288
std::string seed() const override
Definition: wallet.cpp:739
boost::mutex m_refreshMutex2
Definition: wallet.h:240
std::unique_ptr< SubaddressAccountImpl > m_subaddressAccount
Definition: wallet.h:230
virtual void startRefresh() override
StartRefresh - Start/resume refresh thread (refresh every 10 seconds)
Definition: wallet.cpp:2034
Priority
Definition: wallet2_api.h:79
void setSeedLanguage(const std::string &arg) override
Definition: wallet.cpp:752
bool trustedDaemon() const override
Definition: wallet.cpp:1939
Device getDeviceType() const override
Queries backing device for wallet keys.
Definition: wallet.cpp:643
size_t numSubaddressAccounts() const override
numSubaddressAccounts - returns the number of existing subaddress accounts
Definition: wallet.cpp:1123
Definition: wallet2_api.h:81
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:1887
uint64_t balance(uint32_t accountIndex=0) const override
Definition: wallet.cpp:923
MultisigState multisig() const override
multisig - returns current state of multisig wallet creation process
Definition: wallet.cpp:1161
Definition: subaddress.h:36
std::string publicSpendKey() const override
publicSpendKey - returns public spend key
Definition: wallet.cpp:816
virtual bool setUserNote(const std::string &txid, const std::string &note) override
setUserNote - attach an arbitrary string note to a txid
Definition: wallet.cpp:1611
std::atomic< int > m_refreshIntervalMillis
Definition: wallet.h:235
void setRefreshFromBlockHeight(uint64_t refresh_from_block_height) override
setRefreshFromBlockHeight - start refresh from block height on recover
Definition: wallet.cpp:903
std::string m_password
Definition: wallet.h:225
static void add(ge_p3 &p3, const ge_cached &other)
Definition: multiexp.cc:124
std::string m_errorString
Definition: wallet.h:224
int autoRefreshInterval() const override
autoRefreshInterval - returns automatic refresh interval in millis
Definition: wallet.cpp:1031
static void error(const std::string &category, const std::string &str)
Definition: wallet.cpp:370
ConnectionStatus
Definition: wallet2_api.h:387
bool store(const std::string &path) override
store - stores wallet to file.
Definition: wallet.cpp:836
Definition: transaction_history.h:38
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:2239
bool close(bool store=true)
Definition: wallet.cpp:711
bool useForkRules(uint8_t version, int64_t early_blocks) const override
check if hard fork rules should be used
Definition: wallet.cpp:2135
std::string filename() const override
filename - returns wallet filename
Definition: wallet.cpp:854
~WalletImpl()
Definition: wallet.cpp:404
virtual std::string signMultisigParticipant(const std::string &message) const override
signMultisigParticipant signs given message with the multisig public signer key
Definition: wallet.cpp:1866
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:1659
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:1824
Definition: wallet.h:52
NetworkType
Definition: wallet2_api.h:44
void setSubaddressLookahead(uint32_t major, uint32_t minor) override
setSubaddressLookahead - set size of subaddress lookahead
Definition: wallet.cpp:918
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:2222
int l
Definition: base.py:3
uint64_t blockChainHeight() const override
blockChainHeight - returns current blockchain height
Definition: wallet.cpp:933
bool refresh() override
refresh - refreshes the wallet, updating transactions from daemon
Definition: wallet.cpp:1004
virtual bool lockKeysFile() override
locks/unlocks the keys file; returns true on success
Definition: wallet.cpp:2293
boost::mutex m_statusMutex
Definition: wallet.h:222
bool open(const std::string &path, const std::string &password)
Definition: wallet.cpp:648
std::string getSeedLanguage() const override
Definition: wallet.cpp:747
bool connectToDaemon() override
connectToDaemon - connects to the daemon. TODO: check if it can be removed
Definition: wallet.cpp:1910
Definition: pending_transaction.h:41
uint8_t version
Definition: blockchain.cpp:88
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:1806
ConnectionStatus connected() const override
connected - checks if the wallet connected to the daemon
Definition: wallet.cpp:1922
virtual void disposeTransaction(PendingTransaction *t) override
disposeTransaction - destroys transaction object
Definition: wallet.cpp:1570
NetworkType nettype() const override
Definition: wallet.h:127
PendingTransaction * restoreMultisigTransaction(const std::string &signData) override
restoreMultisigTransaction creates PendingTransaction from signData
Definition: wallet.cpp:1287
std::string getMultisigInfo() const override
getMultisigInfo
Definition: wallet.cpp:1168
POD_CLASS signature
Definition: crypto.h:95
virtual std::string signMessage(const std::string &message) override
Definition: wallet.cpp:1851
Definition: subaddress_account.h:36
virtual bool blackballOutputs(const std::vector< std::string > &outputs, bool add) override
blackballs a set of outputs
Definition: wallet.cpp:2140
virtual void setListener(WalletListener *l) override
Definition: wallet.cpp:1595
std::atomic< bool > m_refreshThreadDone
Definition: wallet.h:234
bool doInit(const std::string &daemon_address, uint64_t upper_transaction_size_limit=0, bool ssl=false)
Definition: wallet.cpp:2075
std::unique_ptr< tools::wallet2 > m_wallet
Definition: wallet.h:221
virtual void setDefaultMixin(uint32_t arg) override
setDefaultMixin - setum number of mixins to be used for new transactions
Definition: wallet.cpp:1606
std::string keysFilename() const override
keysFilename - returns keys filename. usually this formed as "wallet_filename".keys
Definition: wallet.cpp:859
POD_CLASS key_image
Definition: crypto.h:89
virtual TransactionHistory * history() override
Definition: wallet.cpp:1575
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:1119
virtual std::string getDefaultDataDir() const override
Definition: wallet.cpp:2107
virtual AddressBook * addressBook() override
Definition: wallet.cpp:1580
void setSubaddressLabel(uint32_t accountIndex, uint32_t addressIndex, const std::string &label) override
setSubaddressLabel - sets the label of the specified subaddress
Definition: wallet.cpp:1148
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:792
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:2261
uint64_t unlockedBalance(uint32_t accountIndex=0) const override
Definition: wallet.cpp:928
void hardForkInfo(uint8_t &version, uint64_t &earliest_height) const override
returns current hard fork info
Definition: wallet.cpp:2130
Transaction-like interface for sending money.
Definition: wallet2_api.h:71
Definition: wallet2_api.h:318
std::string exchangeMultisigKeys(const std::vector< std::string > &info) override
exchange_multisig_keys - provides additional key exchange round for arbitrary multisig schemes (like ...
Definition: wallet.cpp:1197
Definition: wallet.cpp:122
virtual void segregatePreForkOutputs(bool segregate) override
sets whether pre-fork outs are to be segregated
Definition: wallet.cpp:2278
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:1325
uint64_t daemonBlockChainTargetHeight() const override
daemonBlockChainTargetHeight - returns daemon blockchain target height
Definition: wallet.cpp:969
virtual bool isKeysFileLocked() override
returns true if the keys file is locked
Definition: wallet.cpp:2303
Definition: unsigned_transaction.h:41
static void info(const std::string &category, const std::string &str)
Definition: wallet.cpp:362
virtual bool unlockKeysFile() override
Definition: wallet.cpp:2298
std::unique_ptr< Wallet2CallbackImpl > m_wallet2Callback
Definition: wallet.h:227
virtual std::string getUserNote(const std::string &txid) const override
getUserNote - return an arbitrary string note attached to a txid
Definition: wallet.cpp:1622
std::atomic< bool > m_refreshEnabled
Definition: wallet.h:233
void clearStatus() const
Definition: wallet.cpp:1949
void stopRefresh()
Definition: wallet.cpp:2045
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:1180
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) override
init - initializes wallet with daemon connection params. if daemon_address is local address,...
Definition: wallet.cpp:864
std::atomic< bool > m_synchronized
Definition: wallet.h:248
bool rescanSpent() override
Definition: wallet.cpp:2112
bool submitTransaction(const std::string &fileName) override
submitTransaction - submits transaction in signed tx file
Definition: wallet.cpp:1053
boost::mutex m_refreshMutex
Definition: wallet.h:237
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:1131
virtual bool checkSpendProof(const std::string &txid, const std::string &message, const std::string &signature, bool &good) const override
Definition: wallet.cpp:1784
void setTrustedDaemon(bool arg) override
Definition: wallet.cpp:1934
bool isNewWallet() const
Definition: wallet.cpp:2065
std::atomic< bool > m_recoveringFromDevice
Definition: wallet.h:247
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:521
uint64_t getRefreshFromBlockHeight() const override
getRestoreHeight - get wallet creation height
Definition: wallet.h:121
virtual bool blackballOutput(const std::string &amount, const std::string &offset) override
blackballs an output
Definition: wallet.cpp:2178
size_t numSubaddresses(uint32_t accountIndex) const override
numSubaddresses - returns the number of existing subaddresses associated with the specified subaddres...
Definition: wallet.cpp:1127
uint8_t threshold
Definition: blockchain.cpp:90