0

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?

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}

2

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.

  • 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 Sep 12 '16 at 17:57
  • @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 Sep 12 '16 at 21:05
  • 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 Sep 13 '16 at 0:45
  • blockchain.info/ru/pushtx -> P2SH script execution resulted in a non-true stack – bitaps.com Sep 13 '16 at 0:49
  • live.blockcypher.com/btc/pushtx -> Error sending transaction: Rejected script for input 0 referencing 3f300d0588d942cad88a213900e04f122fc7e1aa3683d1f424bf0c6927814ca5 at 23.. – bitaps.com Sep 13 '16 at 0:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.