Пример #1
0
int main() 
{
    CoinKey coinKey;
    coinKey.generateNewKey();
    string receivingAddress = coinKey.getAddress();
    string walletImport = coinKey.getWalletImport();

    cout << endl
         << "Address:       " << receivingAddress << endl
         << "Wallet Import: " << walletImport << endl << endl;

    return 0;
}
Пример #2
0
void CoinQKeychainSqlite3::generateNewKeys(int count, int type, bool bCompressed)
{
    SQLite3Stmt stmt;

    CoinKey key;
    key.setCompressed(bCompressed);

    stmt.prepare(db, "INSERT INTO `keys` (`hash`, `pubkey`, `privkey`, `type`, `status`, `minheight`, `maxheight`) VALUES (?,?,?,?,?,-1,-1)");
    for (int i = 0; i < count; i++) {
        key.generateNewKey();
        uchar_vector pubkey = key.getPublicKey();
        std::string pubkeyhash = ripemd160(sha256(pubkey)).getHex();
        std::string pubkeyhex = pubkey.getHex();
        uchar_vector privkey = key.getPrivateKey();
        std::string privkeyhex = privkey.getHex();
        stmt.reset();
        stmt.bindText(1, pubkeyhash);
        stmt.bindText(2, pubkeyhex);
        stmt.bindText(3, privkeyhex);
        stmt.bindInt (4, type);
        stmt.bindInt (5, Status::POOL);
        stmt.step();
    }
}