Understand why Bitcoinlib is generating different addresses than what I have

524 Views Asked by At

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.

1

There are 1 best solutions below

0
On BEST 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