Looking for code generate bitcoin address from passphase in C++

0

i'm try to write a program which generate bitcoin address from given hash sha256 of passphase as private key or given hex private key. I've found a library for this but it required Boost package in visual studio which took nearly 6GB,totally unnessary for a program like this. Is there any available library to convert hex private key straight into address? No need to make wif private key, though

Huang Lee

Posted 2018-11-28T14:38:49.320

Reputation: 3

@JBaczuk you can generate your own hex private key though, it doesn't have to be passphase, i don't like default EC random private key generatorHuang Lee 2018-11-29T11:10:22.810

@HuangLee generating your own entropy is exactly the point at which most humans will fail miserably, and in bitcoin-land that means your bitcoins get stolen. Be very sure you completely understand the dangers of brain wallets, or else you will find yourself with an empty wallet.chytrik 2018-11-29T12:05:03.780

Answers

1

You need:

1) libsecp256k1 to calculate the public key from a private key

2) Hash the result with Sha2/256 + RipeMD160

3) Add version byte and 4-byte checksum

4) Encode it using Base58. My minimal code would work.

So, it's not really simple

MCCCS

Posted 2018-11-28T14:38:49.320

Reputation: 5 827

May i ask what the function in libsecp256k1 use to create pubkey from pivkey called? the base58 code worked well thoughHuang Lee 2018-11-29T11:05:27.723

https://github.com/bitcoin-core/secp256k1/blob/ed7c084/include/secp256k1.h#L518 : In order: secp256k1_ec_seckey_verify, secp256k1_ec_pubkey_create and secp256k1_ec_pubkey_serialize but first you should use secp256k1_context_create and secp256k1_context_randomize Let me know if something's unclear @HuangLeeMCCCS 2018-11-29T13:17:17.530