Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: keeshux on August 31, 2014, 12:26:19 PM



Title: BIP32: scan gap limit without a full node
Post by: keeshux on August 31, 2014, 12:26:19 PM
Considering the gap limit as the number of unused addresses before stopping generating chain addresses, I wonder how you would scan such addresses in an SPV environment. Would you rely on web services like blockchain.info or biteasy.com for setting up the Bloom filter for the initial sync?

This is the sync preamble of a HD wallet:

  • 1. Establish a gap limit G.
  • 2. Generate some spare m/k'/0/i addresses starting from i = 0.
  • 3. Look up the blockchain for usage of the above addresses in any transactions.
  • 4. Stop when at least G consecutive unused addresses are found.
  • 5. Load a Bloom filter with all the generated addresses before the gap.
  • 6. Start syncing.

Well, I don't know how to efficiently implement step 3, given that relying on 3rd parties is not ideal.

Thanks!


Title: Re: BIP32: scan gap limit without a full node
Post by: dabura667 on August 31, 2014, 03:48:09 PM
Code:
http://btc.blockr.io/api/v1/address/info/198aMn6ZYAczwrE5NvNTUMyJ5qkfy4g3Hi,1L8meqhMTRpxasdGt8DHSJfscxgHHzvPgk

Replace the addresses with what you want to query, it will come back as a json.


Title: Re: BIP32: scan gap limit without a full node
Post by: keeshux on August 31, 2014, 06:30:24 PM
Code:
http://btc.blockr.io/api/v1/address/info/198aMn6ZYAczwrE5NvNTUMyJ5qkfy4g3Hi,1L8meqhMTRpxasdGt8DHSJfscxgHHzvPgk

Replace the addresses with what you want to query, it will come back as a json.

Quote
Well, I don't know how to efficiently implement step 3, given that relying on 3rd parties is not ideal.

dabura, I'm looking for robust solutions (if any) based on the Bitcoin network itself, I don't like at all the idea that syncing a thin client requires an external service provider. A more natural process should exist to check "used" addresses, perhaps something like the filterload extension. The only concern is privacy because the peer needs to learn about our exact addresses to scan them for usage. The same applies to the web services approach though.


Title: Re: BIP32: scan gap limit without a full node
Post by: fbueller on September 01, 2014, 03:51:48 AM
Connect to random stratum servers and request your transactions through them! That's what electrum does.


Title: Re: BIP32: scan gap limit without a full node
Post by: keeshux on September 01, 2014, 04:53:58 PM
Thanks fbueller, very useful information. Lurking around I stumbled upon BIP 33 (https://github.com/bitcoin/bips/blob/master/bip-0033.mediawiki) that could even provide a solution at the Bitcoin network level. Is this scheduled for implementation in Bitcoin Core?