本文整理汇总了C++中cryptonote::WalletGreen::getTransactionSecretKey方法的典型用法代码示例。如果您正苦于以下问题:C++ WalletGreen::getTransactionSecretKey方法的具体用法?C++ WalletGreen::getTransactionSecretKey怎么用?C++ WalletGreen::getTransactionSecretKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cryptonote::WalletGreen
的用法示例。
在下文中一共展示了WalletGreen::getTransactionSecretKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: txSecretKey
void txSecretKey(CryptoNote::WalletGreen &wallet)
{
std::string hashStr;
Crypto::Hash txid;
while (true)
{
std::cout << InformationMsg("Enter transaction hash: ");
std::getline(std::cin, hashStr);
boost::algorithm::trim(hashStr);
if (!parse_hash256(hashStr, txid)) {
std::cout << WarningMsg("Failed to parse txid") << std::endl;
return;
}
else {
break;
}
if (std::cin.fail() || std::cin.eof()) {
std::cin.clear();
break;
}
}
Crypto::SecretKey txSecretKey = wallet.getTransactionSecretKey(txid);
if (txSecretKey == CryptoNote::NULL_SECRET_KEY) {
std::cout << WarningMsg("Transaction ")
<< WarningMsg(hashStr)
<< WarningMsg(" secret key is not available")
<< std::endl;
return;
}
std::cout << SuccessMsg("Transaction secret key: ")
<< std::endl
<< SuccessMsg(Common::podToHex(txSecretKey))
<< std::endl;
}
示例2: txProof
void txProof(CryptoNote::WalletGreen &wallet)
{
std::string txHashStr;
Crypto::Hash txid;
while (true)
{
std::cout << InformationMsg("Enter transaction hash: ");
std::getline(std::cin, txHashStr);
boost::algorithm::trim(txHashStr);
if (!parse_hash256(txHashStr, txid)) {
std::cout << WarningMsg("Failed to parse txid") << std::endl;
return;
}
else {
break;
}
if (std::cin.fail() || std::cin.eof()) {
std::cin.clear();
break;
}
}
Crypto::SecretKey txSecretKey = wallet.getTransactionSecretKey(txid);
if (txSecretKey == CryptoNote::NULL_SECRET_KEY) {
std::cout << InformationMsg("Transaction ")
<< InformationMsg(txHashStr)
<< InformationMsg(" secret key is not available.")
<< std::endl
<< InformationMsg("If you have it elsewhere, ")
<< InformationMsg("enter it here to continue: ")
<< std::endl;
Crypto::Hash tx_key_hash;
while (true)
{
std::string keyStr;
std::getline(std::cin, keyStr);
boost::algorithm::trim(keyStr);
size_t size;
if (!Common::fromHex(keyStr, &tx_key_hash, sizeof(tx_key_hash), size)
|| size != sizeof(tx_key_hash))
{
std::cout << WarningMsg("Failed to parse tx secret key ")
<< WarningMsg(keyStr) << std::endl;
return;
}
else {
txSecretKey = *(struct Crypto::SecretKey *) &tx_key_hash;
break;
}
if (std::cin.fail() || std::cin.eof()) {
std::cin.clear();
break;
}
}
}
CryptoNote::AccountPublicAddress destAddress;
while (true)
{
std::cout << InformationMsg("Enter destination address: ");
std::string addrStr;
uint64_t prefix;
std::getline(std::cin, addrStr);
boost::algorithm::trim(addrStr);
if (!CryptoNote::parseAccountAddressString(prefix, destAddress, addrStr))
{
std::cout << WarningMsg("Failed to parse address") << std::endl;
}
else
{
break;
}
if (std::cin.fail() || std::cin.eof()) {
std::cin.clear();
break;
}
}
try {
std::string sig;
if (wallet.getTransactionProof(txid, destAddress, txSecretKey, sig)) {
std::cout << SuccessMsg("Transaction proof: ")
<< std::endl
//.........这里部分代码省略.........