0

I'm creating many derived addresses from a xprv (HD private key).

I've been reading about the gap limit problem. The gap limit is 20 addresses ahead.

How do I get my wallet to detect funds, in addresses, that have surpassed the gap limit?

i.e. m/100 derived address transactions would not get detected, until the gap limit is filled. Are there any tricks to get around this?

If not, I plan to bulk import corresponding WIF keys for each address. Do people recommend doing this?

Ideally I would like everything controllable via 1 master key.

1

The BIP44 gap limit approach is a weak or even broken concept for recovering BIP32 based wallets.

It makes an assumption about the use case of a BIP44/BIP32 based wallet.

The default limit of 20 (some even use 5) will quickly lead to lost funds in recovery if the wallet was used in non-super-trivial use cases.

The missing metadata in a BIP39 mnemonic or in BIP32 xprivs tend to make recovery complex and has a moderate risk of missing funds.

The ultra-safe(est) way to recover a BIP32 seed without metadata is to derive all possible keys (impossible) and all possible scripts, then, rescan the blockchain. But yes, your guess is right,... this is infeasible.

So how to recover?

If you develop a wallet or rescan tool, use a very large gap limit. Maybe 1'000 or 10'000.

If you are just a novice user?

  • Well, just make sure you keep your old backup in case you detected lost funds.
  • Don't purely trust a BIP32/39 recovery, make sure all your funds are there
  • If not, consult an expert (watch out for fraud, use a trusted person), or research how to extend the gap limit and how to derive multiple script types
  • If you are using Electrum, read here about the gap limits and ways to extend it
  • I want to accept many payments and each address should be used only once. There's a real chance an address doesn't get used at all, which creates this problem. Great advice extending the gap limit! Although surely this uses up storage unnecessarily? Perhaps simply importing used WIF keys every week will suffice. – Luka May 7 at 18:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.