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>());
116 bool set_auto_refresh(
const std::vector<std::string> &args = std::vector<std::string>());
117 bool set_refresh_type(
const std::vector<std::string> &args = std::vector<std::string>());
119 bool set_ask_password(
const std::vector<std::string> &args = std::vector<std::string>());
120 bool set_unit(
const std::vector<std::string> &args = std::vector<std::string>());
124 bool set_confirm_backlog(
const std::vector<std::string> &args = std::vector<std::string>());
127 bool help(
const std::vector<std::string> &args = std::vector<std::string>());
128 bool start_mining(
const std::vector<std::string> &args);
129 bool stop_mining(
const std::vector<std::string> &args);
130 bool set_daemon(
const std::vector<std::string> &args);
131 bool save_bc(
const std::vector<std::string>& args);
132 bool refresh(
const std::vector<std::string> &args);
134 bool show_balance(
const std::vector<std::string> &args = std::vector<std::string>());
138 bool transfer_main(
int transfer_type,
const std::vector<std::string> &args);
139 bool transfer(
const std::vector<std::string> &args);
140 bool transfer_new(
const std::vector<std::string> &args);
142 bool sweep_main(uint64_t below,
const std::vector<std::string> &args);
143 bool sweep_all(
const std::vector<std::string> &args);
144 bool sweep_below(
const std::vector<std::string> &args);
146 bool donate(
const std::vector<std::string> &args);
149 std::vector<std::vector<cryptonote::tx_destination_entry>>
split_amounts(
150 std::vector<cryptonote::tx_destination_entry> dsts,
size_t num_splits
152 bool print_address(
const std::vector<std::string> &args = std::vector<std::string>());
154 bool address_book(
const std::vector<std::string> &args = std::vector<std::string>());
155 bool save(
const std::vector<std::string> &args);
157 bool set_variable(
const std::vector<std::string> &args);
158 bool rescan_spent(
const std::vector<std::string> &args);
159 bool set_log(
const std::vector<std::string> &args);
160 bool get_tx_key(
const std::vector<std::string> &args);
161 bool check_tx_key(
const std::vector<std::string> &args);
163 bool get_tx_proof(
const std::vector<std::string> &args);
168 bool refresh_main(uint64_t start_height,
bool reset =
false);
169 bool set_tx_note(
const std::vector<std::string> &args);
170 bool get_tx_note(
const std::vector<std::string> &args);
171 bool status(
const std::vector<std::string> &args);
173 bool sign(
const std::vector<std::string> &args);
174 bool verify(
const std::vector<std::string> &args);
181 bool payment_id(
const std::vector<std::string> &args);
190 bool print_ring_members(
const std::vector<tools::wallet2::pending_tx>& ptx_vector, std::ostream& ostr);
231 auto current_time = std::chrono::system_clock::now();
239 if (std::chrono::milliseconds(20) < current_time -
m_print_time || force)
258 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:4378
bool show_blockchain_height(const std::vector< std::string > &args)
Definition: simplewallet.cpp:2231
void print_seed(std::string seed)
Prints the seed with a nice message.
Definition: simplewallet.cpp:975
bool sign_transfer(const std::vector< std::string > &args)
Definition: simplewallet.cpp:3464
std::string m_import_path
Definition: simplewallet.h:277
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:3784
bool show_transfer(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4865
bool show_incoming_transfers(const std::vector< std::string > &args)
Definition: simplewallet.cpp:2087
bool get_tx_proof(const std::vector< std::string > &args)
Definition: simplewallet.cpp:3647
#define QT_TRANSLATE_NOOP(context, str)
Definition: i18n.h:32
bool set_default_priority(const std::vector< std::string > &args)
Definition: simplewallet.cpp:525
bool show_balance_unlocked()
Definition: simplewallet.cpp:2073
bool m_restore_deterministic_wallet
Definition: simplewallet.h:282
bool set_display_progress_indicator(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:724
virtual void on_money_received(uint64_t height, const crypto::hash &txid, const cryptonote::transaction &tx, uint64_t amount)
Definition: simplewallet.cpp:1944
bool ask_wallet_create_if_needed()
Definition: simplewallet.cpp:887
bool set_min_output_value(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:667
std::unique_ptr< tools::wallet2 > m_wallet
Definition: simplewallet.h:291
virtual void on_unconfirmed_money_received(uint64_t height, const crypto::hash &txid, const cryptonote::transaction &tx, uint64_t amount)
Definition: simplewallet.cpp:1956
bool save(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1749
POD_CLASS key_derivation
Definition: crypto.h:82
std::string m_generate_from_multisig_keys
Definition: simplewallet.h:274
Definition: cryptonote_basic.h:372
bool m_non_deterministic
Definition: simplewallet.h:283
bool address_book(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:4451
bool start_mining(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1780
bool set_ask_password(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:614
uint64_t height
Definition: blockchain.cpp:87
bool spendkey(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:280
std::string m_generate_new
Definition: simplewallet.h:271
bool set_store_tx_info(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:473
bool export_key_images(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4675
bool set_unit(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:625
bool import_outputs(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4787
std::string get_mnemonic_language()
Gets the word seed language from the user.
Definition: simplewallet.cpp:1487
bool m_auto_refresh_refreshing
Definition: simplewallet.h:301
bool set_refresh_from_block_height(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:707
Definition: simplewallet.h:218
bool set_variable(const std::vector< std::string > &args)
Definition: simplewallet.cpp:801
bool set_confirm_backlog(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:696
bool transfer_new(const std::vector< std::string > &args)
Definition: simplewallet.cpp:2818
bool process_command(const std::vector< std::string > &args)
Definition: simplewallet.cpp:5006
uint64_t m_restore_height
Definition: simplewallet.h:287
bool locked_transfer(const std::vector< std::string > &args)
Definition: simplewallet.cpp:2823
uint64_t m_blockchain_height
Definition: simplewallet.h:264
bool seed_set_language(const std::vector< std::string > &args=std::vector< std::string >())
Sets seed language.
Definition: simplewallet.cpp:330
bool set_print_ring_members(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:462
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:4531
bool open_wallet(const boost::program_options::variables_map &vm)
Definition: simplewallet.cpp:1652
bool donate(const std::vector< std::string > &args)
Definition: simplewallet.cpp:3285
bool set_refresh_type(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:586
bool set_confirm_missing_payment_id(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:603
bool stop_mining(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1833
bool set_min_output_count(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:649
Holds cryptonote related classes and helpers.
Definition: db_bdb.cpp:225
bool unspent_outputs(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4214
bool close_wallet()
Definition: simplewallet.cpp:1716
uint64_t get_daemon_blockchain_height(std::string &err)
Definition: simplewallet.cpp:2217
std::chrono::system_clock::time_point m_print_time
Definition: simplewallet.h:266
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:2400
std::string m_wallet_file
Definition: simplewallet.h:270
bool export_outputs(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4745
bool transfer(const std::vector< std::string > &args)
Definition: simplewallet.cpp:2813
void update(uint64_t height, bool force=false)
Definition: simplewallet.h:229
bool sweep_unmixable(const std::vector< std::string > &args)
Definition: simplewallet.cpp:2829
bool try_connect_to_daemon(bool silent=false, uint32_t *version=nullptr)
Definition: simplewallet.cpp:1458
bool status(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4584
simple_wallet()
Definition: simplewallet.cpp:741
bool run_console_handler()
boost::thread m_idle_thread
Definition: simplewallet.h:296
boost::condition_variable m_idle_cond
Definition: simplewallet.h:298
bool help(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:735
bool set_merge_destinations(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:685
void wallet_idle_thread()
Definition: simplewallet.cpp:4337
bool seed(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:295
bool sweep_main(uint64_t below, const std::vector< std::string > &args)
Definition: simplewallet.cpp:2990
bool rescan_spent(const std::vector< std::string > &args)
Definition: simplewallet.cpp:2245
bool init(const boost::program_options::variables_map &vm)
Definition: simplewallet.cpp:995
virtual void on_skip_transaction(uint64_t height, const crypto::hash &txid, const cryptonote::transaction &tx)
Definition: simplewallet.cpp:1973
void update_blockchain_height()
Definition: simplewallet.h:247
epee::net_utils::http::http_simple_client m_http_client
Definition: simplewallet.h:292
bool m_restoring
Definition: simplewallet.h:286
bool refresh_main(uint64_t start_height, bool reset=false)
Definition: simplewallet.cpp:1985
refresh_progress_reporter_t m_refresh_progress_reporter
Definition: simplewallet.h:293
bool get_tx_key(const std::vector< std::string > &args)
Definition: simplewallet.cpp:3612
bool set_log(const std::vector< std::string > &args)
Definition: simplewallet.cpp:876
std::string m_generate_from_json
Definition: simplewallet.h:275
bool get_tx_note(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4559
bool show_balance(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:2080
std::atomic< bool > m_in_manual_refresh
Definition: simplewallet.h:302
uint8_t version
Definition: blockchain.cpp:86
bool save_bc(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1917
std::atomic< bool > m_auto_refresh_enabled
Definition: simplewallet.h:300
std::string get_prompt() const
Definition: simplewallet.cpp:4365
bool show_payments(const std::vector< std::string > &args)
Definition: simplewallet.cpp:2164
Definition: cryptonote_basic.h:406
bool m_trusted_daemon
Definition: simplewallet.h:284
bool set_daemon(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1855
std::chrono::system_clock::time_point m_blockchain_height_update_time
Definition: simplewallet.h:265
cryptonote::simple_wallet & m_simple_wallet
Definition: simplewallet.h:263
bool verify(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4635
bool viewkey(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:270
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:1961
std::string get_commands_str()
Definition: simplewallet.cpp:259
POD_CLASS secret_key
Definition: crypto.h:62
bool import_key_images(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4709
bool check_tx_proof(const std::vector< std::string > &args)
Definition: simplewallet.cpp:3897
void stop()
Definition: simplewallet.cpp:4392
bool sweep_all(const std::vector< std::string > &args)
Definition: simplewallet.cpp:3264
boost::optional< tools::password_container > get_and_verify_password() const
Definition: simplewallet.cpp:1522
bool print_ring_members(const std::vector< tools::wallet2::pending_tx > &ptx_vector, std::ostream &ostr)
Definition: simplewallet.cpp:2292
std::string m_generate_from_keys
Definition: simplewallet.h:273
bool rescan_blockchain(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4332
bool save_watch_only(const std::vector< std::string > &args)
Definition: simplewallet.cpp:1765
bool print_integrated_address(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:4409
bool refresh(const std::vector< std::string > &args)
Definition: simplewallet.cpp:2057
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:1536
#define DIFFICULTY_TARGET
Definition: cryptonote_config.h:80
boost::mutex m_idle_mutex
Definition: simplewallet.h:297
POD_CLASS hash
Definition: hash.h:46
std::string m_mnemonic_language
Definition: simplewallet.h:276
bool change_password(const std::vector< std::string > &args)
Definition: simplewallet.cpp:356
bool sweep_below(const std::vector< std::string > &args)
Definition: simplewallet.cpp:3269
std::vector< std::string > command_type
Definition: simplewallet.h:69
bool submit_transfer(const std::vector< std::string > &args)
Definition: simplewallet.cpp:3500
std::atomic< bool > m_idle_run
Definition: simplewallet.h:295
bool sign(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4609
bool check_tx_key(const std::vector< std::string > &args)
Definition: simplewallet.cpp:3726
bool print_fee_info(const std::vector< std::string > &args)
Definition: simplewallet.cpp:396
bool set_default_ring_size(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:490
crypto::secret_key m_recovery_key
Definition: simplewallet.h:281
bool set_always_confirm_transfers(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:451
epee::console_handlers_binder m_cmd_binder
Definition: simplewallet.h:289
std::string m_generate_from_view_key
Definition: simplewallet.h:272
bool payment_id(const std::vector< std::string > &args)
Definition: simplewallet.cpp:383
bool handle_command_line(const boost::program_options::variables_map &vm)
Definition: simplewallet.cpp:1434
bool deinit()
Definition: simplewallet.cpp:1426
bool show_transfers(const std::vector< std::string > &args)
Definition: simplewallet.cpp:4057
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:3327
Definition: cryptonote_basic.h:188
bool print_address(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:4403
void interrupt()
Definition: simplewallet.cpp:5011
bool m_allow_mismatched_daemon_version
Definition: simplewallet.h:285
bool set_auto_refresh(const std::vector< std::string > &args=std::vector< std::string >())
Definition: simplewallet.cpp:569
virtual void on_new_block(uint64_t height, const cryptonote::block &block)
Definition: simplewallet.cpp:1938
refresh_progress_reporter_t(cryptonote::simple_wallet &simple_wallet)
Definition: simplewallet.h:221
std::string m_electrum_seed
Definition: simplewallet.h:279