You've hit upon an important issue, and one that there isn't a perfect solution to.
Your thin client (most clients that use deterministic wallets are thin clients, but not all) goes through the following process:
- Generate an address.
- Look at the blockchain, and see if it has a balance.
- Repeat with next address, unless the addresses we've checked have had a balance of zero for a long time.
The number of empty addresses you're willing to check before giving up is called the gap limit.
The gap limit can't be too low, or there's a possibility that someone will backup from a wallet seed and not see all of their money. (If this happens to you, increase the gap limit and try again.) It also can't be too high, or you'll waste resources on the servers handling Electrum queries.
Your suggested scenario is actually the easiest to solve, because if each of those addresses has a transaction associated with it in the blockchain, the client knows that it showed that address to you at some point, and will keep searching.
2I suppose a full client could handle a much higher gap limit, since it can check the block chain for an address itself, without querying an external server. – Nate Eldredge – 2014-10-21T05:32:08.280
So in theory it in possible an existing address is never generated even at high limits, so even if you knew the exact address you couldn't regenerate the private key? – jiggunjer – 2017-09-24T06:34:07.507
@jiggunjer No. Set the gap limit high enough, and it will generate every address the client has even shown you, and more. – Nick ODell – 2017-09-24T14:36:00.813
@Nick_Odell how do you know? The generation is a random draw from an infinite set. So I don't see how anyone can guarantee a certain address will be drawn even if you keep drawing 24/7. – jiggunjer – 2017-09-24T15:24:18.153
@jiggunjer It isn't drawn randomly - it's drawn deterministically from a random number. – Nick ODell – 2017-09-24T17:30:22.897
Now it makes sense. Thanks. I had a different math definition of deterministic. – jiggunjer – 2017-09-24T18:12:49.040