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 !

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;
}
  • 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 Jan 10 at 19:21
  • Sounds right to me. Also, there is segregated witness data which doesn't look like it counts towards the scriptSig limit. – JBaczuk Jan 10 at 19:27
  • 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 520 – arubi Jan 10 at 19:36

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.