Skip to main content
3 of 4
edited title
Ugam Kamat
  • 7.5k
  • 2
  • 15
  • 40

How to calculate the size of multisig transaction?

Can you help or suggest the formula for calculation of simple multi-sig transactions?

I have an issue to calculate the size of multi signature 2-2 transaction.

I tried to follow this: Predict multi signature transaction size answer, however it is vague and unclear. Here are my calculations:

 pubKeySize = 33;
 sigSize = 72;
 n = (m = 2);
 sizeOfRedeemScript = 1 + n * pubKeySize + 2;
 sizeOfScriptSig = 1 + m * (1 + sigSize) + 2 + sizeOfRedeemScript;
 sizeOfInput = 32 + 4 + 2 + sizeOfScriptSig + 4;
 sizeOfScriptPubKey = 2 + /** what is the length of script??  */ len(script);
 sizeOfOutput = 8 + sizeOfScriptPubKey;
 sizeOfTx = 4 + 2 + sizeOfInput + sizeOfOutput + 4;

If to be more precise I didn't get what is SizeOfVarIntFor(lengthOfScript) and what is the len(script) (how to calculate it?)