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?

  • @Michael Folkson I see the tag bitcoin-core-development was added by you, but I don't understand how it's related to the question, can you explain? Commented Jun 4, 2022 at 22:20
  • @VojtěchStrnad: Not sure, it was a while back! Think I thought it was functional test related but removed now :) Commented Jun 5, 2022 at 12:05

1 Answer 1


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
    Commented Mar 23, 2018 at 10:42
  • Does the output script you use to fund the p2sh transaction always have to be OP_HAS160 (hash) OP_EQUAL ?
    – Errol
    Commented Mar 23, 2018 at 18:57
  • Yes, that's the structure of any P2SH output script.
    – sr_gi
    Commented Mar 23, 2018 at 19:11
  • Could a transaction like that be created on the mainnet?
    – Errol
    Commented Mar 23, 2018 at 19:18
  • Sure. However you should be careful, anyone will be able to redeem it.
    – sr_gi
    Commented Mar 23, 2018 at 19:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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