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

  • be careful: bitcoin.stackexchange.com/questions/8449/… – JBaczuk Nov 28 '18 at 15:06
  • @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 generator – Huang Lee Nov 29 '18 at 11:10
  • @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 Nov 29 '18 at 12:05
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

  • May i ask what the function in libsecp256k1 use to create pubkey from pivkey called? the base58 code worked well though – Huang Lee Nov 29 '18 at 11:05
  • github.com/bitcoin-core/secp256k1/blob/ed7c084/include/… : 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 @HuangLee – MCCCS Nov 29 '18 at 13:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.