简体   繁体   中英

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM