python-hdwallet
python-hdwallet copied to clipboard
P2PKH address for the uncompressed public key
Code:
from hdwallet import HDWallet
from hdwallet.symbols import BTC as SYMBOL
hdwallet: HDWallet = HDWallet(symbol=SYMBOL)
PRIVATE_KEY: str = hashlib.sha256(b"asdasd").hexdigest()
hdwallet.from_private_key(PRIVATE_KEY)
print("Uncompressed:", hdwallet.uncompressed())
print("P2PKH Address:", hdwallet.p2pkh_address())
Result:
Uncompressed: fb2b1bf2bcb92b11db6caee48f4a0656dddb0104abc8583a67be81581868ae31551a7aeb83a4004d4b169d4d8020f0b1fd4ae977e4bd9da0d9f3414a0c0353c5
P2PKH Address: 1AQYRDSw3eUo3LuWbdENKdLudxJ2ENuUwN
Problems:
- Shouldn't you add 04 to the beginning of the uncompressed key?
- The address
P2PKH Address: 1AQYRDSw3eUo3LuWbdENKdLudxJ2ENuUwN
is the address of the compressed public key, can you add the P2PKH Address for the uncompressed public key? For the example above, from my calculation the P2PKH address for the uncompressed public key is1Mw7FXN7D7du9umtbkhov2ftELKQw1wFor
Duplicated https://github.com/meherett/python-hdwallet/issues/50