Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: pomme7000 on September 10, 2024, 03:06:19 PM



Title: How does Multi Sig work?
Post by: pomme7000 on September 10, 2024, 03:06:19 PM
Newbie learning about multi sig. I watched a number of videos on how to set up multi sig using Electrum and various hardware wallets. I understand the mechanical steps one would go thru to set up multi sig. But something fundamental is not clear to me.

Let's say I set up a "2 of 4" scenario, where two of four individuals (via their hardware wallets) must sign a bitcoin transaction. Where is this "you must have two of these four" rule stored? Is it somewhere on the bitcoin blockchain?

Said differently, if I authorize a spend transaction using my hardware wallet (I am one of the four), how does the exchange (Coinbase, or any other non-Electrum) know that a second signature is required?

Thanks.


Title: Re: How does Multi Sig work?
Post by: Charles-Tim on September 10, 2024, 03:11:32 PM
The exchange or the receiver does not need to know if a second signer is needed because the transaction will not be broadcasted at all. Only when the transaction would be broadcasted to the mempool is when the second signer sign the transaction.


Title: Re: How does Multi Sig work?
Post by: tranthidung on September 10, 2024, 03:22:41 PM
What are multisig wallets and How do they work? (https://www.coindesk.com/learn/what-are-multisig-wallets-and-how-do-they-work/)

Multisig wallet means multi signature wallet.

It means whe  you set up that wallet, you decide that how many co-signers are needed for that multisig wallet as well as threshold of co-signers need to sign a transaction to broadcast it to Bitcoin mempools and wait for Bitcoin miners to confirm it.

How to identify a transaction is multisig?
https://bitcoin.stackexchange.com/questions/72225/ho-to-identify-a-multisig-transaction


Title: Re: How does Multi Sig work?
Post by: pomme7000 on September 10, 2024, 03:50:09 PM
The exchange or the receiver does not need to know if a second signer is needed because the transaction will not be broadcasted at all. Only when the transaction would be broadcasted to the mempool is when the second signer sign the transaction.
Sorry, still not getting it. In the "2 of 4" scenario, let's say you signed a transaction on your wallet (eg, Ledger). The next day I sign the transaction using my wallet (eg, Trezor). Does my wallet somehow know you already have signed, and thus can broadcast the transaction? If yes, how?


Title: Re: How does Multi Sig work?
Post by: Charles-Tim on September 10, 2024, 04:15:03 PM
Sorry, still not getting it. In the "2 of 4" scenario, let's say you signed a transaction on your wallet (eg, Ledger). The next day I sign the transaction using my wallet (eg, Trezor). Does my wallet somehow know you already have signed, and thus can broadcast the transaction? If yes, how?
When you sign the transaction, the wallet will generate you the partially signed bitcoin transaction (PSBT) which you will need to send to the second signer. Only what the second signer needs is the partially signed transaction (PBST) from you and then also sign it and broadcast the transaction. This is how multisig wallet works.


Title: Re: How does Multi Sig work?
Post by: pomme7000 on September 10, 2024, 04:24:58 PM
When you sign the transaction, the wallet will generate you the partially signed bitcoin transaction (PSBT) which you will need to send to the second signer. Only what the second signer needs is the partially signed transaction (PBST) from you and then also sign it and broadcast the transaction. This is how multisig wallet works.
That helps. How do I send my partially signed transaction to the other person?

Also, if I originally had set up the wallets on Electrum, do I have to use Electrum for my future multi sig transactions? Or can I use Coinbase, Binance or any other exchange?


Title: Re: How does Multi Sig work?
Post by: Charles-Tim on September 10, 2024, 04:30:47 PM
That helps. How do I send my partially signed transaction to the other person?
It can be through QR code, file or copy and paste.

Also, if I originally had set up the wallets on Electrum, do I have to use Electrum for my future multi sig transactions? Or can I use Coinbase, Binance or any other exchange?
You can not use exchange for it. You will another noncustodial wallet that support multisig. I can recommend Electrum and Sparrow.

It is worth knowing that Electrum seed phrase is different from BIP39 seed phrase. Although, passing the master key to the cosigner should not be a problem, be it Electrum or BIP39 seed phrase.


Title: Re: How does Multi Sig work?
Post by: pomme7000 on September 10, 2024, 04:47:44 PM
Thank you all. Appreciate the education.


Title: Re: How does Multi Sig work?
Post by: franky1 on September 10, 2024, 06:38:29 PM
dumbing things down
when you pay a multisig address the payment sender to the address just sees one address to send funds to

however the multisig address owner(s) created the receiving address by hashing 4 separate addresses together with an extra hex of data to say how many of the 4 need to sign(2 in topics example)

when spending funds given to the multisig address, the signature script will then list all 4 addresses and the data that sets how many signers are needed so that the network can validate they hash to the multisig address, and then any 2 of those 4 can sign using there key so that the transaction spending from a multisig has 2 valid signatures appended to the transaction, using keys associated with listed separate addresses

if you are using a wallet that supports multisig, then that wallet will have features to copy the signature and you can paste via any communication  method you like of the other participants of the multisig. these wallets also have features to take in that signature and complete it before broadcasting the complete tx
different wallets have features in different places so read the tutorials/help sections of your preferred wallet


Title: Re: How does Multi Sig work?
Post by: famososMuertos on September 10, 2024, 08:29:29 PM
Thank you all. Appreciate the education.
+1
It's the same old story, traditional financial education is a resource that helps, since sometimes delving into the management of certain wonderful advantages such as MS without having any idea of ​​why we want to have them can result in the complete opposite. On the other hand, and keeping technological distance, it's like a joint signature in a traditional bank, there may be 10 people but only two or three signatures are needed for it to be valid.

Actually, try it out with a few satoshis and learn by testing, because asking if this works on a centralized exchange tells me that you have no idea how it works, and even less if they tell you bip39.   :)

