<p>OP_PUSHDATA1 and even OP_PUSHDATA2 are allowed inside P2SH scripts fine. However, there is another policy in Bitcoin Core to require that all pushes are minimal in standard transactions. That means you can only use OP_PUSHDATA1 when a direct push is not possible (up to 75 bytes), and only use OP_PUSHDATA2 when an OP_PUSHDATA1 is not possible (up to 255 bytes).</p>

<p>Also, in general: when experimenting with scripts, try things on testnet first.</p>

CC BY-SA 3.0
2016-09-12T17:57:49.320Z
Thank you Pieter for reply. Could you provide example of transaction inside blockchain. If I will have example I will investigate my problem. I know about minimal limitation to prevent transaction malleability.  And I tried to create transaction with data push > 75. Same error I just edit my question and add transaction with data = 90 bytes
bitaps.com
CC BY-SA 3.0
2016-09-12T21:05:15.987Z
@bitaps I looked at your Script a little bit and it seems that you are using `OP_PUSHDATA1` appropriately. I'm wondering if this is an issue with blockchain.info, have you tried using this against bitcoin core?
Chris Stewart
CC BY-SA 3.0
2016-09-13T00:45:38.233Z
https://www.smartbit.com.au/txs/pushtx  ->    PUSH TRANSACTION ERROR: 16: MANDATORY-SCRIPT-VERIFY-FLAG-FAILED (SCRIPT EVALUATED WITHOUT ERROR BUT FINISHED WITH A FALSE/EMPTY TOP STACK ELEMENT)
bitaps.com
CC BY-SA 3.0
2016-09-13T00:49:11.327Z
https://blockchain.info/ru/pushtx -> P2SH script execution resulted in a non-true stack
bitaps.com
CC BY-SA 3.0
2016-09-13T00:51:14.020Z
https://live.blockcypher.com/btc/pushtx/ ->  Error sending transaction: Rejected script for input 0 referencing 3f300d0588d942cad88a213900e04f122fc7e1aa3683d1f424bf0c6927814ca5 at 23..
bitaps.com
CC BY-SA 3.0
2016-09-13T00:53:52.840Z
We have own bitcoin node implementation, and our node successfully decode this transaction https://bitaps.com/3e3b46a701103d18849f3b36fc906a6fedcc790b2f7185660ccfa6b9d9451e90  But most of network nodes reject it. I want to understand the reason.
bitaps.com
CC BY-SA 3.0
2016-09-13T03:52:17.840Z
This really just looks like the signature is wrong.
Pieter Wuille
CC BY-SA 3.0
2016-09-13T08:00:31.893Z
Thank you Peter! Just found and fixed problem with signature hash generation. https://bitaps.com/41e5c7718389d6fb7b845f0b396db4b7b245101dbb58ae40c4610030cb959e16  Transaction successfully accepted in network
bitaps.com
CC BY-SA 3.0
2016-09-12T14:55:17.760Z
2016-09-12T14:55:17.760Z
Pieter Wuille
<p>P2SH “relaxed standards” for P2SH redeem scripts in Bitcoin Core 0.10.0</p>

<p><a href="https://bitcoin.stackexchange.com/questions/36224/what-is-meant-by-relaxed-standards-for-p2sh-redeem-scripts-in-bitcoin-core-0-1">What is meant by &quot;relaxed standards&quot; for P2SH redeem scripts in Bitcoin Core 0.10.0?</a></p>

<p>I just try to create redeem script with OP_PUSHDATA1 opcode and push it 
using Blockchain.info </p>

<p>RAW TX is </p>

<p>In case I start use OP_PUSHDATA1  transaction not broadcast to network
At example Blockchain.info give me error "P2SH script execution resulted in a non-true stack"</p>

<p>Transaction with data = 90 bytes </p>

