Giter Site home page Giter Site logo

Comments (5)

iancoleman avatar iancoleman commented on August 15, 2024

Thanks for this detailed issue report.

I'm backlogged until next week but let me answer what I can now.

Restoring this seed to Electrum (as BIP39) creates the same address list, But the actual xprv stored in the Electrum wallet is different from above.

The xprv stored in electrum is derived using the path m/44'/0'/0'

This is one level up from the BIP44 tab path of m/44'/0'/0'/0

The reason for this is electrum needs to be able to generate m/44'/0'/0'/0/X (ie the external addresses), as well as m/44'/0'/0'/1/X (ie change addresses). So it stores the level above what you might expect from the BIP44 tab.

Electrum (and all BIP44 wallets) should probably store m/44'/0' so they can also scan for multiple accounts, but I guess electrum only uses a single account.

Enter the the electrum xprv key into the tool and use BIP32 tab with derivation path m/0 to see the list of addresses electrum generates (m/1 for the change addresses used internally by electrum).

when the BIP32 xprv above, from this tool, is used to restore a wallet [in electrum] you get a different address list.

Use the mnemonic to restore. Or if using an xprv, use the xprv from the BIP32 tab with derivation path m/44'/0'/0'

I need to get the latest electrum to test this, but restoration should always be done with the mnemonic rather than the xprv.

the seed word list I started with above results in an xpub that is not usable in Electrum.

Use the BIP32 tab and the derivation path m/44'/0'/0'

This will give the same xpub as electrum, but not the same addresses for the reason stated above.

On a related tangent, if you enter your electrum xpub into blockchain.info search, it will find all addresses (external and change).

the matching xpub will not generate a same watch-only wallet

It will when using the correct derivation path for the xpub which is m/44'/0'/0'

I will add a section on the BIP32 tab for electrum, which will be identical to the Mycelium section since they work the same way.

The issue comes down to how wallets import / restore, and as you point out there are differences.

In my opinion, wallets should import from the path m/44'/0' and should discover both accounts and addresses. But the current expectation seems to be for users to keep track of accounts and the wallet to only gap the addresses. (Actually my real opinion is import should only happen using mnemonics, never xprv or xpub).

See Account Discovery and Address Gap Limit for more info.

Perhaps this issue illustrates why this tool is a tool and not a wallet... wallets do a lot of automatic discovery that is somewhat beyond the scope of this tool (at least for now).

Hope this is clear, if not please highlight the specific concerns and I can try to explain it better.

Points of action from this:

  • Add electrum to BIP32 tab explanations
  • Consider how the BIP44 tab may be clearer for end users wrt account and address discovery.

from bip39.

neocogent avatar neocogent commented on August 15, 2024

Thank you for your explanation. I didn't see your response when I had googled about this and found the closed earlier issue #7 which had the derivation path explanation as well. I tested this out in the BIP32 tab and shortened path. It worked as you explained and matched Electrum xpub. So this tool works correctly and I'm happy about that. That is, knowing that the xpub with that path matches Electrum gives me confidence this tool behaves as it should.

The only thing I'd maybe suggest is that on your BIP44 tab perhaps have the External/Internal entry be optional via a blank entry or check box option. So that if a user wants to see an xpub for the whole account and not sub level for ext/int then they could either leave it blank or maybe better, choose to disable it (hides address list?). I think users trying out your tool could then easily see that the upper level account xpub does work for Electrum (and perhaps other wallets) - rather than have to know about the correct way to enter a path in the BIP32 tab.

I'm happy that there is a reasonable explanation for what I took to be perhaps broken behavior. Your tool is excellent and very useful as an offline way of working with seeds, xprv, xpub values. Maybe it just needs a bit more info about how wallets are using these so that users aren't confused about using the tool and getting matching results.

I'm not currently depending on the tool for actual funds and simply wanted to verify it's use as a backup for future scenarios where Electrum or my hardware wallet aren't available. To this end for a self contained tool that one can store away eg. on an offline boot usb stick it's most useful with extra help info so that users don't have to remember details like this.

I wonder if rather than adding Electrum info to the BIP32 tab it may be better to add a tab for Electrum or common wallets (Mycelium) that use the correct path with some details. That way it's very easy for a user to choose the correct tab and see right away the matching xpub values. Maybe it has a toggle button for int/ext path or lists both address chains.

Anyway, all is good. Thank you for your excellent tool and explanation. I look forward to an update, whichever way you decide to go, that removes confusion.

from bip39.

iancoleman avatar iancoleman commented on August 15, 2024

This change is in c554e6f - BIP44 Account xprv and xpub keys are shown which are used for import / export in most BIP44 wallets

This change is live at https://iancoleman.github.io/bip39/ and can be seen in the BIP44 tab.

I think this UX is clear, but would appreciate confirmation before closing the issue.

on your BIP44 tab perhaps have the External/Internal entry be optional via a blank entry or check box option. So that if a user wants to see an xpub for the whole account and not sub level for ext/int then they could either leave it blank or maybe better, choose to disable it (hides address list?).

I see what you're getting at here but I think hiding the address list is not possible, because that list is the primary 'end purpose' of the tool. I feel that hiding that list under any circumstances would be quite confusing. (I'm just making a note of this design choice for posterity. Thanks for bringing it up.)

from bip39.

neocogent avatar neocogent commented on August 15, 2024

I had a look and I think that's very clear. It allows people to decide which xprv/xpub they want and how they're different, and should prevent trying to use the wrong ones.

I noticed a minor typo on the line above account keys: The account extendend keys can be used...

I'm fine with closing this, as you like.

from bip39.

iancoleman avatar iancoleman commented on August 15, 2024

Good catch on the typo

f3bfd2a - Typo Extendend > Extended

from bip39.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.