|
October 29, 2012, 08:54:26 AM |
|
This isn't multi-sig specific. Have you read Satoshis paper? It might make things clearer.
It's (b) that poses the problem. Here's a quick overview of how the protocol works.
A transaction is a message that lists inputs and outputs. Each input is defined as a script called the scriptSig because it usually contains signatures, plus a sequence number, plus an "out point". An out point is a hash of a previous transaction plus an index, which is the index of the output on the referenced transaction. Each transaction output contains a script called the scriptPubKey, plus a value.
An address is just a convenience method for writing the contents of a scriptPubKey. When I say "send 10 coins to 17bo9Twd4hnf79bivt5HrbedmQNSgEL5CB" what I actually mean is "please put an output with value 10 and a script of OP_DUP OP_HASH160 17bo9Twd4hnf79bivt5HrbedmQNSgEL5CB OP_EQUALVERIFY OP_CHECKSIG into the block chain".
Other types of addresses can mean different output scripts (eg, multisig addresses). NB: above I wrote the script as containing the address in base58 form for conveniences sake. In reality scripts look a bit different, check blockchain.info to see how.
The inputs contain signatures. A signature consists of 3 things: a SIGHASH flag, and the r/s components of the ECDSA signature. Normally we say the r/s components are "the signature" and the SIGHASH thing is just a bit of extra data appended to the end, but from Bitcoins perspective all three are combined together. The SIGHASH flag states how the signature should be interpreted.
A signature is created over some data, so the question is, what data? It cannot be the raw transaction as you see it in the block chain because it would make it impossible to construct transactions - the act of inserting the signature calculated for the second input would invalidate the first.
Therefore signatures are calculated over modified forms of the transaction. The SIGHASH flag defines how the transaction is modified. The default is SIGHASH_ALL which means "sign everything except the input scripts". So the input scripts are deleted, then the transaction is signed. Now this obviously means you can sign each input independently without breaking the others. There are other SIGHASH flags but none of them allow you to avoid signing the outpoint. So you can't construct a "free floating" transaction and sign it, because when you modify the transaction in order to connect it to some output the signature breaks.
Is that any clearer?
|