From b570a4938c6df3c97de932bc10ec9f389d097fec Mon Sep 17 00:00:00 2001 From: Some Random Crypto Guy Date: Tue, 17 Jun 2025 10:03:43 +0100 Subject: [PATCH] added method to simple_wallet --- src/simplewallet/simplewallet.cpp | 28 ++++++++++++++++++++++++++++ src/simplewallet/simplewallet.h | 1 + 2 files changed, 29 insertions(+) diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index 0bd631eeb..528804d12 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -854,6 +854,31 @@ std::string simple_wallet::get_command_usage(const std::vector &arg return ss.str(); } +bool simple_wallet::carrot_keys(const std::vector &args/* = std::vector()*/) +{ + // don't log + PAUSE_READLINE(); + if (m_wallet->key_on_device()) { + std::cout << "secret: On device. Not available" << std::endl; + } else { + SCOPED_WALLET_UNLOCK(); + printf("master secret: "); + print_secret_key(m_wallet->get_carrot_account().s_master); + putchar('\n'); + printf("view-received secret: "); + print_secret_key(m_wallet->get_account().get_keys().m_view_secret_key); + putchar('\n'); + printf("view-all secret: "); + print_secret_key(m_wallet->get_carrot_account().s_view_balance); + putchar('\n'); + } + // TODO: print the public wallet address for the different wallet tiers + //std::cout << "public: " << string_tools::pod_to_hex(m_wallet->get_account().get_keys().m_account_address.m_view_public_key) << std::endl; + + return true; +} + + bool simple_wallet::viewkey(const std::vector &args/* = std::vector()*/) { // don't log @@ -3599,6 +3624,9 @@ simple_wallet::simple_wallet() m_cmd_binder.set_handler("save_watch_only", boost::bind(&simple_wallet::on_command, this, &simple_wallet::save_watch_only, _1), tr("Save a watch-only keys file.")); + m_cmd_binder.set_handler("carrot_keys", + boost::bind(&simple_wallet::on_command, this, &simple_wallet::carrot_keys, _1), + tr("Display the Carrot private keys.")); m_cmd_binder.set_handler("viewkey", boost::bind(&simple_wallet::on_command, this, &simple_wallet::viewkey, _1), tr("Display the private view key.")); diff --git a/src/simplewallet/simplewallet.h b/src/simplewallet/simplewallet.h index b3d586ec9..251badaf8 100644 --- a/src/simplewallet/simplewallet.h +++ b/src/simplewallet/simplewallet.h @@ -107,6 +107,7 @@ namespace cryptonote boost::optional open_wallet(const boost::program_options::variables_map& vm); bool close_wallet(); + bool carrot_keys(const std::vector &args = std::vector()); bool viewkey(const std::vector &args = std::vector()); bool spendkey(const std::vector &args = std::vector()); bool seed(const std::vector &args = std::vector());