# Multisig vs Multi input transaction signing

Let's say we have a 2 of 2 multisig address that we want to spend from, so the transaction should be signed by both of the private keys.

Now let's say we have a transaction with two inputs, so once again the transaction should be signed by both of the private keys of the inputs.

So how does these two differ in implementation? Even on conceptual level? Are these procedures the same?

• Are the two inputs both spending from the multisig address? Feb 3, 2015 at 21:46
• Feb 3, 2015 at 21:47

They are fairly different things and represent very different use cases.

Imagine you are the head of the party planning committee and you have two workers (A and B) to help you buy items for the party. You are given 1 bitcoin to fund the party.

You have two options.

• You can split the funds up between A and B. For example, you could give A and B each 0.5 bitcoins in two separate outputs. If they need to buy something worth more than 0.5 bitcoins, they will need to combine their outputs as inputs to the same transaction. However, for items less than 0.5 bitcoins, A and B will be able to act independently to purchase items (or steal the funds!).
• You can jointly give A and B the 1 bitcoin in a 2 of 2 multisig address. Now for any purchase they will need to agree in order to spend from the party committee's funds.

To summarize:

Spending a 2/2 multisig output:

Spends a single previously UTXO and requiring two keys to sign.

Spending multiple inputs:

Spends multiple previously UTXOs and requires each input to be signed separately.

With regards to signing these types of transactions, they have to be done slightly differently.

When signing an input that spends a 2/2 multisig output, the transaction is signed by the two keys and they are encoded into the same `scriptSig` of the one input. The transaction only becomes valid when both keys have signed with valid signatures.

For example, suppose the scriptPubKey of the previous 2/2 multisig output is:

``````OP_2 {pubkey1} {pubkey2} OP_2 OP_CHECKMULTISIG
``````

The the scriptSig to spend that output would be:

``````{pubkey1's signature} {pubkey2's signature}
``````

Notice how they are in the same input's scriptSig.

When signing two different inputs, assuming their previous scriptPubKeys look something like this:

``````{pubkey1} OP_CHECKSIG
``````

and

``````{pubkey2} OP_CHECKSIG
``````

Then the two inputs would have scripSigs in this format (respectively):

``````{pubkey1 signature}
``````

and

``````{pubkey2 signature}
``````

NOTE: I've used simple scriptPubKey's to be try to be clear about how it generally works, but you should probably use Pay-to-script-hash multisig address and pay-to-pubkey-hash addresses instead of the raw multisig and pay-to-pubkey scriptPubKeys that I used in this example.

• This actually was not the answer I'm looking for. In implementation level, how does these two differ: 1) requires two keys to sign 2)requires each input to be signed separately . What I mean is at the end there is a unsigned raw transaction that should be signed, how the signing procedure would differ between these two scenarios? Feb 3, 2015 at 22:16
• @Shayanbahal, does that clear it up? Feb 3, 2015 at 22:32
• That was really good, thanks. Only regarding the last part (NOTE) I'm not quite clear on what you meant by " you should probably use Pay-to-script-hash multisig address and pay-to-pubkey-hash addresses instead of the raw multisig and pay-to-pubkey scriptPubKeys that I used in this example." Feb 4, 2015 at 0:58
• @Shayanbahal, the answer to what all of those things are is probably outside the scope of this question. This answer should help explain the difference between raw multisig and P2SH multisig. The bitcoin developer documentation is also helpful. And make sure you mark the answers to your questions with the green check mark. :) Feb 4, 2015 at 4:28

Transaction from a `Multisig Bitcoin address` (starting with 3) requires signature from N of M

• M represents number of parties allowed to unlock UTXO (input of transaction). In case of 2-2, both signature from both parties have to be involved to create valid transaction
• N is number of owners (known as `threshold`) whose digital signature is required to sign a valid transaction

However, `Multi input transaction` is a type of transaction where input involves UTXO from 1 or more either standard or multisig bitcoin addresses.

Following states may occur

1. Standard Bitcoin address signs transaction with 1 input

• requires one digital signature with valid private key
2. Standard Bitcoin address signs transaction with more than 1 input (multi-input transaction)

• requires digital signature for each UTXO with valid private key
3. Multisig Bitcoin address signs transaction with 1 input

• requires one digital signature from threshold
4. Multisig Bitcoin address signs transaction with more than 1 input (multi-input transaction)

• requires digital signature for each UTXO by threshold

Up to this point, `ALL UTXO` belong to signer of transaction. Now transactions will contain UTXO for more than 1 Bitcoin address.

1. Two Standard Bitcoin addreses sign a transaction with 1 UTXO for each of them (multi-input transaction)

• requires digital signature for each UTXO by corresponding valid private key

Ex. Transaction involves 2 UTXO for 2 separate Standard Bitcoin addresses, to create valid transaction, address A have to sign UTXO(A) and address B sign UTXO(B). Transaction can now have 1 output making the cost of fees much lower than in scenario, where for each Bitcoin address is created separate transaction.

1. Two Multisig Bitcoin addreses sign a transaction with 1 UTXO for each of them (multi-input transaction)

• requires digital signature for each UTXO by corresponding valid private key of threshold

Ex. Transaction involves 2 UTXO for 2 separate Multisig Bitcoin addresses, to create valid transaction, threshold of address A have to sign UTXO(A) and threshold of address B sign UTXO(B).

1. Option 5 and 6 combined.

Ex. Transaction is composed from UTXO for 1 or more Standard Bitcoin address and 1 or more Multisig Bitcoin address.