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

<p>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.</p>

CC BY-SA 3.0
2015-10-15T20:33:56.083Z
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
CC BY-SA 3.0
2015-10-16T06:36:57.730Z
@Sean There isn't a widely followed standard, but one of our users made a list of common path formats: http://bitcoin.stackexchange.com/questions/36955/what-bip32-derivation-path-does-electrum-use#comment43246_36956
Nick ODell
CC BY-SA 3.0
2015-10-16T22:16:44.297Z
@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
CC BY-SA 3.0
2015-10-16T22:24:07.277Z
@Sean Yes, assuming those things are true, you can enumerate the user's addresses that way.
Nick ODell
CC BY-SA 3.0
2015-10-15T20:27:17.210Z
2015-10-15T20:52:17.010Z
2015-10-15T20:52:17.010Z
Jannes
<p>There is no such algorithm.</p>

<p>You need to know the path.</p>

CC BY-SA 3.0
2015-10-15T20:15:25.973Z
I updated the question if you wouldn't mind revisiting it :)
Sean
CC BY-SA 3.0
2015-10-15T20:10:05.380Z
2015-10-15T20:10:05.380Z
Pieter Wuille
<p>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?</p>

<p>EDIT:</p>

<p>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.</p>

<p>I believe this should be possible given this blockchain.info example</p>

<p><a href="https://blockchain.info/xpub/xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz" rel="nofollow">https://blockchain.info/xpub/xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz</a></p>

<bip32-hd-wallets>
C# How to determine if a bitcoin address was generated by a BIP32 pub key?
Sean
# C# How to determine if a bitcoin address was generated by a BIP32 pub key?

(Asked by: username_0 on 2015-10-15)

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>

**Tags:** bip32-hd-wallets


---

## 2 answers

### Answer by username_1 on 2015-10-15. Score: 1 | Accepted answer

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.

> **Comments:**
> **username_0**: 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?  
> **username_2**: @username_0 There isn't a widely followed standard, but one of our users made a list of common path formats: http://bitcoin.stackexchange.com/questions/36955/what-bip32-derivation-path-does-electrum-use#comment43246_36956  
> **username_0**: @username_2 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?  
> **username_2**: @username_0 Yes, assuming those things are true, you can enumerate the user's addresses that way.  

---

### Answer by username_3 on 2015-10-15. Score: 1

There is no such algorithm.

You need to know the path.

> **Comments:**
> **username_0**: I updated the question if you wouldn't mind revisiting it :)  

---

