Every OP_CHECKSIG
and OP_CHECKSIGVERIFY
is counted as 1 sigop.
Every OP_CHECKMULTISIG
or OP_CHECKMULTISIGVERIFY
, is counted as 20 sigops if they’re present in an output or scriptSig and never a part of a redeemScript, i.e. not P2SH.
If OP_CHECKMULTISIG
or OP_CHECKMULTISIGVERIFY
are in a redeemScript (i.e. it is P2SH), then the variety of sigops is the variety of public keys within the multisig redeemScript. If there’s greater than 16 public keys, then it’s at all times accounted as 20.
For non-segwit inputs, these numbers are multiplied by 4, so 4 sigops for OP_CHECKSIG
and OP_CHECKSIGVERIFY
, and 80 sigops for OP_CHECKMULTISIG
and OP_CHECKMULTISIGVERIFY
.
Nevertheless segwit inputs do not use these scripts explicitly. So a segwit enter the place the witness program is model 0 and this system is 20 bytes (i.e. P2WPKH), the variety of sigops is 1. If the witness program is model 0 and this system is 32 bytes (i.e. P2WSH), the witnessScript is interpreted and its sigop rely is as above as that makes use of the opcodes explicitly.
So in your instance transaction, the enter spends a P2SH-P2WPKH and the output has an OP_CHECKSIG
. Because the enter is P2WPKH, it’s counted as 1 sigop. The output as an OP_CHECKSIG
, in order that’s one other 1 sigop. Nevertheless as a result of that output shouldn’t be a segwit output, its variety of sigops is multiplied by 4. Thus the output is definitely 4 sigops. Summing these is 1 + 4 = 5 sigops in your complete transaction.