fortesp / bitcoinaddress

Bitcoin Wallet Address Generator
https://pypi.org/project/bitcoinaddress/
MIT License
143 stars 51 forks source link

Need help #5

Closed stdusr closed 3 years ago

stdusr commented 3 years ago

Good day, would you mind providing a small example, how do I generate all possible BTC public addresses (P2PKH, P2SH, Bech32) using existing WIF private key, in string format?

fortesp commented 3 years ago

You need to pick your WIF revert back to byte digest, like so:

digest = base58.b58decode(wif)[1:-4]

and inject that into the Address in the __generate_uncompressed_pubkey method.

fortesp commented 3 years ago

Actually in this new version 0.1.3, you can find new method to generate a Key from wif. Hope it helps.