<p>There are people who just scan for transactions which have the standard anyone can spend constructions (<code>OP_TRUE</code>, in scriptPubKey or as p2sh) and just spend them. To avoid such people from discovering your transactions, you would have to use p2(w)sh with some other anyone can spend script which would have to be revealed as the prize. At that point, you might as well just use a normal p2(w)pkh script and make the prize the private key.</p>
<p>Additionally, anyone can spend scripts are non-standard and most wallet software do not have an easy way to create or spend transactions with anyone can spend scripts. If you have to provide hidden information as the prize, you might as well make that the private key.</p>

CC BY-SA 4.0
2021-11-02T04:22:36.750Z
I'm okay with making the spender figure out non-standard scripts, that would make the game more fun. As long as the transaction is valid.
yzernik
CC BY-SA 4.0
2021-11-02T03:50:10.517Z
2021-11-02T03:50:10.517Z
Ava Chow
<p>I would like to create a game (kind of like a treasure hunt) where the winner finds a piece of hidden information that allows them to claim some bitcoin.</p>
<p>One way to do it is to create a transaction with <code>OP_TRUE</code> in the script so anyone can spend, and the winner is the person who finds this transaction and spends it to himself.</p>
<p>Another way is to create a new wallet, and the winner is the person who finds the private key.</p>
<p>Which way is better, what are the pros/cons?</p>

<script><anyone-can-spend>
ANYONECANSPEND transaction vs. private key for giving bitcoin as a prize
yzernik
# ANYONECANSPEND transaction vs. private key for giving bitcoin as a prize

(Asked by: username_0 on 2021-11-02)

I would like to create a game (kind of like a treasure hunt) where the winner finds a piece of hidden information that allows them to claim some bitcoin.

One way to do it is to create a transaction with `OP_TRUE` in the script so anyone can spend, and the winner is the person who finds this transaction and spends it to himself.

Another way is to create a new wallet, and the winner is the person who finds the private key.

Which way is better, what are the pros/cons?

**Tags:** script, anyone-can-spend


---

## 1 answers

### Answer by username_1 on 2021-11-02. Score: 3

There are people who just scan for transactions which have the standard anyone can spend constructions (`OP_TRUE`, in scriptPubKey or as p2sh) and just spend them. To avoid such people from discovering your transactions, you would have to use p2(w)sh with some other anyone can spend script which would have to be revealed as the prize. At that point, you might as well just use a normal p2(w)pkh script and make the prize the private key.

Additionally, anyone can spend scripts are non-standard and most wallet software do not have an easy way to create or spend transactions with anyone can spend scripts. If you have to provide hidden information as the prize, you might as well make that the private key.

> **Comments:**
> **username_0**: I'm okay with making the spender figure out non-standard scripts, that would make the game more fun. As long as the transaction is valid.  

---

