Post
Topic
Board Development & Technical Discussion
Topic OP
How to list all the funded address from a HD wallet?
by
I_love_Crypto
on 18/01/2024, 19:21:27 UTC
Hello Everyone,

My question will probably seem stupid, and i apologize for this but there is something i would like to understand.

I opened a blockchain.com wallet and funded it. I made some transactions with it, and today the balance is 0.0001 BTC. So far so good.
Then i made a copy of the 12 words mnemonic from the blockchain account.

To have a better understanding how HD wallet works, i installed the Python bitcoinlib library using pip
on my computer. Unfortunately it says: no transaction and list some addresses with no balance...

Today i used another Python script:
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
from mnemonic import Mnemonic
import bip32utils

words="w1 w2 w3 w4 w5 w6 w7 w8 w9 w10 w11 w12"
mnemon.check(words)
seed = mnemon.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')
for i in range(10):
   for j in range(10):
      child_key = root_key.ChildKey(i).ChildKey(j)
      child_address = child_key.Address()
      child_public_hex = child_key.PublicKey().hex()
      child_private_wif = child_key.WalletImportFormat()
      print(f'Child key m/{i}/{j}:')
      print(f'\tAddress: {child_address}')
      print(f'\tPublic : {child_public_hex}')
      print(f'\tPrivate: {child_private_wif}\n')
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
I checked the balance of the Child key m/0/0, m/0/1, m/1/0,  m/1/1... They all have a zero balance Sad

So my question is: how to get a list of the address corresponding to non zero balance from the seed of a HD wallet?

Thanks a lot:)




I