How can I create an anyone-can-spend transaction using p2pkh outputs?

Also how would such a transaction in hex look like?

2 Answers 2


If it's a P2PKH output, it's not anyone-can-spend. P2PKH implies there is a public key that needs to sign for spending.

You can use a P2SH or P2WSH output which sends to an OP_TRUE script, though.

You can also manually craft a transaction with a scriptPubKey that is literally OP_TRUE. No address corresponds to such an output, so you couldn't use off the shelf wallet software for it.

  • So how can i create an anyone can spend transaction?
    – Errol
    Mar 27, 2018 at 1:49
  • 1
    I've expanded the answer a bit. Mar 27, 2018 at 2:38
  • You also have how the transaction will look like (the P2SH Pieter referred to) in a question you asked a few days ago: bitcoin.stackexchange.com/q/72773/30668
    – sr_gi
    Mar 27, 2018 at 8:38

For a P2PKH anyone-can-spend, just send to the address 1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH -- its private key is the integer 1, or in WIF format, KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9M7rFU73sVHnoWn. Anyone can spend from this address since the private key is known to all.

  • 3
    I don't think "the private key is known" is actually the answer he's looking for. Mar 29, 2019 at 3:50

Your Answer

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

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