You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Generate addresses for Account Extended Public Key (specifically bip84_pub
What's the error?
It returns None when hparse function is called.
What's the resolution?
The reason hparse returns None is due to this check. if data is None or prefix is None or not data.startswith(prefix).
The prefix comes out as None. The value for bip84_pub_prefix is not set correctly for LTC. That's why the prefix is None. If you remove this condition check, it will generate the correct LTC addresses nevertheless.
I think the real solution is to update symbol/ltc.py and pass extra kwargs bip84_prv_prefix_hex="04b2430c", bip84_pub_prefix_hex="04B24746", in create_bitcoinish_network function.
Here's my full script if you want to reproduce it.
Dependencies: pycoin==0.92.20230326, tqdm
frompycoin.networks.registryimportnetwork_for_netcodefromtqdmimporttqdm# Your BIP32 Account extended public keyZPUB="zpub6qXw6cLRkWUQVGgNU1qXhSmGY9fcmvaosAj6NbbMkBZSD1xUhGVyQvyRPEuCizbEn8arDymyAQZzyxRdcjwL9YszG3fZC2cPUg6uiB8ZvuS"# noqanetwork=network_for_netcode("LTC")
defderive_bech32_address(zpub, derivation_path):
k=network.parse.bip84_pub(zpub) # k will be None because unless that condition explained above is removeda=k.subkey_for_path(derivation_path)
bech32_add=network.address.for_p2pkh_wit(a.hash160())
returnbech32_adddefgenerate_ltc_addresses():
addresses= []
COUNT=100foriintqdm(range(COUNT)):
address=derive_bech32_address(ZPUB, f"0/{i}")
addresses.append(address)
withopen("ltc_addresses.txt", "w") asf:
foraddressinaddresses:
f.write(f"{address}\n")
if__name__=="__main__":
generate_ltc_addresses()
The text was updated successfully, but these errors were encountered:
What I was trying to do?
Generate addresses for Account Extended Public Key (specifically
bip84_pub
What's the error?
It returns
None
whenhparse
function is called.What's the resolution?
The reason
hparse
returnsNone
is due to this check.if data is None or prefix is None or not data.startswith(prefix)
.The
prefix
comes out asNone
. The value forbip84_pub_prefix
is not set correctly for LTC. That's why the prefix is None. If you remove this condition check, it will generate the correct LTC addresses nevertheless.I think the real solution is to update
symbol/ltc.py
and pass extra kwargsbip84_prv_prefix_hex="04b2430c", bip84_pub_prefix_hex="04B24746",
increate_bitcoinish_network
function.Here's my full script if you want to reproduce it.
Dependencies:
pycoin==0.92.20230326
,tqdm
The text was updated successfully, but these errors were encountered: