0

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?

yzernik
  • 213
  • 1
  • 4

1 Answers1

2

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.

Andrew Chow
  • 67,209
  • 5
  • 76
  • 149
  • 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 Nov 02 '21 at 04:22