<p><code>OP_EQUALVERIFY</code> has two possible outcomes:</p>
<ul>
<li>In case the last two items on the stack are different, it aborts script execution.</li>
<li>In case the last two items on the stack are equal, both are removed. Nothing is put back on the stack.</li>
</ul>
<p>For a script execution to be treated as successful, it must end with a non-empty stack whose top element is not 0. In your case, the stack is empty after execution, and thus the script execution is treated as failed.</p>
<p>You probably want to use <code>OP_EQUAL</code> instead, which puts 0 or 1 on the stack (rather than aborting or doing nothing).</p>

CC BY-SA 4.0
2022-03-24T14:37:05.083Z
2022-03-24T14:37:05.083Z
Pieter Wuille
<p>Andreas Antonopoulos discusses the VERIFY suffix <a href="https://btctranscripts.com/sf-bitcoin-meetup/2017-04-03-andreas-antonopoulos-bitcoin-scripting/#the-verify-suffix" rel="nofollow noreferrer">here</a>.</p>
<blockquote>
<p>Anything that has VERIFY will only continue execution of the Script if the outcome of the conditional operator is TRUE in which case it will not push that TRUE back to the stack, it will simply continue execution.</p>
</blockquote>
<p>This StackExchange <a href="https://bitcoin.stackexchange.com/questions/100413/for-a-redeem-script-to-satisfy-the-conditions-of-a-script-what-must-it-leave-on">post</a> may also be of interest.</p>
<p>The code for OP_EQUALVERIFY in the Bitcoin Core codebase is <a href="https://github.com/bitcoin/bitcoin/blob/master/src/script/interpreter.cpp#L912" rel="nofollow noreferrer">here</a>.</p>

CC BY-SA 4.0
2022-03-26T12:58:28.120Z
Thanks for the articles. It's now clear that VERIFY may end with TRUE, but never push it on the stack.
Vedant Bhandare
CC BY-SA 4.0
2022-03-24T12:41:40.610Z
2022-03-24T13:07:30.217Z
2022-03-24T13:07:30.217Z
Michael Folkson
<pre><code>scriptSig: &lt;pubKey&gt;
scriptPubKey: &lt;pubKey&gt; OP_EQUALVERIFY
</code></pre>
<p>The stack has &lt;pubKey&gt;, &lt;pubKey&gt; and then OP_EQUALVERIFY. So why, does it not return TRUE, even when the recent two elements in the stack are equal?</p>

<script><opcodes>
Why does this not return TRUE?
Vedant Bhandare
# Why does this not return TRUE?

(Asked by: username_0 on 2022-03-24)

```
scriptSig: <pubKey>
scriptPubKey: <pubKey> OP_EQUALVERIFY

```

The stack has <pubKey>, <pubKey> and then OP\_EQUALVERIFY. So why, does it not return TRUE, even when the recent two elements in the stack are equal?

**Tags:** script, opcodes


---

## 2 answers

### Answer by username_1 on 2022-03-24. Score: 2

`OP_EQUALVERIFY` has two possible outcomes:

* In case the last two items on the stack are different, it aborts script execution.
* In case the last two items on the stack are equal, both are removed. Nothing is put back on the stack.

For a script execution to be treated as successful, it must end with a non-empty stack whose top element is not 0. In your case, the stack is empty after execution, and thus the script execution is treated as failed.

You probably want to use `OP_EQUAL` instead, which puts 0 or 1 on the stack (rather than aborting or doing nothing).


---

### Answer by username_2 on 2022-03-24. Score: 0

Andreas Antonopoulos discusses the VERIFY suffix [here](https://btctranscripts.com/sf-bitcoin-meetup/2017-04-03-andreas-antonopoulos-bitcoin-scripting/#the-verify-suffix).

> Anything that has VERIFY will only continue execution of the Script if the outcome of the conditional operator is TRUE in which case it will not push that TRUE back to the stack, it will simply continue execution.

This StackExchange [post](https://bitcoin.stackexchange.com/questions/100413/for-a-redeem-script-to-satisfy-the-conditions-of-a-script-what-must-it-leave-on) may also be of interest.

The code for OP\_EQUALVERIFY in the Bitcoin Core codebase is [here](https://github.com/bitcoin/bitcoin/blob/master/src/script/interpreter.cpp#L912).

> **Comments:**
> **username_0**: Thanks for the articles. It's now clear that VERIFY may end with TRUE, but never push it on the stack.  

---

