How can I create a p2sh transaction with a scriptsig containing OP_TRUE only, removing the need for a digital signature, which will be broadcasted and mined?

Also could some one provide an example of such a transaction?


Here you have an example of a transaction spending from a P2PKH output and creating a P2SH output with an OP_1.

And here you have the counterpart, a transaction spending from the first one (with an input script '0151') and generating a P2PKH output.

I've created both using a Python library i'm coauthor of. You can check it out here.

  • I've added new transactions including fees to ensure that they end up in a block. – sr-gi Mar 23 '18 at 10:42
  • Does the output script you use to fund the p2sh transaction always have to be OP_HAS160 (hash) OP_EQUAL ? – Errol Mar 23 '18 at 18:57
  • Yes, that's the structure of any P2SH output script. – sr-gi Mar 23 '18 at 19:11
  • Could a transaction like that be created on the mainnet? – Errol Mar 23 '18 at 19:18
  • Sure. However you should be careful, anyone will be able to redeem it. – sr-gi Mar 23 '18 at 19:51

Your Answer

