Any ideas? Thanks a lot, i appreciate your help:)
I've edited your code to work in legacy addresses at derivation path m/44'/0'/0'/0/0~20:
import bip32utils
from bip32utils import BIP32_HARDEN
from mnemonic import Mnemonic
words="hidden common actress negative cactus quote hole filter aunt confirm neutral voice"
mnemo = Mnemonic("english")
seed = mnemo.to_seed(words)
print(f'BIP39 Seed: {seed.hex()}\n')
root_key = bip32utils.BIP32Key.fromEntropy(seed)
root_address = root_key.Address()
root_public_hex = root_key.PublicKey().hex()
root_private_wif = root_key.WalletImportFormat()
print('Root key:')
print(f'\tAddress: {root_address}')
print(f'\tPublic : {root_public_hex}')
print(f'\tPrivate: {root_private_wif}\n')
purpose = (84)
coin = (0)
for account in range(1):
for chain in range(1):
for address in range(20):
child_key = root_key.ChildKey(purpose + BIP32_HARDEN).ChildKey(coin + BIP32_HARDEN).ChildKey(account + BIP32_HARDEN).ChildKey(chain).ChildKey(address)
child_address = child_key.Address()
child_public_hex = child_key.PublicKey().hex()
child_private_wif = child_key.WalletImportFormat()
print(f'Child key m/{purpose}H/{coin}H/{account}H/{chain}/{address}:')
print(f'\tAddress: {child_address}')
print(f'\tPublic : {child_public_hex}')
print(f'\tPrivate: {child_private_wif}\n')
You can test the mnemonic seed above in IanColeman's BIP39 tool and compare the results in BIP44 tab.
Unfortunately, bip32utils doesn't support SegWit so even if you put the correct derivation path index (
84) for "
purpose",
it'll only display legacy address but with the correct public and private keys of your Blockchain web wallet's SegWit addresses.
You'll have to use another library to display the correct address.
Note: "
H" in the path means that it's derived with "
hardened" derivation path.
You can increase the range of "
account" depending on how many extra private key wallets you've created in 'Accounts and Addresses' page.