Author

Topic: How does an HD wallet know about addresses created from Master Public Key? (Read 379 times)

newbie
Activity: 21
Merit: 2
I suspect you'll find it is the derivation path he is using is incorrect.

I'll guess he has gone with the "standard" m/44'/0'/0' derivation path specified in BIP44 and used by hardware wallets etc... most likely used if it was done by a "library". The problem is that Electrum uses a derivation path of m/0

Both paths will generate "valid" public keys/addresses... but they'll be different.

THANK YOU!

Your tip ultimately directed me to this link: https://bitcoin.stackexchange.com/questions/36955/what-bip32-derivation-path-does-electrum-use

Using the same logic from the approved answer on StackExchange, we updated our code and, voila, the addresses generated match the ones in Electrum

You made my day, HCP (and bob123)

HCP
legendary
Activity: 2086
Merit: 4363
I suspect you'll find it is the derivation path he is using is incorrect.

I'll guess he has gone with the "standard" m/44'/0'/0' derivation path specified in BIP44 and used by hardware wallets etc... most likely used if it was done by a "library". The problem is that Electrum uses a derivation path of m/0

Both paths will generate "valid" public keys/addresses... but they'll be different.
newbie
Activity: 21
Merit: 2
You can set the gap limit with this command:
Code:
wallet.storage.put('gap_limit',[i]X[/i])
Or you could create a bunch of new addresses to see if its contained in there:
Code:
for i in range(0, X): print wallet.create_new_address(false)
false: for recieving addresses
true: for change adresses

I thought about doing this too.  I'll try it if all else fails.

Are you sure this address was derived correctly? He may have used the derivation path for change adresses?
The standard derivation path for electrum is 0/0/ for recieving and 0/1/ for change addresses (i think).

This is a good question and I don't know the answer. I'll ask him and find out. Maybe he's doing it incorrectly.
Thanks for your answer.
legendary
Activity: 1624
Merit: 2481
Is there a way to tell Electrum to query beyond the gap limit?

You can set the gap limit with this command:
Code:
wallet.storage.put('gap_limit',[i]X[/i])
Or you could create a bunch of new addresses to see if its contained in there:
Code:
for i in range(0, X): print wallet.create_new_address(false)
false: for recieving addresses
true: for change adresses


Here's my actual problem:  I have a developer that is using a source code library that can take a MPK and derive a child address from it.  He wrote a test program that did this (using the MPK from my electrum wallet), and I sent a small amount of coin to it.  However, this address never appears in the Electrum wallet.  But it must be a valid child address because it was generated from the same master public key (MPK) and the transaction was successfully broadcast and included in a block.

Are you sure this address was derived correctly? He may have used the derivation path for change adresses?
The standard derivation path for electrum is 0/0/ for recieving and 0/1/ for change addresses (i think).
newbie
Activity: 21
Merit: 2
Electrum has the same master public key that is used in the service you've stated. With that, Electrum will constantly query for transactions in addresses within the gap limit.

For example, your gap limit is 25 addresses. After the initial address generated by default by Electrum, Electrum will continue to look for transactions in the next 25 address. If the next address has a transaction associated with it, Electrum will query another 25 addresses after it, and so on.

Thanks!

Is there a way to tell Electrum to query beyond the gap limit?  Or, better yet, is there a way to tell Electrum to look for an address that was derived in an external application (like that CoinSimple example I gave) that might be beyond the configured gap limit?

Here's my actual problem:  I have a developer that is using a source code library that can take a MPK and derive a child address from it.  He wrote a test program that did this (using the MPK from my electrum wallet), and I sent a small amount of coin to it.  However, this address never appears in the Electrum wallet.  But it must be a valid child address because it was generated from the same master public key (MPK) and the transaction was successfully broadcast and included in a block.

Thanks in advance for any of your input.
legendary
Activity: 3038
Merit: 4418
Crypto Swap Exchange
How does the Electrum wallet know about those transactions? 
Electrum has the same master public key that is used in the service you've stated. With that, Electrum will constantly query for transactions in addresses within the gap limit.

For example, your gap limit is 25 addresses. After the initial address generated by default by Electrum, Electrum will continue to look for transactions in the next 25 address. If the next address has a transaction associated with it, Electrum will query another 25 addresses after it, and so on.
Does the wallet make RPC function calls internally to search/import for these transactions and addresses? 
Nope.
newbie
Activity: 21
Merit: 2

Say I have an Electrum HD wallet and give my Master Public Key to an external service (like CoinSimple for example: https://coinsimple.com/support/how-can-i-accept-bitcoin-directly-to-my-electrum-wallet-using-coinsimple/ )

That service can use my MPK to derive addresses that receive money in transactions.

How does the Electrum wallet know about those transactions? 
Does the wallet make RPC function calls internally to search/import for these transactions and addresses? 

Jump to: