Same question as What BIP32 derivation path does Electrum use?
but for multisig. thanks.
Bitcoin Stack Exchange is a question and answer site for Bitcoin users, developers, and enthusiasts. It only takes a minute to sign up.Sign up to join this community
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
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
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.
See this other stackexchange discussion: What BIP32 derivation path does Electrum use?