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