I got a question about the prior summary
here and while it was valid at the time the standard limits have been raised as of v0.9.3. The limit for ScriptSig size of standard transactions is now 1650 bytes not 500 bytes. This simplifies the maximum number of keys in a standard transaction. There is no change to the limit on valid transactions as that would require a hard fork.
Standard - relayed and included in blocks by most nodes
Native MultSig = max 3-of-3 ( "
if (n < 1 || n > 3)" )
P2SH w/ all compressed keys = max of 15-of-15 ( "
if(txin.scriptSig.size() > 1650)" )
P2SH w/ all uncompressed keys = max of 7-of-7 ( "
if(txin.scriptSig.size() > 1650)" )
Non-standard but Valid - not relayed by most nodes but could be pushed directly to a miner who accepts non-standard txns
Native MultiSig = max of 20-of-20
There are no longer any non-standard but P2SH multisig scripts that are a single OP_CHECKMULTISIG (M N OP_CHECKMULTISIG).
Arbitrary scripts should be checked individually and do not fit into this guideline.
Invalid - not valid under any conditions, if included in a block the block is also invalid
Native MultiSig = more than 20-of-20 ( "
if (nKeysCount < 0 || nKeysCount > 20)" )
P2SH w/ all compressed keys = more than 15-of-15 ( "
520 byte limit" )*
P2SH w/ all uncompressed keys = more than 7-of-7 ( "
520 byte limit" )*
* The actual limit is that pushdata can not exceed 520 bytes. Public keys (including push opcode) are 34 bytes or 68 bytes for compressed and uncompressed keys respectively. There is a 3 byte overhead so the size of all the keys must be less than 517 bytes. FLOOR(517/34) = 15. FLOOR(517/68) = 7. If the redeemScript contains a mix of compressed and uncompressed keys the upper limit will vary in the range of 7 to 15 keys per script.
DISCLAIMER: Funds sent to a ScriptHash produced from a RedeemScript larger than 520 bytes are unspendable. Raising this restriction would require a hardfork which may never happen so funds are effectively lost. Always verify your redeemScript length to prevent a loss of funds and always test new scripts on testnet before deploying to mainnet.