Ad

Understand Why Bitcoinlib Is Generating Different Addresses Than What I Have

Here is the library in question https://github.com/1200wd/bitcoinlib.

When I try to create an address using the same keywords for example

abs=a.from_passphrase('average title retreat fox hundred wife figure disease dry admit choice volcano')

(example list) I think I understand that it uses bip44 to generate a WIF and Address but when I check the address using Ian Coles Mnemonic Code Converter https://iancoleman.io/bip39/ it gives a different address than the one given from bitcoinlib.

Are they each using different methods to create an address? Is there way I can get bitcoinlib to spit out the same address from a mnemoic word list as in Ian Cole's converter.

Ad

Answer

It could be that you mix up derivations paths. In the following example the first BIP44 is derived with the subkey_for_path method. This results in the same key as the derived key on the https://iancoleman.io/bip39/ website.

from bitcoinlib.keys import HDKey

passphrase = 'average title retreat fox hundred wife figure disease dry admit choice volcano'
hdkey = HDKey().from_passphrase(passphrase)
print(hdkey.subkey_for_path("m/44'/0'/0'/0").wif())

Prints key: xprvA2JHceND8fsMyVMG1u6cxTTcpizTjEo7ujW8wL74UvajacfKr6M28BbUwaPGGeLzU3zyrrYvzzhFyAapqWVh97KYBzvmyvsHQeR6NTTCmTG

Ad
source: stackoverflow.com
Ad