Bitcoin Forum

Bitcoin => Electrum => Topic started by: CompNsci on January 11, 2019, 12:25:13 AM

Title: CORRECTED: Addresses with 2 of 3 multisig wallet
Post by: CompNsci on January 11, 2019, 12:25:13 AM
UPDATE -- please see my last post in this thread. This was caused by some confusion on my part about keys.

When creating a multi signature 2 of 3 wallet using a combination of xprv and xpub keys, it appears that the addresses created by Electrum (v 3.2.3) depend on the particular combination of keys used. For example, say there are 3 keys, A, B, and C.

Wallet 1: One creates a view only 2 of 3 multisig wallet using the 3 xpub keys, xpub A, xpub B, xpub C.

Wallet 2: create a new wallet using 2 of the 3 private keys. If one uses xprv A, xprv B and xpub C, the same addresses are produced as Wallet 1.

Wallet 3: create a new wallet using a different set of 2 of the 3 private keys, say xpub A, xprv B, and xprv C. This wallet now has a different set of addresses.

This does not seem correct. Any ideas on the problem or what algorithm Electrum is using?

Title: Re: Addresses with 2 of 3 multisig wallet
Post by: pooya87 on January 11, 2019, 05:00:11 AM
i can not reproduce this. here is the test case using your wallet 1 and 2 with the following key pairs (created at random using
xprv9s21ZrQH143K31HndpbS3apy1Fp3jnfcUbtT393ETgBrkrxi2QqWitpk65NsNwWpwz9qdkxS83m MLCsARavSLCTGZCnYngAUMm4Q6LWgM2L
xpub661MyMwAqRbcFVNFjr8SQimhZHeY9FPTqpp3qXSr21iqdfHrZx9mGh9DwLekCFq1JpLob72bkGb cuSh6BJwDbryCCjdFx4dNi5RCJHbqB11

xprv9s21ZrQH143K3eJwJrHUbU9G9wSDyVYoMXzoLQ7sR7WhVcAhjfkqJHeW6nxQbEMiUnudE6gcXVV xGwtrbiW31UsSFujMmvPWux3FPtxsk4M
xpub661MyMwAqRbcG8PQQspUxc5zhyGiNxGeikvQ8nXUyT3gNQVrHD55r5xyx67NjEy3rVDcTek1KDU Pt5BSfinzR6Tm939sSwRd7P7XcsyeX3w

xprv9s21ZrQH143K2mkrySSvs7YijnkVLWNXJ576Q7vCJ2WZeCPWP9kU2t89KtzDkpqQC635pgwfMCu VgzNKob46ANsandU3V5EZ9o2CsSA4q6j
xpub661MyMwAqRbcFFqL5TywEFVTHpayjy6NfJ2hCWKorN3YWzievh4iagSdB979tdoQg8F4TxN2kLe AannNkyatxyeMZaUCCNfYG6bMYUeoajn

with xpub A, xpub B, xpub C i get 3CRNzS8CEwfbEkPM7Q1S6Ss9TcbKtcLu6N
with xpub A, xprv B, xprv C i get 3CRNzS8CEwfbEkPM7Q1S6Ss9TcbKtcLu6N

i thought the order may make a difference (which i believe it should!!!) but it doesn't. using xprv B, then xpub A, then xpub C gives me the same address!

if you are doing something else then do it on these keys (since you may not want to reveal your own keys) and tell us the exact steps you took.

Title: Re: Addresses with 2 of 3 multisig wallet
Post by: Abdussamad on January 11, 2019, 08:33:31 AM
You need to go back and confirm that you have the right xprvs and xpubs. Most likely you are using xprvs for a different set of seeds. Otherwise this cannot happen because electrum orders public keys lexicographically in the multisig script so the same addresses are always generated.

Title: Re: Addresses with 2 of 3 multisig wallet
Post by: CompNsci on January 11, 2019, 09:59:40 PM
Thanks all for the checking on this. You are both correct, when I rerun this with a test set of keys the order does not matter. I think I must have been somehow confused about which keys I was using and was mixing up different sets.

Neither the order of the keys, nor the particular combination matters, as long as one has a public or private version of all 3 of the required keys.