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.

1 Answer 1


It is not possible to make a transaction which is valid in the past invalid in the future (except in specific cases around soft fork activation). The best you can do is to make it more likely that a conflicting transaction is accepted.

What you could do is making a double spending transaction that has a timelock (so it can't be confirmed until the "expiration") and pays a higher transaction fee rate. So once the timelock is passed, the transaction becomes a RBF transaction for the original, making it much more likely to become confirmed. Once confirmed, it would cause the original to become invalid and thus "expired".


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.