1
0
mirror of https://github.com/bitcoinbook/bitcoinbook synced 2024-11-22 08:08:11 +00:00

fixes to code example

This commit is contained in:
Andreas M. Antonopoulos 2017-07-18 11:37:12 +08:00
parent f2166870d5
commit 97496a50fb

View File

@ -7,10 +7,13 @@ int main()
bool success = bc::decode_base16(secret, bool success = bc::decode_base16(secret,
"038109007313a5807b2eccc082c8c3fbb988a973cacf1a7df9ce725c31b14776"); "038109007313a5807b2eccc082c8c3fbb988a973cacf1a7df9ce725c31b14776");
assert(success); assert(success);
// Get public key. // Get public key.
bc::ec_point public_key = bc::secret_to_public_key(secret); bc::ec_compressed public_key;
std::cout << "Public key: " << bc::encode_hex(public_key) << std::endl; success = bc::secret_to_public(public_key, secret);
assert(success);
std::cout << "Public key: " << bc::encode_base16(public_key) << std::endl;
// Create Bitcoin address. // Create Bitcoin address.
// Normally you can use: // Normally you can use:
// bc::payment_address payaddr; // bc::payment_address payaddr;