Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect Existing Accounts button for BIP39 wallets missing accounts only using change addresses #7804

Closed
ghost opened this issue May 7, 2022 · 2 comments

Comments

@ghost
Copy link

ghost commented May 7, 2022

A user on Bitcointalk was trying to import their now defunct BRD wallet in to Electrum. After entering their seed phrase and hitting the "Detect existing accounts" button, it found their legacy account, which contained a transaction history but not their coins. After some investigation it transpired that BRD sent the change from their m/0' legacy account to change addresses in their m/0' segwit account. The user in question had not used any of the receiving addresses in the segwit account.

Since the "Detect existing accounts" button only scans the first 20 receiving addresses, and no change addresses, it did not pick up the coins in their segwit account. After some confusion, the user in question finally tracked down their coins by manually entering the script type and derivation path.

You can read the thread in question from this post onwards: https://bitcointalk.org/index.php?topic=5391541.msg60057185#msg60057185

I'm sure BRD will not be the only wallet which does this, and it could happen again with other wallets and other address types in the future. Is it worth having the "Detect existing accounts" button scan the first few change addresses too? I don't see any real down side to this - it would only prolong the wait after clicking said button by a few seconds, and places minimal additional load on servers.

@SomberNight
Copy link
Member

Thank you for the report.

@SomberNight
Copy link
Member

Fun fact, this is another scenario not foreseen by BIP39/BIP44:

Address gap limit

Address gap limit is currently set to 20. If the software hits 20 unused addresses in a row, it expects there are no used addresses beyond this point and stops searching the address chain. We scan just the external chains, because internal chains receive only coins that come from the associated external chains.

SomberNight added a commit that referenced this issue May 26, 2022
@SomberNight SomberNight added this to the 4.2.2 milestone May 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant