<p>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.</p>

<p>You can use a P2SH or P2WSH output which sends to an <code>OP_TRUE</code> script, though. </p>

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

CC BY-SA 3.0
2018-03-27T01:49:56.067Z
So how can i create an anyone can spend transaction?
Errol
CC BY-SA 3.0
2018-03-27T02:38:02.063Z
I've expanded the answer a bit.
Pieter Wuille
CC BY-SA 3.0
2018-03-27T08:38:50.607Z
You also have how the transaction will look like (the P2SH Pieter referred to) in a question you asked a few days ago: https://bitcoin.stackexchange.com/q/72773/30668
sr_gi
CC BY-SA 3.0
2018-03-27T01:39:16.990Z
2018-03-27T02:41:44.723Z
2018-03-27T02:41:44.723Z
Pieter Wuille
<p>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.</p>

CC BY-SA 4.0
2019-03-29T03:50:10.060Z
I don't think "the private key is known" is actually the answer he's looking for.
Tiago Loriato Simões
CC BY-SA 4.0
2019-03-29T02:28:19.877Z
2019-03-29T02:28:19.877Z
Mark Lundeberg
<p>How can I create an anyone-can-spend transaction using p2pkh outputs?</p>
<p>Also how would such a transaction in hex look like?</p>

<transactions><validation><p2pkh><anyone-can-spend>
How can I create an anyone-can-spend output?
Errol
# How can I create an anyone-can-spend output?

(Asked by: username_0 on 2018-03-27)

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

Also how would such a transaction in hex look like?

**Tags:** transactions, validation, p2pkh, anyone-can-spend


---

## 2 answers

### Answer by username_1 on 2018-03-27. Score: 3

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.

> **Comments:**
> **username_0**: So how can i create an anyone can spend transaction?  
> **username_1**: I've expanded the answer a bit.  
> **username_2**: You also have how the transaction will look like (the P2SH Pieter referred to) in a question you asked a few days ago: https://bitcoin.stackexchange.com/q/72773/30668  

---

### Answer by username_3 on 2019-03-29. Score: 1

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.

> **Comments:**
> **username_4**: I don't think "the private key is known" is actually the answer he's looking for.  

---

