OP_EQUALVERIFY - Equality with Termination
2. OP_EQUALVERIFY — Equality with Termination
Overview
OP_EQUALVERIFY is the asserting variant of OP_EQUAL. While OP_EQUAL compares two items and leaves a boolean on the stack for further processing, OP_EQUALVERIFY performs the same comparison but immediately terminates script execution with failure if the items are not equal. If they are equal, it leaves nothing on the stack and execution continues normally.
Opcode value: 0x88
Hex: 88
It is semantically equivalent to:
OP_EQUAL OP_VERIFY
But it is a single, more efficient opcode that achieves the same result.
Behavior Breakdown
Stack before: [ <item_A> <item_B> ]
↑ top
OP_EQUALVERIFY:
- Pops item_B (top)
- Pops item_A
- Compares byte-by-byte
- If EQUAL: does nothing (stack unchanged minus the two popped items), continues execution
- If NOT EQUAL: terminates script immediately → transaction INVALID
Stack after (if equal): [ ] (two items removed, nothing pushed)
Stack after (if not equal): Script terminates with failure
The Critical Difference from OP_EQUAL
The key distinction:
| Opcode | If Equal | If Not Equal | |
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: