Merge pull request #35 from tewinget/master

Add electrum-seed wallet backup/recovery 2
release-v0.4.0.1
monero-project 10 years ago
commit 5489112b11

@ -12,7 +12,7 @@
#include "crypto/crypto.h"
extern "C"
{
#include "crypto/blake256.h"
#include "crypto/keccak.h"
}
#include "cryptonote_core/cryptonote_basic_impl.h"
#include "cryptonote_core/cryptonote_format_utils.h"
@ -39,7 +39,7 @@ DISABLE_VS_WARNINGS(4244 4345)
// rng for generating second set of keys is hash of first rng. means only one set of electrum-style words needed for recovery
crypto::secret_key second;
blake256_hash((uint8_t *)&second, (uint8_t *)&first, sizeof(crypto::secret_key));
keccak((uint8_t *)&first, sizeof(crypto::secret_key), (uint8_t *)&second, sizeof(crypto::secret_key));
generate_keys(m_keys.m_account_address.m_view_public_key, m_keys.m_view_secret_key, second, two_random ? false : true);
m_creation_timestamp = time(NULL);

@ -3,6 +3,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <thread>
#include <iostream>
#include <boost/lexical_cast.hpp>
#include <boost/program_options.hpp>
#include <boost/algorithm/string.hpp>
@ -42,7 +43,7 @@ namespace
const command_line::arg_descriptor<std::string> arg_password = {"password", "Wallet password", "", true};
const command_line::arg_descriptor<std::string> arg_electrum_seed = {"electrum-seed", "Specify electrum seed for wallet recovery/creation", ""};
const command_line::arg_descriptor<bool> arg_restore_deterministic_wallet = {"restore-deterministic-wallet", "Recover wallet using electrum-style mnemonic", false};
const command_line::arg_descriptor<bool> arg_non_deterministic = {"non-deterministic", "requires --generate-new-wallet, uses old generation method", false};
const command_line::arg_descriptor<bool> arg_non_deterministic = {"non-deterministic", "creates non-deterministic view and spend keys", false};
const command_line::arg_descriptor<int> arg_daemon_port = {"daemon-port", "Use daemon instance at port <arg> instead of 8081", 0};
const command_line::arg_descriptor<uint32_t> arg_log_level = {"set_log", "", 0, true};
@ -397,12 +398,6 @@ bool simple_wallet::new_wallet(const string &wallet_file, const std::string& pas
std::string print_electrum = "";
if (!two_random)
{
print_electrum = "\nYour wallet can be recovered using the following electrum-style word list:\n";
print_electrum += electrum_words;
print_electrum += "\n";
}
success_msg_writer() <<
"**********************************************************************\n" <<
@ -411,9 +406,16 @@ bool simple_wallet::new_wallet(const string &wallet_file, const std::string& pas
"Use \"help\" command to see the list of available commands.\n" <<
"Always use \"exit\" command when closing simplewallet to save\n" <<
"current session's state. Otherwise, you will possibly need to synchronize \n" <<
"your wallet again. Your wallet key is NOT under risk anyway.\n" <<
print_electrum <<
"**********************************************************************";
"your wallet again. Your wallet key is NOT under risk anyway.\n"
;
if (!two_random)
{
success_msg_writer(true) << "\nPLEASE NOTE: the following 24 words can be used to recover access to your wallet. Please write them down and store them somewhere safe and secure. Please do not store them in your email or on file storage services outside of your immediate control. You will not be able to view these words again, so it is imperative to make note of them now.\n";
std::cout << electrum_words << std::endl;
}
success_msg_writer() << "**********************************************************************";
return true;
}
//----------------------------------------------------------------------------------------------------

Loading…
Cancel
Save