If you still have questions, ok, ask again, I haven't seen a question like this for a while on bitcoin discussion.


Title: Re: How does Multi Sig work?
Post by: Z-tight on September 10, 2024, 08:41:44 PM
Take note that you should not use a multisig wallet if you do not know what you are doing, and obviously you do not for now, you can easily make a mistake while trying to set it up and lock yourself out of your funds for good. Extra layers of security like a passphrase and a multisig wallet is great, but only if done correctly and in a very safe enviroment.
Also, if I originally had set up the wallets on Electrum, do I have to use Electrum for my future multi sig transactions? Or can I use Coinbase, Binance or any other exchange?
You don't own the keys to your funds in an exchange, so your exchange wallet cannot be a co-signer in a multisig wallet. Setting up a multisig wallet with all co-signers on the same device also defeats the purpose of creating one, thought you should know that too.


Title: Re: How does Multi Sig work?
Post by: 348Judah on September 10, 2024, 09:37:15 PM
Newbie learning about multi sig. I watched a number of videos on how to set up multi sig using Electrum and various hardware wallets. I understand the mechanical steps one would go thru to set up multi sig. But something fundamental is not clear to me.

Let's say I set up a "2 of 4" scenario, where two of four individuals (via their hardware wallets) must sign a bitcoin transaction. Where is this "you must have two of these four" rule stored? Is it somewhere on the bitcoin blockchain?

Said differently, if I authorize a spend transaction using my hardware wallet (I am one of the four), how does the exchange (Coinbase, or any other non-Electrum) know that a second signature is required?

Thanks.

Have the idea of what a multi signature wallet is, the first thing to know is that this requires the signing in of two or more people, for instance, you may have to make use of electrum wallet in making a transaction and those involved in the signatories must also sign the transaction before it will be sent, while you have the option not to use a multisig while on electrum while setting the wallet up at first instance, lastly, the recipient of a transaction is not the one to sign the transaction, but a co-signer who is involved while setting up the wallet.


