Pattern: 2-of-3 multisig PLUS a timelock condition
19. OP_CHECKMULTISIGVERIFY — Multisig with Termination
Overview
OP_CHECKMULTISIGVERIFY is the verifying variant of OP_CHECKMULTISIG. It performs the same M-of-N signature verification but immediately terminates script execution on failure rather than pushing a result to the stack.
Opcode value: 0xaf (decimal 175)
Equivalent to: OP_CHECKMULTISIG OP_VERIFY
Stack behavior: Consumes all multisig inputs, halts on failure, leaves nothing on success
Comparison with OP_CHECKMULTISIG
OP_CHECKMULTISIG:
Input: [dummy] [sigs...] [M] [pubkeys...] [N]
Output: [0x01] or [0x00]
→ Result left on stack for further processing
OP_CHECKMULTISIGVERIFY:
Input: [dummy] [sigs...] [M] [pubkeys...] [N]
Output: (nothing)
→ Script aborts if invalid; continues silently if valid
When to Use CHECKMULTISIGVERIFY
Use OP_CHECKMULTISIGVERIFY when multisig authorization is a prerequisite, and other script logic follows:
# Pattern: 2-of-3 multisig PLUS a timelock condition
scriptPubKey:
OP_0 <sig1> <sig2> ← in scriptSig
OP_2 <pk1> <pk2> <pk3> OP_3
OP_CHECKMULTISIGVERIFY ← verify multisig; fail immediately if invalid
<locktime>
OP_CHECKLOCKTIMEVERIFY ← then check timelock
OP_DROP
OP_1 ← success
If OP_CHECKMULTISIG were used instead:
...
OP_CHECKMULTISIG ← pushes 0x01 or 0x00
OP_VERIFY ← manually verify the result
<locktime>
OP_CHECKLOCKTIMEVERIFY
...
Both are functionally identical, but OP_CHECKMULTISIGVERIFY is more concise.
Off-By-One Bug Applies Here Too
The dummy OP_0 element is still required for OP_CHECKMULTISIGVERIFY, as it uses the same underlying code path:
# Still need the dummy element:
scriptSig: OP_0 <sig1> <sig2>
scriptPubKey: OP_2 <pk1> <pk2> <pk3> OP_3 OP_CHECKMULTISIGVERIFY <more_conditions>
Tapscript Alternative
In Tapscript, OP_CHECKMULTISIGVERIFY is disabled. The replacement pattern using OP_CHECKSIGADD naturally supports the "verify and continue" pattern:
# Tapscript 2-of-3 with immediate failure on invalid:
<pk1> OP_CHECKSIG # push 1 if valid, 0 if not
<pk2> OP_CHECKSIGADD # add 1 if valid
<pk3> OP_CHECKSIGADD # add 1 if valid
OP_2 OP_GREATERTHANOREQUAL # check if count >= 2
TeachMeBitcoin is an ad-free, open-source educational repository curated by a passionate team of Bitcoin researchers and educators for public benefit. If you found our articles helpful, please consider supporting our hosting and ongoing content updates with a clean donation: