Using alt extended public keys
RemcoMi opened this issue · comments
Remco commented
I would like to derive addresses from a Ltub, Mtub (both Litecoin), drkp (DASH) and dgub (DOGE) extended public key.
Unfortunately, I don't see the option to change this at the Bip44 functions. How would you suggest I can fix that (maybe going through a Bip32 derivation)?
Example:
XPUBLIC_KEY: str = (
"xpub6DzUm6iGq76mWQ5CvkE5EJ6BcECG9pB2hgnLeX7XrxzCJjUfvc5pHYx8Huc668W563BASd35zN369T6RqXVVWhDxteLtMZTxbXMSzX4szCv"
)
bip44change = Bip44Changes.CHAIN_EXT
bip44coin = Bip44Coins.LITECOIN
bip44_mst_ctx = Bip44.FromExtendedKey(XPUBLIC_KEY, bip44coin)
bip44_acc = bip44_mst_ctx.AddressIndex(0)
address = bip44_acc.PublicKey().ToAddress()
print(address) # LVCF3k1YkrGHrTQ5dFVvxPhAm5aZuAvimc
XPUBLIC_KEY: str = (
"Ltub2Zd4ecrc4EV39aLFa3rVRF6p2B6dFhLCcHMnh8WeM4NihTW3M47XsDaK9Vya1Q4isfjvcKfMewvrG3iY8mski6YWxdLc6uzvZqLySUKf9Hc"
)
bip44_mst_ctx = Bip44.FromExtendedKey(XPUBLIC_KEY, bip44coin)
bip44_acc = bip44_mst_ctx.AddressIndex(0)
address = bip44_acc.PublicKey().ToAddress()
print(address) # bip_utils.bip.bip32.bip32_ex.Bip32KeyError: Invalid extended key (wrong net version: 019da462)
Thanks in advance!
Remco commented
Fixed with BIP32