HD wallets create derivation paths for generated keys. But if you need to regenerate these keys with your seed or master key, where do you get the derivation paths? I don't see how they can be stored in the seed somehow. Does a wallet bruteforce derivation paths to find UTXOs with balances?
1 Answer
I'm not a wallet developer but this is how I imagine the process of discovering funds in a seeded HD wallet works:
Start generating addresses for Account #0 and check if they appear in the blockchain history. After you see a long run of addresses with no history (say a few hundred), you can assume that's all the addresses that were used on this account. Do the above for Account #1, Account #2... until you start seeing accounts with no used addresses at all (again choose some cutoff point), then assume that's all the accounts.
If your seeded wallet supports multiple address types (Legacy, P2SH SegWit, Native SegWit), do the above for all of them.