I was trying to figure out how exactly the Blockchain gap limit works. I've read the following question on Bitcoin Beta: How to solve Blockchain 20 address gap-limit problem? and started thinking. Maybe I am not getting this right, but in the answer to that question, it says, that the Blockchain will always look ahead 2-22 addresses, to see if any payment came inside, starting from the index of the address, that received payment last.

Am I correct in stating, that, if for example, 2 users try to send me a payment of XBT.

User 1, asks to deposit some XBT to me, gets an address from my site, with index 1. Then, a minute later, user 2 does the same, and gets an address with index 2. If in this case, user 2 makes the payment faster then user 1, the Blockchain won't see the payment from user 1, because from this onward, only addresses with index 2-24 will be checked?

If this is the case, this seems like a serious issue to me, maybe I am understanding something incorrectly, can anyone clear this up to me?


No, that's not how it works. Blockchain (and most other HD wallets by default, as set in BIP 44) look forward 20 addresses before deciding that no more are being used, it doesn't ignore the ones before that. Its purely a way of telling which ones you're using, because you can generate effectively as many as you want using incremental indices, and you wallet shouldnt have to check them all every time you update your balance. So it checks index 1, then 2, and so on, until it finds a stretch of 20 unused addresses in a row before assuming it's reached the end of the addresses you are using currently. If at some point in the future, you received a payment on one of those 20 in the gap, the wallet would begin looking 20 indices higher from that one.

So the only way you could miss payments is if they were too far in the higher indices not lower, e.g. no payments on indices above 10 but one on 30 would go unseen, because the wallet would give up looking after 20 unused. That's why blockchain usually warns you if you're approaching the gap limit rather than silently letting you.

  • what happen if we reach the gap limit? is always something that we can fix just increasing that number in our wallet or we could loose the funds forever in some cases? my question here: bitcoin.stackexchange.com/questions/88128/… – Enrique Jun 3 at 2:06

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.