<pre><code>0100000001a54c8127690cbf24f4d18336aae1c72f124fe00039218ad8ca42d988050d303f17000000e247304402205221bd680af998ac98f7ede5b532761a0a643da1cf16a30afb73b8b79fdcfd010220759d2e7eccf89d85b921f6d9c9246f9e9193ab6b60e3b387e31ec86298a643640121026b8cdb5ee526886dd01540df3c3c001876a5dedbe834f92b75eea7e1cc17ed7c4c764c5a3131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131317576a9146902e12aeb180003f48d4411ed27ff6f5202d0fa88acffffffff0198210000000000001976a9146902e12aeb180003f48d4411ed27ff6f5202d0fa88ac00000000
</code></pre>

<p>JSON</p>

<p><em>{"output": [{"address": ["1AaFQDd393APFh9XAKYJjsKLtvRdZPpzKk"], "out_index": 0, "script": {"pattern": "OP_DUP OP_HASH160 &lt;20> OP_EQUALVERIFY OP_CHECKSIG", "asm": "OP_DUP OP_HASH160 6902e12aeb180003f48d4411ed27ff6f5202d0fa OP_EQUALVERIFY OP_CHECKSIG", "hex": "76a9146902e12aeb180003f48d4411ed27ff6f5202d0fa88ac", "type": "P2PKH"}, "amount": 8600}],</em> </p>

<p><strong>"input":</strong> [
{"sequence": 4294967295,
 "address": ["38rsbYpEuckLjnts7dF2YjNT2wcu1RmjmU"], </p>

<p>"sig_script": {
      "pattern": "&lt;71> &lt;33> &lt;118>", </p>

<pre><code> "asm": "304402205221bd680af998ac98f7ede5b532761a0a643da1cf16a30afb73b8b79fdcfd010220759d2e7eccf89d85b921f6d9c9246f9e9193ab6b60e3b387e31ec86298a6436401 026b8cdb5ee526886dd01540df3c3c001876a5dedbe834f92b75eea7e1cc17ed7c 4c5a3131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131317576a9146902e12aeb180003f48d4411ed27ff6f5202d0fa88ac", 
</code></pre>

<p>"type": "SIGSCRIPT", </p>

<p>"hex": "47304402205221bd680af998ac98f7ede5b532761a0a643da1cf16a30afb73b8b79fdcfd010220759d2e7eccf89d85b921f6d9c9246f9e9193ab6b60e3b387e31ec86298a643640121026b8cdb5ee526886dd01540df3c3c001876a5dedbe834f92b75eea7e1cc17ed7c4c764c5a3131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131317576a9146902e12aeb180003f48d4411ed27ff6f5202d0fa88ac"}, </p>

<p><strong>"redeem_script":</strong> 
    <strong>{"pattern": "&lt;90> OP_DROP OP_DUP OP_HASH160 &lt;20> OP_EQUALVERIFY OP_CHECKSIG",</strong> </p>

<blockquote>
  <p>I use : test = b"1"*90 s =
  b"\x4c"+len(test).to_bytes(1,'little')+test+OPCODE["OP_DROP"]+s</p>
</blockquote>

<pre><code>"asm": "313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131 OP_DROP OP_DUP OP_HASH160 6902e12aeb180003f48d4411ed27ff6f5202d0fa OP_EQUALVERIFY OP_CHECKSIG", 
</code></pre>

<p>"hex": "4c5a3131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131317576a9146902e12aeb180003f48d4411ed27ff6f5202d0fa88ac", </p>

<p>"type": "NON_STANDART"},</p>

<p><em>"script": {"pattern": "OP_HASH160 &lt;20> OP_EQUAL", "asm": "OP_HASH160 4ea616b2ce8f782688f9170e32cde1f0396be720 OP_EQUAL", "type": "P2SH", "hex": "a9144ea616b2ce8f782688f9170e32cde1f0396be72087"}, "amount": 20000, "input_index": 0, "output_index": 23, "transaction_hash": "3f300d0588d942cad88a213900e04f122fc7e1aa3683d1f424bf0c6927814ca5"}], "data": "", "timestamp": 1473702857, "size": 311, "locktime": 0, "hash": "3e3b46a701103d18849f3b36fc906a6fedcc790b2f7185660ccfa6b9d9451e90", "coinbase": false, "block": null, "fee": 11400}</em></p>

