Author

Topic: Forcing Electrum to search deeper into change addresses (Read 182 times)

legendary
Activity: 3472
Merit: 10611
i have to open both projects in my visual studio and go through the code thoroughly to be sure but as far as i can tell it is not random. when you requests a new key it gets the path and increments it[1] by calling this function from NBitcoin[2] which is simply adding 1 to the last index.

[1] https://github.com/zkSNACKs/WalletWasabi/blob/413de9132a4fa62cae71d85442be02afb0ca9713/WalletWasabi/KeyManagement/KeyManager.cs#L170
[2] https://github.com/MetacoSA/NBitcoin/blob/63580bde6da6e77df686776e0cd16695a3dc40d1/NBitcoin/BIP32/KeyPath.cs#L110-L117
HCP
legendary
Activity: 2086
Merit: 4363
I was in touch with the lead dev of Wasabi Wallet and he told me "random within a range". I assume they set an upper limit for that range. Was interesting to see - first wallet I came across who randomized this allocation.
And what happens when you want to restore your wallet?  If it is randomising the index... how is the wallet supposed to know where the previous wallet randomized the index to? Huh

Or will it simply just search every address in the "limited" range?


Quote
However, I can't see really think of any benefit to this process. They don't generate the addresses when you initialize but you have to request (and label) a new address every time you want to receive.
Nor me... it doesn't seem like that will create any sort of additional privacy... the range would have to be limited to make restoring the wallet a possibility without ridiculous wait times... which would then make it trivial for anyone interested (and in possession of your xpub) to simply search that whole range.  Undecided Huh

I must be missing something obvious... (not unusual! Tongue)
newbie
Activity: 22
Merit: 0
Is it really random? There are over 2 billion possibilities for non-hardened addresses. How many do you plan to search them all?
I was in touch with the lead dev of Wasabi Wallet and he told me "random within a range". I assume they set an upper limit for that range. Was interesting to see - first wallet I came across who randomized this allocation. However, I can't see really think of any benefit to this process. They don't generate the addresses when you initialize but you have to request (and label) a new address every time you want to receive.

I'll probably search through the first couple hundred max. So far they been in the lower two digit range. Thanks very much for the code!

BTW default gap limit (last used+) is 6 for change addresses. AFAIK you can't change the gap limit for change addresses only generate new addresses manually.

Awesome! Thanks for that info.
legendary
Activity: 3710
Merit: 1586
Is it really random? There are over 2 billion possibilities for non-hardened addresses. How many do you plan to look through?

You can generate 20 new change addresses using the code below on the console tab (view > show console if you can't see it) but it'll only create them sequentially starting from the index of the last generated address not randomly in the chain:

Code:
for thing in range(0,20): wallet.create_new_address(True)
wallet.synchronize()


BTW default gap limit (last used+) is 6 for change addresses. AFAIK you can't change the gap limit for change addresses only generate new addresses manually.
newbie
Activity: 22
Merit: 0
I'm questioning whether I can force Electrum to search deeper into the derived change-address range for utxos.

Reason: Wasabi wallet seems to send mixed utxos back to a change address in a random index range of m/84'/0'/0'/1 and I'd like to watch the wallet with the zpub in Electrum.

I would additionally be interested in the default settings in Electrum regarding "searching" for utxos. Something like "last index with utxo +5" or so?
Jump to: