Is it possible to construct a valid signed transaction that will become invalid if it hasn't been included in a block before a specified height? Is there any opcode or other way to accomplish this?

The practical use case i envision is a bond (signed transaction) sent to a coordinator that could be published by the coordinator as punishment, but becomes invalid after a specified time (e.g. 1024 blocks).

1 Answer 1


It is not possible to do precisely what you are asking, but it is possible to achieve something similar in principle.

Bitcoin does not have a "invalid after block height/block time" construct that would prevent a transaction from being included if it is not mined quickly.

However, you could construct an output that mirrors the same conditions.

Using OP_CHECKLOCKTIMEVERIFY, you can construct an output that can be spent by the coordinator for until a specific block height or time, and after that only be spent by yourself.

In theory, this could also meet your requirements without mining the transaction - by providing a signed transaction to your coordinator that creates such an output, they could broadcast it along with a child transaction consuming that output.

In the event that they do not need to exercise that bond, or the timelock has elapsed, then broadcasting it has no benefit for them.

If the coordinator is not a well behaving citizen, they could subject you to a griefing attack by broadcasting it even after the timelock has elapsed, costing you transaction fees. However, you would still be able to retrieve the value of the bond as they would no longer be able to create a transaction to spend it.

  • Isn't OP_CLTV also used to lock an output until a specific time in the future instead of locking it starting from a specific time in the future? How would a script look like that disables spending of the output by a specified party starting from a specified time in the future?
    – f321x
    Commented May 21 at 10:47

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.