<p>The BIP44 gap limit approach is a weak or even broken concept for recovering BIP32 based wallets.</p>
<p>It makes an assumption about the use case of a BIP44/BIP32 based wallet.</p>
<p><strong>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.</strong></p>
<p>The missing metadata in a BIP39 mnemonic or in BIP32 xprivs tend to make recovery complex and has a <strong>moderate risk of missing funds</strong>.</p>
<p>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. <strong>But yes, your guess is right,... this is infeasible</strong>.</p>
<p>So how to recover?</p>
<p>If you develop a wallet or rescan tool, use a very large gap limit. Maybe 1'000 or 10'000.</p>
<h2>If you are just a novice user?</h2>
<ul>
<li>Well, just make sure you keep your old backup in case you detected lost funds.</li>
<li>Don't purely trust a BIP32/39 recovery, make sure all your funds are there</li>
<li>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</li>
<li>If you are using Electrum, read here about <a href="http://docs.electrum.org/en/latest/faq.html" rel="nofollow noreferrer">the gap limits and ways to extend it</a></li>
</ul>

CC BY-SA 4.0
2019-05-07T18:21:33.497Z
2019-05-07T18:21:33.497Z
2020-06-16T11:10:03.350Z
Jonas Schnelli
<p>I'm creating many derived addresses from a <code>xprv</code> (HD private key).</p>

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

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

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

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

<p>Ideally I would like everything controllable via 1 master key.</p>

<private-key-import><deterministic-wallets>
Deterministic - BIP32 Derivation Gap Limit
Luka
# Deterministic - BIP32 Derivation Gap Limit

(Asked by: username_0 on 2019-05-07)

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.

**Tags:** private-key-import, deterministic-wallets


---

## 1 answers

### Answer by username_1 on 2019-05-07. Score: 1 | Accepted answer

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](http://docs.electrum.org/en/latest/faq.html)


---

