From 97496a50fb168a3020af3df1bbf0a5fe13ca7eef Mon Sep 17 00:00:00 2001 From: "Andreas M. Antonopoulos" Date: Tue, 18 Jul 2017 11:37:12 +0800 Subject: [PATCH] fixes to code example --- code/addr.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/code/addr.cpp b/code/addr.cpp index 6f8d058e..f1be3a58 100644 --- a/code/addr.cpp +++ b/code/addr.cpp @@ -7,10 +7,13 @@ 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: // bc::payment_address payaddr;