1

I know there are a lot of posts on this issue but the majority of them are quite old.

Is there a more modern and "simple" solution for the address gap limit problem? For what I've read, the best one is to use Electrum and set the gap limit to something like 5000. Is there the possibility to set it up to infinity?

If instead of generating new addresses each time, would importing external private keys to my wallet, without scanning, and generating a single address per private key solve the gap limit dilema (in a Bitcoin Core wallet, for example)?

Thanks a lot for any input!

1 Answer 1

2

The gap limit is used because there are practically infinite addresses you can generate via Hierarchical Deterministic generation. If you didn't have a limit, the wallet would have to generate all of them, just in case, to see if any where used in transactions. That is impossible, there are just way, way too many possible child addresses.

Is there the possibility to set it up to infinity?

This is the same as having no limit, and it's impossible, as above.

would importing external private keys to my wallet, without scanning, and generating a single address per private key solve the gap limit dilema (in a Bitcoin Core wallet, for example)?

The gap limit is specific to Hierarchical Deterministic wallets, where you can deterministically generate many addresses from a single short seed. This makes backups super easy - backing up the seed means you've backed up all past and future addresses your wallet will generate. The seed is short so you can even write it down by hand. And HD has other benefits like being able to generate child public keys without access to the secret keys (useful for security, to avoid having secret keys "hot" on internet-connected devices).

If you just imported a few individual keys, you wouldn't need a gap limit, but you'd lose all the benefits of HD wallets. That's how Bitcoin Core's wallet used to work - colloquially known as the "bag of keys" model. HD is definitely the better way to manage keys.

3
  • Thanks for the answer! The thing is the PK management that I need is very basic: no scanning for past txs, just listening to ones since each address' creation, and I need to not have a limit on the amount of addresses and/or PKs managed by my wallet (or a very big limit). I have two following questions, if I may: 1) Can I import infinite PKs to a Bitcoin Core wallet? 2) If the gap limit is an issue of HD wallets only, can I create n addresses within a Bitcoin Core wallet without losing the ability to listen to when each address receive a new deposit? @meshcollider
    – dNyrM
    Jan 2, 2022 at 11:29
  • The gap limit only applies when restoring a backup. If you are just creating addresses, then of course all the keys will be tracked by the wallet. Specifically, the answer to both 1) and 2) is yes. Jan 2, 2022 at 18:07
  • Awesome! Thanks again for help. @meshcollider
    – dNyrM
    Jan 2, 2022 at 18:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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