Title: Re: How does Multi Sig work?
Post by: Smartvirus on September 10, 2024, 10:43:37 PM
Said differently, if I authorize a spend transaction using my hardware wallet (I am one of the four), how does the exchange (Coinbase, or any other non-Electrum) know that a second signature is required?

Thanks.
That’s the thing, you can’t fully authorize a transaction without the other parties to the signature having to sign with their keys. Their keys authenticates your transaction else, it all stays put. Coinbase or which ever exchange you might be sending your coins to don’t need to know this, it ain’t about them. It’s just you, your wallet and the blockchain network but, every initiation and broadcasting of your transaction and broadcasting is done from your wallet. Exchangers just receive it and from there, you could sell or trade as you please.


Title: Re: How does Multi Sig work?
Post by: pomme7000 on September 11, 2024, 01:45:27 AM
Again, thank you all. I now understand that if I sign a multi sig transaction, then in a “2 of 4” situation, I also need to send a data file to the other three potential signers, which in conjunction with their hardware wallet allows any one of them to sign and broadcast the transaction. That’s the part that was eluding me. But now I understand what the data file includes and how to generate it from Electrum.


Title: Re: How does Multi Sig work?
Post by: ABCbits on September 11, 2024, 09:02:56 AM
Let's say I set up a "2 of 4" scenario, where two of four individuals (via their hardware wallets) must sign a bitcoin transaction. Where is this "you must have two of these four" rule stored? Is it somewhere on the bitcoin blockchain?

Your wallet store the rule needed to spend the Bitcoin from multi-signature address. The rule (in form of script) revealed when you spend Bitcoin from the multi-signature address, where hash of the script must match the address.

Take note it's major simplification and it works a bit differently if Taproot is involved.


Title: Re: How does Multi Sig work?
Post by: Reatim on September 12, 2024, 05:55:14 AM
Let's say I set up a "2 of 4" scenario, where two of four individuals (via their hardware wallets) must sign a bitcoin transaction. Where is this "you must have two of these four" rule stored? Is it somewhere on the bitcoin blockchain?
It’s not on the blockchain itself but rather is in the script of the bitcoin address generated. In the script would include how many of how many of you in total would be required to push through a transaction as well as public keys of each signer and other possible data needed. If you are interested in the script and coding, you can check this out as it explains it more in detail and with examples:https://github.com/BlockchainCommons/Learning-Bitcoin-from-the-Command-Line/blob/master/10_4_Scripting_a_Multisig.md

Quote
Said differently, if I authorize a spend transaction using my hardware wallet (I am one of the four), how does the exchange (Coinbase, or any other non-Electrum) know that a second signature is required?
It’s not the exchange exactly that figures this out. The blockchain would be the one to validate and check if all requests are met in order to carry out the transaction.


Title: Re: How does Multi Sig work?
Post by: Cricktor on September 14, 2024, 01:57:04 PM
~~~
I'm not so sure if you got it finally right. Let's stay with your 2-of-4 multisig wallet scenario.

To generate addresses of this wallet, ALL four extended public keys are needed. You can't afford to loose any of the four! (I think this is what many people don't get right when for signing not all signers are needed, only two in this example are sufficient). So any of the four possible signers needs the extended public keys of all other signers besides his own one to be able to setup the wallet and generate the wallet's addresses.

To sign a transaction two distinct signers of the four are sufficient. This 2-of-4 multisig setup can afford to loose two extended private keys, but, again, all four extended public keys are still required!


The blockchain would be the one to validate and check if all requests are met in order to carry out the transaction.
No, compliant nodes that follow and enforce the consensus rules are the ones that check and validate stuff and only valid transactions are written into blockchain blocks by mining nodes (today these are ususally mining pools).

The lock script of a transaction output defines what needs to be presented to fulfill it and to be able to move the coins. Checking if spending conditions are fulfilled and thus spending the UTXO is valid is duty of compliant Bitcoin nodes.