TeachMeBitcoin

OP_EQUALVERIFY - Equality with Termination

From TeachMeBitcoin, the free encyclopedia Reading time: 1 min

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 | |

☕ Help support TeachMeBitcoin

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:

Ethereum: 0x578417C51783663D8A6A811B3544E1f779D39A85
Bitcoin: bc1q77k9e95rn669kpzyjr8ke9w95zhk7pa5s63qzz
Solana: 4ycT2ayqeMucixj3wS8Ay8Tq9NRDYRPKYbj3UGESyQ4J
Address copied to clipboard!