41 #include <boost/optional/optional.hpp> 42 #include <boost/program_options/variables_map.hpp> 47 #include "console_handler.h" 51 #undef ELECTRONEUM_DEFAULT_LOG_CATEGORY 52 #define ELECTRONEUM_DEFAULT_LOG_CATEGORY "wallet.simplewallet" 66 static const char *
tr(
const char *str) {
return i18n_translate(str,
"cryptonote::simple_wallet"); }
72 bool init(
const boost::program_options::variables_map& vm);
92 bool recover,
bool two_random,
const std::string &old_language);
95 bool open_wallet(
const boost::program_options::variables_map& vm);
98 bool viewkey(
const std::vector<std::string> &args = std::vector<std::string>());
99 bool spendkey(
const std::vector<std::string> &args = std::vector<std::string>());
100 bool seed(
const std::vector<std::string> &args = std::vector<std::string>());
111 bool seed_set_language(
const std::vector<std::string> &args = std::vector<std::string>());
114 bool set_store_tx_info(
const std::vector<std::string> &args = std::vector<std::string>());
115 bool set_auto_refresh(
const std::vector<std::string> &args = std::vector<std::string>());
116 bool set_refresh_type(
const std::vector<std::string> &args = std::vector<std::string>());
118 bool set_ask_password(
const std::vector<std::string> &args = std::vector<std::string>());
119 bool set_unit(
const std::vector<std::string> &args = std::vector<std::string>());
123 bool set_confirm_backlog(
const std::vector<std::string> &args = std::vector<std::string>());
126 bool help(
const std::vector<std::string> &args = std::vector<std::string>());
127 bool start_mining(
const std::vector<std::string> &args);
128 bool stop_mining(
const std::vector<std::string> &args);
129 bool set_daemon(
const std::vector<std::string> &args);
130 bool save_bc(
const std::vector<std::string>& args);
131 bool refresh(
const std::vector<std::string> &args);
133 bool show_balance(
const std::vector<std::string> &args = std::vector<std::string>());
137 bool transfer_main(
int transfer_type,
const std::vector<std::string> &args);
138 bool transfer(
const std::vector<std::string> &args);
140 bool sweep_main(uint64_t below,
const std::vector<std::string> &args);
141 bool sweep_all(
const std::vector<std::string> &args);
142 bool sweep_below(
const std::vector<std::string> &args);
144 bool donate(
const std::vector<std::string> &args);
147 std::vector<std::vector<cryptonote::tx_destination_entry>>
split_amounts(
148 std::vector<cryptonote::tx_destination_entry> dsts,
size_t num_splits
150 bool print_address(
const std::vector<std::string> &args = std::vector<std::string>());
152 bool address_book(
const std::vector<std::string> &args = std::vector<std::string>());
153 bool save(
const std::vector<std::string> &args);
155 bool set_variable(
const std::vector<std::string> &args);
156 bool rescan_spent(
const std::vector<std::string> &args);
157 bool set_log(
const std::vector<std::string> &args);
158 bool get_tx_key(
const std::vector<std::string> &args);
159 bool check_tx_key(
const std::vector<std::string> &args);
161 bool get_tx_proof(
const std::vector<std::string> &args);
167 bool refresh_main(uint64_t start_height,
bool reset =
false);
168 bool set_tx_note(
const std::vector<std::string> &args);
169 bool get_tx_note(
const std::vector<std::string> &args);
170 bool status(
const std::vector<std::string> &args);
172 bool sign(
const std::vector<std::string> &args);
173 bool verify(
const std::vector<std::string> &args);
180 bool payment_id(
const std::vector<std::string> &args);
189 bool print_ring_members(
const std::vector<tools::wallet2::pending_tx>& ptx_vector, std::ostream& ostr);
230 auto current_time = std::chrono::system_clock::now();
238 if (std::chrono::milliseconds(20) < current_time -
m_print_time || force)
257 LOG_ERROR(
"Failed to get current blockchain height: " << err);
std::vector< std::vector< cryptonote::tx_destination_entry > > split_amounts(std::vector< cryptonote::tx_destination_entry > dsts, size_t num_splits)
bool run()
Definition: simplewallet.cpp:4367
bool show_blockchain_height(const std::vector< std::string > &args)
Definition: simplewallet.cpp:2193
void print_seed(std::string seed)
Prints the seed with a nice message.
Definition: simplewallet.cpp:937
bool sign_transfer(const std::vector< std::string > &args)
Definition: simplewallet.cpp:3418
std::string m_import_path
Definition: simplewallet.h:276
static const char * tr(const char *str)
Definition: simplewallet.h:66
bool check_tx_key_helper(const crypto::hash &txid, const cryptonote::account_public_address &address, const crypto::key_derivation &derivation)
Definition: simplewallet.cpp:3738
bool show_transfer(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4854
bool show_incoming_transfers(const std::vector< std::string > &args)
Definition: simplewallet.cpp:2049
bool get_tx_proof(const std::vector< std::string > &args)
Definition: simplewallet.cpp:3601
#define QT_TRANSLATE_NOOP(context, str)
Definition: i18n.h:32
bool set_default_priority(const std::vector< std::string > &args)
Definition: simplewallet.cpp:489
bool show_balance_unlocked()
Definition: simplewallet.cpp:2035
bool m_restore_deterministic_wallet
Definition: simplewallet.h:281
bool set_display_progress_indicator(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:688
virtual void on_money_received(uint64_t height, const crypto::hash &txid, const cryptonote::transaction &tx, uint64_t amount)
Definition: simplewallet.cpp:1906
bool ask_wallet_create_if_needed()
Definition: simplewallet.cpp:849
bool set_min_output_value(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:631
std::unique_ptr< tools::wallet2 > m_wallet
Definition: simplewallet.h:290
virtual void on_unconfirmed_money_received(uint64_t height, const crypto::hash &txid, const cryptonote::transaction &tx, uint64_t amount)
Definition: simplewallet.cpp:1918
bool save(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1711
POD_CLASS key_derivation
Definition: crypto.h:89
std::string m_generate_from_multisig_keys
Definition: simplewallet.h:273
Definition: cryptonote_basic.h:382
bool m_non_deterministic
Definition: simplewallet.h:282
bool address_book(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:4440
bool start_mining(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1742
bool set_ask_password(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:578
uint64_t height
Definition: blockchain.cpp:87
bool spendkey(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:279
std::string m_generate_new
Definition: simplewallet.h:270
bool set_store_tx_info(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:472
bool export_key_images(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4664
bool set_unit(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:589
bool import_outputs(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4776
std::string get_mnemonic_language()
Gets the word seed language from the user.
Definition: simplewallet.cpp:1449
bool m_auto_refresh_refreshing
Definition: simplewallet.h:300
bool set_refresh_from_block_height(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:671
Definition: simplewallet.h:217
bool set_variable(const std::vector< std::string > &args)
Definition: simplewallet.cpp:765
bool set_confirm_backlog(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:660
bool process_command(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4996
uint64_t m_restore_height
Definition: simplewallet.h:286
bool locked_transfer(const std::vector< std::string > &args)
Definition: simplewallet.cpp:2777
uint64_t m_blockchain_height
Definition: simplewallet.h:263
bool seed_set_language(const std::vector< std::string > &args=std::vector< std::string >())
Sets seed language.
Definition: simplewallet.cpp:329
bool set_print_ring_members(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:461
const char * i18n_translate(const char *s, const std::string &context)
Definition: i18n.cpp:293
bool set_tx_note(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4520
bool open_wallet(const boost::program_options::variables_map &vm)
Definition: simplewallet.cpp:1614
bool donate(const std::vector< std::string > &args)
Definition: simplewallet.cpp:3239
bool set_refresh_type(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:550
bool set_confirm_missing_payment_id(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:567
bool stop_mining(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1795
bool set_min_output_count(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:613
Holds cryptonote related classes and helpers.
Definition: db_bdb.cpp:225
bool unspent_outputs(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4203
bool close_wallet()
Definition: simplewallet.cpp:1678
uint64_t get_daemon_blockchain_height(std::string &err)
Definition: simplewallet.cpp:2179
std::chrono::system_clock::time_point m_print_time
Definition: simplewallet.h:265
Manages wallet operations. This is the most abstracted wallet class.
Definition: simplewallet.h:63
bool transfer_main(int transfer_type, const std::vector< std::string > &args)
Definition: simplewallet.cpp:2362
std::string m_wallet_file
Definition: simplewallet.h:269
bool export_outputs(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4734
bool transfer(const std::vector< std::string > &args)
Definition: simplewallet.cpp:2772
void update(uint64_t height, bool force=false)
Definition: simplewallet.h:228
bool sweep_unmixable(const std::vector< std::string > &args)
Definition: simplewallet.cpp:2783
bool try_connect_to_daemon(bool silent=false, uint32_t *version=nullptr)
Definition: simplewallet.cpp:1420
bool status(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4573
simple_wallet()
Definition: simplewallet.cpp:705
bool run_console_handler()
boost::thread m_idle_thread
Definition: simplewallet.h:295
boost::condition_variable m_idle_cond
Definition: simplewallet.h:297
bool help(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:699
bool set_merge_destinations(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:649
void wallet_idle_thread()
Definition: simplewallet.cpp:4326
bool seed(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:294
bool sweep_main(uint64_t below, const std::vector< std::string > &args)
Definition: simplewallet.cpp:2944
bool rescan_spent(const std::vector< std::string > &args)
Definition: simplewallet.cpp:2207
bool init(const boost::program_options::variables_map &vm)
Definition: simplewallet.cpp:957
virtual void on_skip_transaction(uint64_t height, const crypto::hash &txid, const cryptonote::transaction &tx)
Definition: simplewallet.cpp:1935
void update_blockchain_height()
Definition: simplewallet.h:246
epee::net_utils::http::http_simple_client m_http_client
Definition: simplewallet.h:291
bool m_restoring
Definition: simplewallet.h:285
bool refresh_main(uint64_t start_height, bool reset=false)
Definition: simplewallet.cpp:1947
refresh_progress_reporter_t m_refresh_progress_reporter
Definition: simplewallet.h:292
bool get_tx_key(const std::vector< std::string > &args)
Definition: simplewallet.cpp:3566
bool set_log(const std::vector< std::string > &args)
Definition: simplewallet.cpp:838
std::string m_generate_from_json
Definition: simplewallet.h:274
bool get_tx_note(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4548
bool show_balance(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2042
std::atomic< bool > m_in_manual_refresh
Definition: simplewallet.h:301
uint8_t version
Definition: blockchain.cpp:86
bool save_bc(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1879
std::atomic< bool > m_auto_refresh_enabled
Definition: simplewallet.h:299
std::string get_prompt() const
Definition: simplewallet.cpp:4354
bool show_payments(const std::vector< std::string > &args)
Definition: simplewallet.cpp:2126
Definition: cryptonote_basic.h:421
bool save_transfers_to_csv(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4143
bool m_trusted_daemon
Definition: simplewallet.h:283
bool set_daemon(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1817
std::chrono::system_clock::time_point m_blockchain_height_update_time
Definition: simplewallet.h:264
cryptonote::simple_wallet & m_simple_wallet
Definition: simplewallet.h:262
bool verify(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4624
bool viewkey(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:269
virtual void on_money_spent(uint64_t height, const crypto::hash &txid, const cryptonote::transaction &in_tx, uint64_t amount, const cryptonote::transaction &spend_tx)
Definition: simplewallet.cpp:1923
std::string get_commands_str()
Definition: simplewallet.cpp:258
POD_CLASS secret_key
Definition: crypto.h:69
bool import_key_images(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4698
bool check_tx_proof(const std::vector< std::string > &args)
Definition: simplewallet.cpp:3826
void stop()
Definition: simplewallet.cpp:4381
bool sweep_all(const std::vector< std::string > &args)
Definition: simplewallet.cpp:3218
boost::optional< tools::password_container > get_and_verify_password() const
Definition: simplewallet.cpp:1484
bool print_ring_members(const std::vector< tools::wallet2::pending_tx > &ptx_vector, std::ostream &ostr)
Definition: simplewallet.cpp:2254
std::string m_generate_from_keys
Definition: simplewallet.h:272
bool rescan_blockchain(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4321
bool save_watch_only(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1727
bool print_integrated_address(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:4398
bool refresh(const std::vector< std::string > &args)
Definition: simplewallet.cpp:2019
bool new_wallet(const boost::program_options::variables_map &vm, const crypto::secret_key &recovery_key, bool recover, bool two_random, const std::string &old_language)
Definition: simplewallet.cpp:1498
#define DIFFICULTY_TARGET
Definition: cryptonote_config.h:84
boost::mutex m_idle_mutex
Definition: simplewallet.h:296
POD_CLASS hash
Definition: hash.h:46
std::string m_mnemonic_language
Definition: simplewallet.h:275
bool change_password(const std::vector< std::string > &args)
Definition: simplewallet.cpp:355
bool sweep_below(const std::vector< std::string > &args)
Definition: simplewallet.cpp:3223
std::vector< std::string > command_type
Definition: simplewallet.h:69
bool submit_transfer(const std::vector< std::string > &args)
Definition: simplewallet.cpp:3454
std::atomic< bool > m_idle_run
Definition: simplewallet.h:294
bool sign(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4598
bool check_tx_key(const std::vector< std::string > &args)
Definition: simplewallet.cpp:3680
bool print_fee_info(const std::vector< std::string > &args)
Definition: simplewallet.cpp:395
crypto::secret_key m_recovery_key
Definition: simplewallet.h:280
bool set_always_confirm_transfers(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:450
epee::console_handlers_binder m_cmd_binder
Definition: simplewallet.h:288
std::string m_generate_from_view_key
Definition: simplewallet.h:271
bool payment_id(const std::vector< std::string > &args)
Definition: simplewallet.cpp:382
bool handle_command_line(const boost::program_options::variables_map &vm)
Definition: simplewallet.cpp:1396
bool deinit()
Definition: simplewallet.cpp:1388
bool show_transfers(const std::vector< std::string > &args)
Definition: simplewallet.cpp:3986
bool accept_loaded_tx(const std::function< size_t()> get_num_txes, const std::function< const tools::wallet2::tx_construction_data &(size_t)> &get_tx, const std::string &extra_message=std::string())
Definition: simplewallet.cpp:3281
Definition: cryptonote_basic.h:198
bool print_address(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:4392
void interrupt()
Definition: simplewallet.cpp:5001
bool m_allow_mismatched_daemon_version
Definition: simplewallet.h:284
bool set_auto_refresh(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:533
virtual void on_new_block(uint64_t height, const cryptonote::block &block)
Definition: simplewallet.cpp:1900
refresh_progress_reporter_t(cryptonote::simple_wallet &simple_wallet)
Definition: simplewallet.h:220
std::string m_electrum_seed
Definition: simplewallet.h:278