I’m new to Bitcoin Script, and I was wondering if it is possible to use funds from one utxo to “insure” that other utxo will not be double-spent (until the Lightning Network will save us all).
Suppose I have 0.1 bitcoin in a utxo with pubkey pubKey1, and 10 bitcoins that I would send to an output script that would do something like:
If nLocktime is greater than X, verify that the stack contains a signature that matches some pubKeyHash2.
Otherwise, verify that the stack contains:
<payload2>, such that
<sig1>matches pubKey1 +
<sig2>matches pubKey1 +
i.e. until nLocktime passes, anyone who can find 2 different signatures of pubKey1 (of two different payloads) can win the 10 btc prize.
This will create a huge incentive for me to never sign two transactions (or any two payloads) with the private key of pubKey1. I could obviously take the risk, double-spend the 0.1 btc by publishing two transactions, and immediately try to claim the 10 btc prize myself, but once I published the two double-spending transactions, the miners would try to take all the 10 btc to themselves (and probably ignore any transaction that tries to take even a small portion of the prize without offering them 100% fee).
I don’t see how the current op-codes allow this kind of script – I couldn’t even find an “OP_CHECKLOCKTIME” (found only “OP_CHECKLOCKTIMEVERIFY”), and “OP_CHECKSIG” operates on data from the transaction and not on arbitrary payloads in the stack.
What do you think? Could this be implemented in the future? Could this be implemented in other cryptocurrencies? This could be useful when you don’t want to wait for even a single block confirmation, for example in ATMs.