user126820: The locking script I have is
OP_PUSH1(0x03) OP_ADD OP_PUSH1(0x05) OP_NUMEQUALVERIFY
I don't understand how the OP_PUSH works - where does it push from and does it push it onto the top of the stack? I thought script operations read from the top of the stack so I'd read the top item and push it back onto the stack which does nothing?
What would I have to put as an unlocking script on the left to get OP_NUMEQUALVERIFY to return valid here?

user120938: 
For pushing numbers between 1-16, you should be using OP_1-OP_16.

For pushing numbers larger than 16, you should be using OP_PUSH(OP_N/A).


E.g:
<5> push compiles to OP_5: 0x55
<17> push compiles to OP_PUSH1(0x11): 0x0111
<666> push compiles to OP_PUSH2(0x9a02): 0x029a02

OP_ADD pops two inputs and adds them together. So your ordering is wrong because OP_ADD must come after 3 and 5.

Stack must end with “1” so you should be using OP_NUMEQUAL instead of OP_NUMEQUALVERIFY, which leaves the stack with 1 instead of empty.


Your final script should be:
OP_3 OP_5 OP_ADD OP_EQUAL

And your unlocking script should be: OP_8
You can test it online at: https://ide.scriptwiz.app/

126820: <p>The locking script I have is</p>
<p>OP_PUSH1(0x03) OP_ADD OP_PUSH1(0x05) OP_NUMEQUALVERIFY</p>
<p>I don't understand how the OP_PUSH works - where does it push from and does it push it onto the top of the stack? I thought script operations read from the top of the stack so I'd read the top item and push it back onto the stack which does nothing?</p>
<p>What would I have to put as an unlocking script on the left to get OP_NUMEQUALVERIFY to return valid here?</p>
 120938: <ol>
<li><p>For pushing numbers between 1-16, you should be using OP_1-OP_16.</p>
</li>
<li><p>For pushing numbers larger than 16, you should be using OP_PUSH(OP_N/A).</p>
</li>
</ol>
<p>E.g:</p>
<p>&lt;5&gt; push compiles to OP_5: 0x55</p>
<p>&lt;17&gt; push compiles to OP_PUSH1(0x11): 0x0111</p>
<p>&lt;666&gt; push compiles to OP_PUSH2(0x9a02): 0x029a02</p>
<ol start="3">
<li><p>OP_ADD pops two inputs and adds them together. So your ordering is wrong because OP_ADD must come after 3 and 5.</p>
</li>
<li><p>Stack must end with “1” so you should be using OP_NUMEQUAL instead of OP_NUMEQUALVERIFY, which leaves the stack with 1 instead of empty.</p>
</li>
</ol>
<p>Your final script should be:</p>
<pre><code>OP_3 OP_5 OP_ADD OP_EQUAL
</code></pre>
<p>And your unlocking script should be: <code>OP_8</code></p>
<p>You can test it online at: <a href="https://ide.scriptwiz.app/" rel="nofollow noreferrer">https://ide.scriptwiz.app/</a></p>
