<p>A script execution is successful if it ends with a non-empty stack whose top element is not 0. Therefore, a script consisting of only <code>OP_3</code> will be successful.</p>
<p>You may also be interested in the topic <a href="https://bitcoin.stackexchange.com/q/100413/5406"><em>“For a redeem script to satisfy the conditions of a script what must it leave on the stack post execution?”</em></a> which describes the criteria for successful scripts in more detail (H/T Michael Folkson). I would recommend <a href="https://bitcoin.stackexchange.com/q/17553/5406">using testnet or signet</a> for experimental transactions.</p>

CC BY-SA 4.0
2023-02-08T23:36:15.573Z
Yes this is very helpful, thanks. However a P2SH redeem script of say, 3 OP_3s (535353) fails with error "Stack size must be exactly one after execution" because it is valid, but non-standard, and hence would have to be submitted to miner directly. Is that correct?
Peter
CC BY-SA 4.0
2023-02-09T02:03:35.950Z
Yes, stacks with more than one remaining element are non-standard for P2SH, and consensus invalid for segwit outputs.
Murch
CC BY-SA 4.0
2023-02-08T03:51:08.417Z
2023-02-08T15:43:34.833Z
2023-02-08T15:43:34.833Z
Murch
<p>I completed a round trip transaction with the redeem script hash: <code>31vFvEkyAb2iusbPip36H9rVt6pxExuaVR</code>, whose redeem script is <code>OP_3 (0x53)</code> (yes I know not secure).</p>
<p>I can understand <code>OP_1</code> redeem script unlocking its P2SH UTXO as 1 is left on the stack after redeem script execution, but with <code>OP_3</code>, 3 is left on the stack. So how does this successfully execute?</p>
<p>Tx: <code>36ca5aede94112009621bda42b3e84f49f7aa45886837d1d51c6590a04fcb8e7</code></p>

CC BY-SA 4.0
2023-02-08T08:25:26.470Z
Related question: https://bitcoin.stackexchange.com/questions/100413/for-a-redeem-script-to-satisfy-the-conditions-of-a-script-what-must-it-leave-on
Michael Folkson
<script><transaction-verification><p2sh><output><opcodes>
How come an `OP_3` P2SH redeem script is spendable?
Peter
# How come an `OP_3` P2SH redeem script is spendable?

(Asked by: username_0 on 2023-02-08)

I completed a round trip transaction with the redeem script hash: `31vFvEkyAb2iusbPip36H9rVt6pxExuaVR`, whose redeem script is `OP_3 (0x53)` (yes I know not secure).

I can understand `OP_1` redeem script unlocking its P2SH UTXO as 1 is left on the stack after redeem script execution, but with `OP_3`, 3 is left on the stack. So how does this successfully execute?

Tx: `36ca5aede94112009621bda42b3e84f49f7aa45886837d1d51c6590a04fcb8e7`

**Tags:** script, transaction-verification, p2sh, output, opcodes

> **Comments:**
> **username_1**: Related question: https://bitcoin.stackexchange.com/questions/100413/for-a-redeem-script-to-satisfy-the-conditions-of-a-script-what-must-it-leave-on  

---

## 1 answers

### Answer by username_2 on 2023-02-08. Score: 4 | Accepted answer

A script execution is successful if it ends with a non-empty stack whose top element is not 0. Therefore, a script consisting of only `OP_3` will be successful.

You may also be interested in the topic [*“For a redeem script to satisfy the conditions of a script what must it leave on the stack post execution?”*](https://bitcoin.stackexchange.com/q/100413/5406) which describes the criteria for successful scripts in more detail (H/T username_1 username_1). I would recommend [using testnet or signet](https://bitcoin.stackexchange.com/q/17553/5406) for experimental transactions.

> **Comments:**
> **username_0**: Yes this is very helpful, thanks. However a P2SH redeem script of say, 3 OP_3s (535353) fails with error "Stack size must be exactly one after execution" because it is valid, but non-standard, and hence would have to be submitted to miner directly. Is that correct?  
> **username_2**: Yes, stacks with more than one remaining element are non-standard for P2SH, and consensus invalid for segwit outputs.  

---

