Maximum standard input script size

1

What is the maximum size for an input script so to be considered standard ? Looking at the Bitcoin Core source code it appears to be 10'000 byte, however reading here and there, it appears to be 1650 byte. If that's the case, if the input script is redeeming a P2SH, is the size of the redeem script (520 byte) to be considered in the count, or not ? Thank you very much !

Daniele

Posted 2019-01-10T18:54:06.633

Reputation: 35

Answers

1

By input script, if you mean scriptSig, the max standard scriptSig can be up to 1650 bytes.

See policy.cpp :

// Biggest 'standard' txin is a 15-of-15 P2SH multisig with compressed
// keys (remember the 520 byte limit on redeemScript size). That works
// out to a (15*(33+1))+3=513 byte redeemScript, 513+1+15*(73+1)+3=1627
// bytes of scriptSig, which we round off to 1650 bytes for some minor
// future-proofing. That's also enough to spend a 20-of-20
// CHECKMULTISIG scriptPubKey, though such a scriptPubKey is not
// considered standard.
if (txin.scriptSig.size() > 1650) {
    reason = "scriptsig-size";
    return false;
}

JBaczuk

Posted 2019-01-10T18:54:06.633

Reputation: 6 172

Thank you very much. So it appears that also the redeem script is included in the 1650 byte. So I effectively have, if the redeem script has the max size of 520 byte, just 1130 byte.Daniele 2019-01-10T19:21:17.873

Sounds right to me. Also, there is segregated witness data which doesn't look like it counts towards the scriptSig limit.JBaczuk 2019-01-10T19:27:19.717

Technically, a 520 byte size redeemScript has an overhead of 3 more bytes, the OP_PUSHDATA2 opcode that is one byte and another two bytes 0x0802 for the actual size value 520arubi 2019-01-10T19:36:39.940