0

How do I get to the value in the 'scriptPubKey' part of the transaction ? shows a great example of going from address to scriptPubKey.

I'd like to do something similar: go from private key (ECDSA) to address. How do I do that? References to libs or code, as in the above question, would be appreciated.

marked as duplicate by Nate Eldredge, Jestin, morsecoder Jul 25 '16 at 20:11

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0

From a privatekey (ECC, 32Byte) to an P2PKH address:

  1. Ensure the private key is a valid ECC privat key (libsecp256k1 function)
  2. Calculate the public key from the private key (complex math. function, use a library)
  3. Calculate the RIPEMD160 hash (aka Hash160) from the public key
  4. Do a base58check encoding of the hash160 with a prefix byte 0x00 (for mainnet) or 0x6f for testnet

C code to explore: https://github.com/libbtc/libbtc/blob/3331ec47ca4ad33e8f2e46e6f01dfbeae090c53d/src/toolfunc.c#L22

0

This may be of help, assuming you're fine with PHP code.

https://github.com/peterscott78/synala/blob/master/data/lib/bip32.php#L348

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