Hi all
Does any one have or know a python script that convert Hex private key to all Bitcoin addresses, example:
Private Key HEX: 03902e4f09664bc177fe4e090dcd9906b432b50f15fb6151984475c1c75c35b6
Public Address 1: 1Bu6YxH64nfvhdDsYNEP8PftoBMqgusdPS
Public Address 1 compressed: 18i5PtPisxbGiGGEviW7HPcnfNPmcsscwH
Public Address 3: 38dRrGx5YbrnRWuWcJv5i2XHjYUnHE2wvv
Public Address bc1 P2WPKH: bc1q2jxe5azr6zmhk3258av7ul6cqtu4eu4mps8f4p
Public Address bc1 P2WSH: bc1qdveuf0egtfdnd2fnsp0lzfukn2e58czf8323ky6xt8ydew4ecfcqv3ettx
Thanks in advance!
You need to understand the process... Let me give you an example:
0
9eb45f32d264da4b551b544cca1ee711d8138cd0076055a30f3dca66b7f4528c
Private key Hex (64 characters [0-9A-F])
1
04831776c52a60ee2d6c7793bb8bb8fa5fc53e0a22a3e29a8d3d86c3728fa3b56f4e5d7dad489f7 171cef6dee732aead8047ceedcb561b0ad389acb9c201814075
Public Key (130 characters [0-9A-F]). ECDSA(private key): '04 + x + y'130
2
de031b5896be6595e01acb50b3cf8b917425b538cfe3f51c22dddb6ee5845e5b
SHA-256 hash64
3
8765cec24ae3bb7f9ee05ad0a3f1e28bf077cce8
RIPEMD-160 hash40
4
008765cec24ae3bb7f9ee05ad0a3f1e28bf077cce8
Prefix and RIPEMD-160
5
ee380a657fe9cd6f2e22cec64e7b6b6f8a0b96d4cf02c81e69773d443e518990
SHA-256 hash164
6
5ba69e0fe290f3b10849cc6088897d97827d53b467fe2cfe2faaa5df3e0f2826
SHA-256 hash64
7
5ba69e0f
Checksum - First 8 characters Step68
8
008765cec24ae3bb7f9ee05ad0a3f1e28bf077cce85ba69e0f
Prefix + RIPEMD-160 + Checksum50
9
1DLvBcmt8KpGKr7xNJ5CGxm2aP2dAC2tJJ
Uncompressed address - Base58 encoding34
As you can see, in the step 3 you can find the RIPEMD-160 hash, and from there you can get the address, but here is the trick, even if you don't know the private key from an address, you can calculate the RIPEMD-160 hash direct from any addres, and that way you can know the different address from the same private key without knowing the private key.
Here you will find some python scripts i used in 2022 for this task:
Get the P2WPKH(Bech32) using the Public Key Hash (Hash 160) Python
https://bitcointalk.org/index.php?topic=5410851.0