1

I want to create a boolean result method WasGeneratedBy that takes two params, a bitcoin address, and a BIP32 pub key. Is there an efficient algorithm (and library, NBitcoin?) to accomplish this?

EDIT:

I'm showing my BIP32 newbieness.. Based upon the first response I received, I would like to modify my desired method such that all required parameters are present (including path). This method gets its information from public web service so obviously that precludes any private keys or other that the user would be unlikely to submit.

I believe this should be possible given this blockchain.info example

https://blockchain.info/xpub/xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz

1

If you know the path and the xpubkey, you can just generate the address and see if it matches with what you expect.

If you don't know the (entire) path you can simply start trying a lot of different paths, but in principle you could spend an infinite amount of time, so in that case your function would never return false.

  • In practice, do most/all implementations of wallets using xpubkey generated addresses follow a default path? or is there really no reliable serialized means by which to exhaustively search for an address? – Sean Oct 15 '15 at 20:33
  • 1
    @Sean There isn't a widely followed standard, but one of our users made a list of common path formats: bitcoin.stackexchange.com/questions/36955/… – Nick ODell Oct 16 '15 at 6:36
  • @Nick Ok, I see how different wallets could conceivably produce different series' of addresses based upon their proprietary preference for paths, however, I discovered BIP-44 defines an interrogation algorithm that assumes all your valid addresses lie before the first unused 20 addresses in a branch, and all valid branches lie before the first empty branch. So assuming the address-from-path generation formula is strictly defined, is it possible to rapidly generate the entire list of users addresses by cross-referencing generated addresses against the addresses represented in the blockchain? – Sean Oct 16 '15 at 22:16
  • @Sean Yes, assuming those things are true, you can enumerate the user's addresses that way. – Nick ODell Oct 16 '15 at 22:24
1

There is no such algorithm.

You need to know the path.

  • I updated the question if you wouldn't mind revisiting it :) – Sean Oct 15 '15 at 20:15

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.