user139960: I am trying to spend a P2SH UTXO based on a redeem script that requires no signatures and simply needs the correct input to equal the OP_HASH160 digest in the corresponding P2SH locking script.
My unlocking script pushes 17 bytes onto the stack (0x11) which are the following 17 bytes that constitute the "secret" number to get the correct hash.
The decoded raw tx is the following (with the 17 byte secret number removed):
"txid": "0ba564fc00cbeada33ccded7f4e45f17bfff69c8f8a38132dc715de0d905b857",
"hash": "0ba564fc00cbeada33ccded7f4e45f17bfff69c8f8a38132dc715de0d905b857",
"version": 1,
"size": 113,
"vsize": 113,
"weight": 452,
"locktime": 0,
"vin": [
  {
    "txid": "f8e5dfe32a57872d58cee6f3eb32ec0277f3563306ae623109ea651fd9dc8087",
    "vout": 1,
    "scriptSig": {
      "asm": "<17 byte redeem script>",
      "hex": "11<17 byte redeem script>"
    },
    "sequence": 4294967295
  }
],
"vout": [
  {
    "value": 0.00002000,
    "n": 0,
    "scriptPubKey": {
      "asm": "02de153317307164e7c9918791c7787d9833a3a8201bdff880e631e490cf9a087c      OP_CHECKSIG",
      "desc": "pk(02de153317307164e7c9918791c7787d9833a3a8201bdff880e631e490cf9a087c)#epafp6sh",
      "hex": "2102de153317307164e7c9918791c7787d9833a3a8201bdff880e631e490cf9a087cac",
      "type": "pubkey"
    }
  }
]
}

I can't see any mistakes however "sendrawtransaction" gives me the error: error code: -26 error message: mandatory-script-verify-flag-failed (Opcode missing or not understood)
I had thought maybe this was a non-standard tx and therefore wouldn't be valid unless submitted directly to miner*, however it was my understanding that P2SH allowed the freedom to submit arbitrary redeem scripts, provided the unlocking script is valid and the redeem script equals the redeem script hash in the locking script.
*bitcoin-cli decodescript  for my unlocking script hex does give me Type:nonstandard

user109558: A p2sh unlocking script first pushes the actual script, then any stack element needed to fulfill this script. The interpreter will pop one element from the stack and verify if it's hash160 is equal to the one committed in the spk. If yes, then the interpreter destroys the runtime, and build a new one, but using the popped element as script instead.
In your case, bitcoind is interpreting your secret as a script, and it isn't a valid script. Hence, yielding an error about opcodes. The correct way of doing this with p2sh is by taking the hash160 of the hex-encoded script:
OP_HASH160 OP_PUSH20 <your_hash> OP_EQUALVERIFY

Your program hash is the resulting digest.
When spending, you first push this script, and your secret as a second stack element. Your initial stack looks like this:
<script> <secret>

139960: <p>I am trying to spend a P2SH UTXO based on a redeem script that requires no signatures and simply needs the correct input to equal the OP_HASH160 digest in the corresponding P2SH locking script.</p>
<p>My unlocking script pushes 17 bytes onto the stack (0x11) which are the following 17 bytes that constitute the &quot;secret&quot; number to get the correct hash.</p>
<p>The decoded raw tx is the following (with the 17 byte secret number removed):</p>
<pre><code>&quot;txid&quot;: &quot;0ba564fc00cbeada33ccded7f4e45f17bfff69c8f8a38132dc715de0d905b857&quot;,
&quot;hash&quot;: &quot;0ba564fc00cbeada33ccded7f4e45f17bfff69c8f8a38132dc715de0d905b857&quot;,
&quot;version&quot;: 1,
&quot;size&quot;: 113,
&quot;vsize&quot;: 113,
&quot;weight&quot;: 452,
&quot;locktime&quot;: 0,
&quot;vin&quot;: [
  {
    &quot;txid&quot;: &quot;f8e5dfe32a57872d58cee6f3eb32ec0277f3563306ae623109ea651fd9dc8087&quot;,
    &quot;vout&quot;: 1,
    &quot;scriptSig&quot;: {
      &quot;asm&quot;: &quot;&lt;17 byte redeem script&gt;&quot;,
      &quot;hex&quot;: &quot;11&lt;17 byte redeem script&gt;&quot;
    },
    &quot;sequence&quot;: 4294967295
  }
],
&quot;vout&quot;: [
  {
    &quot;value&quot;: 0.00002000,
    &quot;n&quot;: 0,
    &quot;scriptPubKey&quot;: {
      &quot;asm&quot;: &quot;02de153317307164e7c9918791c7787d9833a3a8201bdff880e631e490cf9a087c      OP_CHECKSIG&quot;,
      &quot;desc&quot;: &quot;pk(02de153317307164e7c9918791c7787d9833a3a8201bdff880e631e490cf9a087c)#epafp6sh&quot;,
      &quot;hex&quot;: &quot;2102de153317307164e7c9918791c7787d9833a3a8201bdff880e631e490cf9a087cac&quot;,
      &quot;type&quot;: &quot;pubkey&quot;
    }
  }
]
}
</code></pre>
<p>I can't see any mistakes however &quot;sendrawtransaction&quot; gives me the error: <code>error code: -26 error message: mandatory-script-verify-flag-failed (Opcode missing or not understood)</code></p>
<p>I had thought maybe this was a non-standard tx and therefore wouldn't be valid unless submitted directly to miner*, however it was my understanding that P2SH allowed the freedom to submit arbitrary redeem scripts, provided the unlocking script is valid and the redeem script equals the redeem script hash in the locking script.</p>
<p>*<code>bitcoin-cli decodescript </code> for my unlocking script hex does give me <code>Type:nonstandard</code></p>
 109558: <p>A p2sh unlocking script first pushes the actual script, then any stack element needed to fulfill this script. The interpreter will pop one element from the stack and verify if it's hash160 is equal to the one committed in the spk. If yes, then the interpreter destroys the runtime, and build a new one, but using the popped element as script instead.<br />
In your case, bitcoind is interpreting your secret as a script, and it isn't a valid script. Hence, yielding an error about opcodes. The correct way of doing this with p2sh is by taking the hash160 of the hex-encoded script:</p>
<pre><code>OP_HASH160 OP_PUSH20 &lt;your_hash&gt; OP_EQUALVERIFY
</code></pre>
<p>Your program hash is the resulting digest.<br />
When spending, you first push this script, and your secret as a second stack element. Your initial stack looks like this:
<code>&lt;script&gt; &lt;secret&gt;</code></p>
