8

Same question as What BIP32 derivation path does Electrum use?

but for multisig. thanks.

4 Answers 4

6

Electrum uses BIP45.

m / purpose' / cosigner_index / change / address_index

Example for non-change of the first cosigner and first address: m / 45' / 0 / 0 / 0

See: https://bitcointalk.org/index.php?topic=1634517.15 and https://github.com/bitcoin/bips/blob/master/bip-0045.mediawiki

1
  • 1
    I find the inclusion of the purpose code and cosigner index to not be present. See my answer below. Thus not BIP45. Commented Dec 20, 2018 at 22:44
5

After a lot of struggle, I found out that Electrum uses following root derivation for normal and multisig wallets. For example:

  • root/0/0 for each cosigner. Example:

    • m/44'/0'/0' ==> shared root key (x)

    • x/0/0 ==> address for first receiving multisig (derive in all cosigners shared keys. all 3 keys must be lexicographically ordered).

  • some semi-compatible form of BIP45 for hardware wallets. Didn't test it but here's the code: https://github.com/spesmilo/electrum/blob/master/lib/base_wizard.py#L220

refs:

What BIP32 derivation path does Electrum use?

https://github.com/spesmilo/electrum/issues/2266

https://bitcointalk.org/index.php?topic=1819380

2
  • I find that the purpose code is not present. See my answer. It is unclear what the m/44'/0'/0 generating the shared root key means in this answer. Starting with an xprv, a path of 0/0 generates the pubkeys used to construct the redeem scripts and the corresponding p2sh address used by Electrum for the first receiving address. Commented Dec 20, 2018 at 22:53
  • this is for hardware wallets only. for wallets that use electrum generated seeds x is just m for p2sh and m/1' for p2wsh
    – Abdussamad
    Commented Nov 24, 2020 at 3:04
3

Here's a descriptor for a 2-of-3 created by Electrum.

Receive addresses:

sh(sortedmulti(2,XPUB_1/0/*,XPUB_2/0/*,XPUB_3/0/*))

Change addresses:

sh(sortedmulti(2,XPUB_1/1/*,XPUB_2/1/*,XPUB_3/1/*))

(Replace XPUB_1, XPUB_2, and XPUB_3 with your three master public keys )

0

Here is what works for me when using bip32gen from bip32utils to generate the public keys which are used in the transaction, starting from an xprv master key.

For each xprv master key of a cosigner, use 0/0 for the first receiving address, 0/1 for the second, 1/0 for the first change address, 1/1 for the second change address.

Then use the corresponding public key for each cosigner, sorted into lexicographic order, when constructing the redeem script, and generate the corresponding p2sh address for each address which will be generated by Electrum.

So far as I can tell, there are no purpose codes or cosigner index, as per BIP44 or BIP45. This is with Electrum 3.2.3.

refs: https://bitcointalk.org/index.php?topic=1819380 https://bitcointalk.org/index.php?topic=1816926.msg18101203#msg18101203

See this other stackexchange discussion: What BIP32 derivation path does Electrum use?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.