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;
}
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
                      << SuccessMsg(sig)
                      << std::endl;
        }
        else {
            std::cout << WarningMsg("Failed to get transaction proof") << std::endl;
        }
    }
    catch (std::system_error& x) {
        std::cout << WarningMsg("Error while getting transaction proof: ")
                  << WarningMsg(x.what())
                  << std::endl;
    }
    catch (std::exception& x) {
        std::cout << WarningMsg("Error while getting transaction proof: ")
                  << WarningMsg(x.what())
                  << std::endl;
    }
}