leather-io / extension

Leather browser extension
https://leather.io
MIT License
293 stars 140 forks source link

Standardize Stacks derivation path and provide migration option for users #4224

Open stjepangolemac opened 1 year ago

stjepangolemac commented 1 year ago

Here's the structure of a derivation path:

m / purpose' / coin_type' / account' / change / index

In Leather, STX addresses use the index component to differentiate between accounts in the wallet. On the other hand, BTC addresses use the account component.

What is the reason for this discrepancy? Shouldn't they both use either account or index to derive different accounts?

kyranjamie commented 1 year ago

This is a legacy decision from early stacks days. We'd rather follow the bitcoin scheme, however building the wallet we wanted to keep backwards compatibility, and so kept to the scheme of using address index for accounts.

stjepangolemac commented 1 year ago

Okay, thank you for a quick response. 👍

markmhendrickson commented 1 year ago

Thanks for the inquiry, @stjepangolemac.

As @kyranjamie has indicated, this was a (mistaken it seems) decision made years ago when Stacks was first developed. Though it may indeed be worth rectifying and providing users with migration options at some point.

We haven't heard of real-world issues that result from this discrepancy yet, aside from with Ledger Live, which recently added STX as a native asset and apparently cannot be configured to follow the same (incorrect) approach we've taken (not that it should necessarily).

As a result, the first accounts in Leather and Ledger Live appear the same, but any subsequent ones don't.

I'm reopening and modifying the title to track a possible switch on our end as well for the sake of long-term standardization.

stjepangolemac commented 1 year ago

Yes I've noticed the same when loading the seed in the Electrum wallet.

314159265359879 commented 3 months ago

Today I helped a user who was surprised by this. They send SIP010 tokens to their Ledger Live Stacks address (account 2) which is inaccessible in Leather, and Ledger Live doesn't support SIP010 yet.

They would be helped by an option to reveal/access addresses along the account index path, m/5757'/0'/1'/0/0 to be exact, within Leather.