Closed tajelp closed 2 months ago
Hi, you have to tell the library to use the legacy address for Bitcoin Cash:
Bip44Conf.BitcoinCashMainNet.UseLegacyAddress(True)
So, your code will be:
from bip_utils import Bip39SeedGenerator, Bip44Conf, Bip44, Bip44Changes, Bip44Coins
mnemonic = 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon art'
seed_bytes = Bip39SeedGenerator(mnemonic).Generate()
Bip44Conf.BitcoinCashMainNet.UseLegacyAddress(True)
bip44_mst_ctx = Bip44.FromSeed(seed_bytes, Bip44Coins.BITCOIN_CASH)
bip44_acc_ctx = bip44_mst_ctx.Purpose().Coin().Account(0)
bip44_chg_ctx = bip44_acc_ctx.Change(Bip44Changes.CHAIN_EXT)
bip44_addr_ctx = bip44_chg_ctx.AddressIndex(0)
address = bip44_addr_ctx.PublicKey().ToAddress()
print(address)
Thank you so much for the swift reply! I truly appreciate it!
Hello, if I try, for example, to derive the
bitcoincash:
address (m/44'/145'/0'/0/0
) of the following mnemonic:I get this address:
Now, according to this explorer, the corresponding legacy address should be:
But how can I derive it?