spesmilo / electrum

Electrum Bitcoin Wallet
https://electrum.org
MIT License
7.37k stars 3.07k forks source link

Multisig wallet can't sign unsigned txn created with imported address #3918

Closed elonmuskismyhero closed 6 years ago

elonmuskismyhero commented 6 years ago

I am testing multisig recently. I created a 2/5 multisig wallet with 5 owners and got an address from it. Then I created a watch-only wallet with that address. I created a transaction with that watch-only wallet and saved it in a file. While I opened the file with a walllet which has a single user's private key and tried to sign the transaction,the sign button was grey. I think it shouldn't be like this. If we lose one of the 5 keys,we may be not able to recover the multisig wallet. But the other four key-owners should still be able to control the coins. In this case, we should let the users create a wallet from the known address and let the other four to sign the transaction.

dabura667 commented 6 years ago

That's not how Bitcoin works.

In bitcoin, you need all five public keys in order to spend.

An Address does not contain any public keys.

elonmuskismyhero commented 6 years ago

I think a 2/5 multisig address needs two owners' approval to legalize the transaction. That's what the multisig was designed for. Of course a watch-only wallet does not contain any public keys. But it should let the other four owners to sign the transaction and control the coins without the fifth's approval.

SomberNight commented 6 years ago

For an M of N multisig, you need M private keys and N public keys. Of course the public keys can be derived from the private keys, so technically you only need N-M public keys. You must not lose any of the public keys.

Even when you set up the wallet, you had to put in the (master) public keys of the other cosigners, remember? :)

To create a watch-only wallet, you can just create it from the five master public keys (and from the metadata of it being 2-of-5).

Indeed it would be nice if you could create an unsigned transaction just from the address (using an Imported Wallet), and then sign it, but this is currently not implemented. This would need at least https://github.com/spesmilo/electrum/issues/2897 and https://github.com/spesmilo/electrum/issues/3738 solved first.

elonmuskismyhero commented 6 years ago

Oh. I may get what you mean. But I think it's not a good design. Imagine five people keep their seed in vault and years later one of them die and tell nothing to others, the coins are lost for ever. This is obviously not what they want to happen before.

SomberNight commented 6 years ago

You are confused. p2sh addresses depend on the redeemscript which in turn depends on the public keys. For any address to have received coins someone at some point had all the public keys to be able to calculate the address itself at all.

elonmuskismyhero commented 6 years ago

Yes. But if the address is never been used after receving coins and people don't know the importance of the public keys. It's still possible to lose the coins. 'cause people can't get the public key from the address.

SomberNight commented 6 years ago

People should realise that public keys are needed as otherwise why would the software ask for them during wallet creation? We can't change this. This is on the bitcoin consensus layer.