本文整理汇总了C++中cryptonote::WalletGreen::getViewKey方法的典型用法代码示例。如果您正苦于以下问题:C++ WalletGreen::getViewKey方法的具体用法?C++ WalletGreen::getViewKey怎么用?C++ WalletGreen::getViewKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cryptonote::WalletGreen
的用法示例。
在下文中一共展示了WalletGreen::getViewKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: printPrivateKeys
void printPrivateKeys(CryptoNote::WalletGreen &wallet, bool viewWallet)
{
auto privateViewKey = wallet.getViewKey().secretKey;
if (viewWallet)
{
std::cout << SuccessMsg("Private view key:")
<< std::endl
<< SuccessMsg(Common::podToHex(privateViewKey))
<< std::endl;
return;
}
auto privateSpendKey = wallet.getAddressSpendKey(0).secretKey;
Crypto::SecretKey derivedPrivateViewKey;
CryptoNote::AccountBase::generateViewFromSpend(privateSpendKey,
derivedPrivateViewKey);
const bool deterministicPrivateKeys
= derivedPrivateViewKey == privateViewKey;
std::cout << SuccessMsg("Private spend key:")
<< std::endl
<< SuccessMsg(Common::podToHex(privateSpendKey))
<< std::endl
<< std::endl
<< SuccessMsg("Private view key:")
<< std::endl
<< SuccessMsg(Common::podToHex(privateViewKey))
<< std::endl;
if (deterministicPrivateKeys)
{
std::string mnemonicSeed;
Crypto::ElectrumWords::bytes_to_words(privateSpendKey,
mnemonicSeed,
"English");
std::cout << std::endl
<< SuccessMsg("Mnemonic seed:")
<< std::endl
<< SuccessMsg(mnemonicSeed)
<< std::endl;
}
std::cout << std::endl
<< SuccessMsg("GUI Importable Private Key:")
<< std::endl
<< SuccessMsg(getGUIPrivateKey(wallet))
<< std::endl;
}
示例2: getGUIPrivateKey
std::string getGUIPrivateKey(CryptoNote::WalletGreen &wallet)
{
auto viewKey = wallet.getViewKey();
auto spendKey = wallet.getAddressSpendKey(0);
CryptoNote::AccountPublicAddress addr
{
spendKey.publicKey,
viewKey.publicKey,
};
CryptoNote::AccountKeys keys
{
addr,
spendKey.secretKey,
viewKey.secretKey,
};
return Tools::Base58::encode_addr
(
CryptoNote::parameters::CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX,
std::string(reinterpret_cast<char*>(&keys), sizeof(keys))
);
}