I want to generate a transaction that spends funds to a wallet controlled by a third party, but for this transaction to only remain valid for a certain window of time. This could mean a transaction that excecutes successfully if it is accepted within the next three blocks but fails if it is executed after the next three blocks. Let's assume that information such as block height information is known.
I understand that the default response is to say "Bitcoin transactions do not expire [...] so you should just give up." Any creative solution would be appreciated, consider this a challenge if need be.
A few things that come to my mind that may help you deliver a solution:
- Spending funds to a wallet that a third party controls is not the same thing as spending to an address that a third-party provides.
- You could potentially make use of the public key to generate an address with weirdness or make use of bitcoin script.
- You could potentially make use of two-way communication between the sender and reciever here.