<non-standard-transaction>
OP_PUSHDATA1 is not allowed inside redeem script of P2SH?
bitaps.com
# OP_PUSHDATA1 is not allowed inside redeem script of P2SH?

(Asked by: username_0 on 2016-09-12)

P2SH “relaxed standards” for P2SH redeem scripts in Bitcoin Core 0.10.0

[What is meant by "relaxed standards" for P2SH redeem scripts in Bitcoin Core 0.10.0?](https://bitcoin.stackexchange.com/questions/36224/what-is-meant-by-relaxed-standards-for-p2sh-redeem-scripts-in-bitcoin-core-0-1)

I just try to create redeem script with OP\_PUSHDATA1 opcode and push it
using Blockchain.info

RAW TX is

In case I start use OP\_PUSHDATA1 transaction not broadcast to network
At example Blockchain.info give me error "P2SH script execution resulted in a non-true stack"

Transaction with data = 90 bytes

```
0100000001a54c8127690cbf24f4d18336aae1c72f124fe00039218ad8ca42d988050d303f17000000e247304402205221bd680af998ac98f7ede5b532761a0a643da1cf16a30afb73b8b79fdcfd010220759d2e7eccf89d85b921f6d9c9246f9e9193ab6b60e3b387e31ec86298a643640121026b8cdb5ee526886dd01540df3c3c001876a5dedbe834f92b75eea7e1cc17ed7c4c764c5a3131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131317576a9146902e12aeb180003f48d4411ed27ff6f5202d0fa88acffffffff0198210000000000001976a9146902e12aeb180003f48d4411ed27ff6f5202d0fa88ac00000000

```

JSON

*{"output": [{"address": ["1AaFQDd393APFh9XAKYJjsKLtvRdZPpzKk"], "out\_index": 0, "script": {"pattern": "OP\_DUP OP\_HASH160 <20> OP\_EQUALVERIFY OP\_CHECKSIG", "asm": "OP\_DUP OP\_HASH160 6902e12aeb180003f48d4411ed27ff6f5202d0fa OP\_EQUALVERIFY OP\_CHECKSIG", "hex": "76a9146902e12aeb180003f48d4411ed27ff6f5202d0fa88ac", "type": "P2PKH"}, "amount": 8600}],*

**"input":** [
{"sequence": 4294967295,
"address": ["38rsbYpEuckLjnts7dF2YjNT2wcu1RmjmU"],

"sig\_script": {
"pattern": "<71> <33> <118>",

```
 "asm": "304402205221bd680af998ac98f7ede5b532761a0a643da1cf16a30afb73b8b79fdcfd010220759d2e7eccf89d85b921f6d9c9246f9e9193ab6b60e3b387e31ec86298a6436401 026b8cdb5ee526886dd01540df3c3c001876a5dedbe834f92b75eea7e1cc17ed7c 4c5a3131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131317576a9146902e12aeb180003f48d4411ed27ff6f5202d0fa88ac", 

```

"type": "SIGSCRIPT",

"hex": "47304402205221bd680af998ac98f7ede5b532761a0a643da1cf16a30afb73b8b79fdcfd010220759d2e7eccf89d85b921f6d9c9246f9e9193ab6b60e3b387e31ec86298a643640121026b8cdb5ee526886dd01540df3c3c001876a5dedbe834f92b75eea7e1cc17ed7c4c764c5a3131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131317576a9146902e12aeb180003f48d4411ed27ff6f5202d0fa88ac"},

**"redeem\_script":**
**{"pattern": "<90> OP\_DROP OP\_DUP OP\_HASH160 <20> OP\_EQUALVERIFY OP\_CHECKSIG",**

> I use : test = b"1"\*90 s =
> b"\x4c"+len(test).to\_bytes(1,'little')+test+OPCODE["OP\_DROP"]+s

```
"asm": "313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131 OP_DROP OP_DUP OP_HASH160 6902e12aeb180003f48d4411ed27ff6f5202d0fa OP_EQUALVERIFY OP_CHECKSIG", 

```

"hex": "4c5a3131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131317576a9146902e12aeb180003f48d4411ed27ff6f5202d0fa88ac",

"type": "NON\_STANDART"},

*"script": {"pattern": "OP\_HASH160 <20> OP\_EQUAL", "asm": "OP\_HASH160 4ea616b2ce8f782688f9170e32cde1f0396be720 OP\_EQUAL", "type": "P2SH", "hex": "a9144ea616b2ce8f782688f9170e32cde1f0396be72087"}, "amount": 20000, "input\_index": 0, "output\_index": 23, "transaction\_hash": "3f300d0588d942cad88a213900e04f122fc7e1aa3683d1f424bf0c6927814ca5"}], "data": "", "timestamp": 1473702857, "size": 311, "locktime": 0, "hash": "3e3b46a701103d18849f3b36fc906a6fedcc790b2f7185660ccfa6b9d9451e90", "coinbase": false, "block": null, "fee": 11400}*

**Tags:** non-standard-transaction


---

## 1 answers

### Answer by username_1 on 2016-09-12. Score: 3 | Accepted answer

OP\_PUSHDATA1 and even OP\_PUSHDATA2 are allowed inside P2SH scripts fine. However, there is another policy in Bitcoin Core to require that all pushes are minimal in standard transactions. That means you can only use OP\_PUSHDATA1 when a direct push is not possible (up to 75 bytes), and only use OP\_PUSHDATA2 when an OP\_PUSHDATA1 is not possible (up to 255 bytes).

Also, in general: when experimenting with scripts, try things on testnet first.

> **Comments:**
> **username_0**: Thank you username_1 for reply. Could you provide example of transaction inside blockchain. If I will have example I will investigate my problem. I know about minimal limitation to prevent transaction malleability.  And I tried to create transaction with data push > 75. Same error I just edit my question and add transaction with data = 90 bytes  
> **username_2**: @bitaps I looked at your Script a little bit and it seems that you are using `OP_PUSHDATA1` appropriately. I'm wondering if this is an issue with blockchain.info, have you tried using this against bitcoin core?  
> **username_0**: https://www.smartbit.com.au/txs/pushtx  ->    PUSH TRANSACTION ERROR: 16: MANDATORY-SCRIPT-VERIFY-FLAG-FAILED (SCRIPT EVALUATED WITHOUT ERROR BUT FINISHED WITH A FALSE/EMPTY TOP STACK ELEMENT)  
> **username_0**: https://blockchain.info/ru/pushtx -> P2SH script execution resulted in a non-true stack  
> **username_0**: https://live.blockcypher.com/btc/pushtx/ ->  Error sending transaction: Rejected script for input 0 referencing 3f300d0588d942cad88a213900e04f122fc7e1aa3683d1f424bf0c6927814ca5 at 23..  
> **username_0**: We have own bitcoin node implementation, and our node successfully decode this transaction https://username_0/3e3b46a701103d18849f3b36fc906a6fedcc790b2f7185660ccfa6b9d9451e90  But most of network nodes reject it. I want to understand the reason.  
> **username_1**: This really just looks like the signature is wrong.  
> **username_0**: Thank you Peter! Just found and fixed problem with signature hash generation. https://username_0/41e5c7718389d6fb7b845f0b396db4b7b245101dbb58ae40c4610030cb959e16  Transaction successfully accepted in network  

---

