:: [Libbitcoin] Tutorial example: Cryp…
Página Principal
Delete this message
Reply to this message
Autor: Ramón T. B.
Data:  
Para: libbitcoin@lists.dyne.org
Assunto: [Libbitcoin] Tutorial example: Crypto and Private Keys
I'm testing the first example in the tutorial: vanilla private keys (see the source code attached)
------------
// Main program
int main()
{
    if (new_keypair()) std::cout << "It should print out a key" << std::endl ;
    else std::cout << "But it outputs nothing..." << std::endl ;
    return 0;
}
--------

But it outputs nothing. Why it could be?

------------
[tb@new-host programs]$ g++ -o keypairGen keypairGen.cpp $(pkg-config --cflags --libs libbitcoin)
[tb@new-host programs]$ ./keypairGen 
But it outputs nothing...
[tb@new-host programs]$ 
------------
Regards: framontb// http://libbitcoin.dyne.org/doc/crypto.html
// g++ -o keypairGen keypairGen.cpp -std=c++11 $(pkg-config --cflags --libs libbitcoin)
#include <bitcoin/bitcoin.hpp>
using namespace bc;

// Generate new private key and echo to STDOUT.
bool new_keypair()
{
    elliptic_curve_key ec;
    if (!ec.new_key_pair())
        return false;
    private_data raw_private_key = ec.private_key();
    std::cout << std::string(raw_private_key.begin(), raw_private_key.end());
    return true;
}


// Main program
int main()
{
    if (new_keypair()) std::cout << "It should print out a key" << std::endl ;
    else std::cout << "But it outputs nothing..." << std::endl ;
    return 0;
}