Author

Topic: Derivation Path on electrum (Read 177 times)

legendary
Activity: 2268
Merit: 18771
November 04, 2023, 09:08:48 AM
#10
They probably just stick to calling it "master key" instead of "extended key". (well, that caused some confusion)
Yeah, it's a bugbear of mine and something that pretty much all wallets (and most users) do. The term "master private key" should be reserved for the key at path m. Anything at a lower level than that is an "extended private key". The "extended private key" unique to a specific wallet is the "account extended private key".

In the case of Electrum segwit wallets, then m is the master private key and m/0' is the account extended private key.
legendary
Activity: 2618
Merit: 6452
Self-proclaimed Genius
November 04, 2023, 08:34:09 AM
#9
Under the hood, Electrum derives a "master private key" (m) from the seed and derive external and internal chains at (m/0 and m/1) for receiving and change address parent extended keys.
Then, the addresses which at (m/0/0~19 and m/1/0~9) for the initial 20 receiving and 10 change addresses.
This is only the case for legacy wallets. Electrum uses m/0' (rather than just m) for single-sig segwit wallets, which has obviously been the default wallet type for some time.
Okay, I checked and the output of getmasterprivate() command with SegWit wallets is indeed already at m/0' and the master public key in "Wallet->Information" is its pair.


So they instead used the hardened child extended private key as SegWit master private key.
They probably just stick to calling it "master key" instead of "extended key". (well, that caused some confusion)

But with it, my post is still applicable to SegWit when it comes with deriving the private keys or addresses from the "master private key" - output of getmasterprivate() command.
legendary
Activity: 2268
Merit: 18771
November 04, 2023, 03:50:45 AM
#8
Under the hood, Electrum derives a "master private key" (m) from the seed and derive external and internal chains at (m/0 and m/1) for receiving and change address parent extended keys.
Then, the addresses which at (m/0/0~19 and m/1/0~9) for the initial 20 receiving and 10 change addresses.
This is only the case for legacy wallets. Electrum uses m/0' (rather than just m) for single-sig segwit wallets, which has obviously been the default wallet type for some time.

2FA (legacy and SegWit): m/1'/0/
This is not quite right either. Electrum uses the following:

Legacy: m
Segwit: m/0'
Legacy multi-sig: m
Segwit multi-sig: m/1'

It will then append /x/y to the above derivation paths, with x being 0 or 1 for receiving or change, and y being the address index. For 2FA wallets, your three master keys are derived at m/0', m/1', and m, respectively. The final key at m is the one which is derived from your previous two keys and the hardcoded TrustedCoin key.
legendary
Activity: 3472
Merit: 10611
November 04, 2023, 12:58:30 AM
#7
If i do lost the access to this wallet, and I put the seeds on other machine to recover my wallet
The thing about Electrum mnemonics is that unlike BIP39 they have a hidden version inside of them that tells your wallet what type of addresses and at what derivation path to derive from the seed. That means you do not need to know this two important information (address type and path).

So if you use another Electrum software on any other device or if you use another wallet software that supports the same algorithm (like Bluewallet) it should derive the correct addresses for you without needing any additional steps.

However if you want to know the derivation paths, here they are:
Standard: m/0/
SegWit: m/0'/0/
2FA (legacy and SegWit): m/1'/0/

I believe change addresses are derived at /1/ instead of /0/ meaning for example SegWit change address is derived at m/0'/1/
legendary
Activity: 2618
Merit: 6452
Self-proclaimed Genius
November 03, 2023, 11:35:36 PM
#6
If i do lost the access to this wallet, and I put the seeds on other machine to recover my wallet and the funds are 0, this might be because I haven't inserted the derivation path... so I should put m/0'/n' on it (considering it is a standard wallet) and then my problem is solved? If not, what should I do? What are the concerns about it?
If you restore it to Electrum, it wont ask you for a derivation path just like when you created the wallet.

But if you restore it to another wallet, that depends on the wallet and its restore options.
Some wallets directly support the seed phrase; some wallets that accept descriptors can import the master private key with the correct derivation path.

Some useful info:
Under the hood, Electrum derives a "master private key" (m) from the seed and derive external and internal chains at (m/0 and m/1) for receiving and change address parent extended keys.
Then, the addresses which at (m/0/0~19 and m/1/0~9) for the initial 20 receiving and 10 change addresses.
This is only useful for deriving the keys and addresses from the master private key using tools like IanColeman's BIP39 tool or for import via "descriptors".
legendary
Activity: 2380
Merit: 5213
November 03, 2023, 03:28:44 PM
#5
Electrum uses a fixed derivation path when generating a seed phrase and that's why you are not asked to enter the derivation path when you recover your wallet using electrum's seed phrase.

You need to know the derivation path when you have a BIP39 seed phrase. Of course, since most wallets use common derivation paths like m/84'/0'/0', m/44'/0'/0' and m/49'/0'/0', you still don't need to save or write down the derivation path.
legendary
Activity: 1526
Merit: 1359
November 03, 2023, 02:46:51 PM
#4
Restoring your Electrum wallet on a different machine is easy. Just go with the "I already have a seed" option. In the next step, you will be able to choose the seed type: Electrum, BIP39, or SLIP39. If you stick with the default, Electrum will assume you are importing an Electrum seed.  You do not need to choose the derivation path.
legendary
Activity: 3374
Merit: 3095
Playbet.io - Crypto Casino and Sportsbook
November 03, 2023, 02:02:08 PM
#3
That's not the default derivation path if you are using legacy wallet the default derivation path is m/44'/0'/0' for segwit wallet is m/84'/0'/0' and honestly you don't need to change anything on the derivation path.

If you know what type of your wallet is just choose any of these 3 legacy, p2sh segwit and native segwith or you can just " Detect existing accounts" and let the Electrum find the used derivation path for you.
hero member
Activity: 868
Merit: 952
November 03, 2023, 01:51:16 PM
#2
Let’s leave the derivation path out first, when you create a wallet with electrum, you can’t restore that seed phrase gotten from it on another wallet, because electrum seed phrase isn’t generated by BIP 39 although it follows similar procedure like the other wallets. Although you can generate the master private key from the seed phrase gotten from electrum.

To check for which derivation path you use you can use the https://iancoleman.io/bip39/ you can use the BIP that corresponds to the address type you have and then when you see address that holds the bitcoin you have then the derivation path on it is the one used to generate it.

Use this tool on offline device when importing your seed phrase
newbie
Activity: 14
Merit: 8
November 03, 2023, 01:42:44 PM
#1
Being brief:

-> Let's say that I've generated my normal account electrum wallet without paying attention on the derivation path (i dunno). If i do lost the access to this wallet, and I put the seeds on other machine to recover my wallet and the funds are 0, this might be because I haven't inserted the derivation path... so I should put m/0'/n' on it (considering it is a standard wallet) and then my problem is solved? If not, what should I do? What are the concerns about it?

Thank you Srs, best regards
Jump to: