python-hdwallet icon indicating copy to clipboard operation
python-hdwallet copied to clipboard

P2PKH address for the uncompressed public key

Open meir555 opened this issue 2 years ago • 1 comments

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:

  1. Shouldn't you add 04 to the beginning of the uncompressed key?
  2. 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 is 1Mw7FXN7D7du9umtbkhov2ftELKQw1wFor

meir555 avatar Jun 22 '22 21:06 meir555

Duplicated https://github.com/meherett/python-hdwallet/issues/50

meherett avatar Jun 25 '22 04:06 meherett