2

I'm trying to write a BIP11-compliant C# client that creates a 2 of 2 or 2 of 3 transaction.

I'm also trying to understand if a 3 of 3 transaction is supported as well.

This example says they are creating a PS2H address, but I'm unsure of exactly what script is being signed, and the meaning of the parameters "2" in addmultisigaddress, and what happens when addmultisigaddress is called.

I have researched the BIP, the RPC documentation, and the forums. I'm getting confused where if and when the P2SH is needed.

Nick ODell
  • 29,396
  • 11
  • 72
  • 130
makerofthings7
  • 12,726
  • 11
  • 62
  • 130

1 Answers1

2

I think the reason you might be getting confused is that there are really two types of multisig, raw multisig and P2SH (pay-to-script-hash) multisig. P2SH multisig is basically just hashing the actual scriptPubKey desired and putting the scriptPubKey in the scriptSig. This stack exchange questions explains them in more detail: What are the limits of m and n in m-of-n multisig addresses?.

I'm also trying to understand if a 3 of 3 transaction is supported as well.

Yes, you can do m-of-3 multisig transactions with both raw multisig and P2SH multisig.

the meaning of the parameters "2" in addmultisigaddress

The number provided is the m in the m-of-n. So if you want a 1-of-2, you do:

addmultisigaddress 1 '["1xy..", "1Jm..."]' 

The BIP11 (accepted) proposal you mentioned just made raw multisig a standard type of transaction that is recognized and forwarded on by standard clients. BIP16 (https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki) proposes the P2SH addresses, which allow for much shorter scriptPubKeys and support more types of multisig (e.g. 5-of-9, which you can't easily do with raw multisig because m-of-n multisigs with n > 3 are considered non-standard, as shown in the link in the first paragraph).

morsecoder
  • 14,168
  • 2
  • 42
  • 94
  • You have m and n mixed up. BIP11 uses m-of-n, where m is the minimum number of signatures and n is the number of keys. (Or at least that's how I remember it.) – David A. Harding Dec 15 '14 at 11:09
  • @DavidA.Harding, I update the post to use the standard notation. – morsecoder Dec 15 '14 at 14:24
  • @NickODell, which part do you think needs a clarification? I linked to this, which explains the size limits. – morsecoder Jan 14 '15 at 15:57
  • 1
    @StephenM347 (e.g. 5-of-9, which you can't do with raw multisig because it would make the scriptPubKey too large). I think that everything up to and including 20-of-20 multisig is valid. For example: https://blockchain.info/tx-index/49797406/0 – Nick ODell Jan 14 '15 at 16:06
  • @NickODell Gotcha, I'll clarify that it's an issue of standardness rather than validity. – morsecoder Jan 14 '15 at 16:16