<p>It is not possible to do precisely what you are asking, but it is possible to achieve something similar in principle.</p>
<p>Bitcoin does not have a &quot;invalid after block height/block time&quot; construct that  would prevent a transaction from being included if it is not mined quickly.</p>
<p>However, you could construct an output that mirrors the same conditions.</p>
<p>Using <code>OP_CHECKLOCKTIMEVERIFY</code>, 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.</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>

CC BY-SA 4.0
2024-05-21T10:47:36.360Z
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
CC BY-SA 4.0
2024-05-17T07:34:20.533Z
2024-05-17T07:34:20.533Z
Raghav Sood
<p>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?</p>
<p>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).</p>

<transactions><locktime><smartcontracts><opcodes><escrow>
Make signed transaction invalid after specified time
f321x
# Make signed transaction invalid after specified time

(Asked by: username_0 on 2024-05-16)

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).

**Tags:** transactions, locktime, smartcontracts, opcodes, escrow


---

## 1 answers

### Answer by username_1 on 2024-05-17. Score: 0

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.

> **Comments:**
> **username_0**: 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?  

---

