<p>A transaction may spend an <code>OP_CSV</code>-locked TXO <code>s</code> blocks after it was created. I.e. if it was locked for <code>s</code> blocks, and created in block <code>n</code>, the transaction spending it may be included in block <code>n+s</code>.</p>
<p><em>If Alice’s transaction confirms in block 100 and contains an output with a 30-block relative time-lock for Bob, Bob may spend this output in a transaction that gets confirmed in block 130.</em></p>
<p>Bitcoin Core will consider a transaction spending a relative time-locked TXO policy-valid at a height one lower than it can be included in the blockchain: the transaction will be accepted into the mempool and relayed by nodes whose best chain is at least at height <code>n+s-1</code> (block 129 in above example).</p>

CC BY-SA 4.0
2023-07-21T20:13:58.977Z
2023-07-21T20:13:58.977Z
Murch
<blockquote>
<p>What is the lowest blockheight which may contain a transaction spending that UTXO?</p>
</blockquote>
<p>A UTXO created in block number <em>n</em>, can be spent in block number <em>m</em> (and not before), if the transaction input spending them has <code>nSequence</code> value <em>m-n</em> or lower.</p>
<p>If the UTXO (unconditionally) has <code>&lt;s&gt; OP_CHECKSEQUENCEVERIFY</code> in (all) its script(s), then that means the <code>nSequence</code> of the transaction inputs spending it has to be <em>s</em> or higher, and thus indirectly, spending it can happen in block number <em>n+s</em> or later.</p>
<blockquote>
<p>Bonus: At what height will such a transaction be eligible for relay on the network?</p>
</blockquote>
<p>According to today's relay policy in Bitcoin Core, transactions can be relayed whenever they can legally be included in the next block (among many other rules, of course).</p>

CC BY-SA 4.0
2023-07-21T20:18:08.390Z
2023-07-21T20:18:08.390Z
Pieter Wuille
<p>Assume a UTXO created in block <code>n</code> with the output using a relative timelock of <code>s</code> blocks (<code>s OP_CHECKSEQUENCEVERIFY</code>).</p>
<p>What is the lowest blockheight which may contain a transaction spending that UTXO?</p>
<p>Bonus: At what height will such a transaction be eligible for relay on the network?</p>

<confirmations><mempool><checksequenceverify>
At what height exactly can a relative time-locked output be spent?
Murch
# At what height exactly can a relative time-locked output be spent?

(Asked by: username_0 on 2023-07-21)

Assume a UTXO created in block `n` with the output using a relative timelock of `s` blocks (`s OP_CHECKSEQUENCEVERIFY`).

What is the lowest blockheight which may contain a transaction spending that UTXO?

Bonus: At what height will such a transaction be eligible for relay on the network?

**Tags:** confirmations, mempool, checksequenceverify


---

## 2 answers

### Answer by username_1 on 2023-07-21. Score: 3 | Accepted answer

> What is the lowest blockheight which may contain a transaction spending that UTXO?

A UTXO created in block number *n*, can be spent in block number *m* (and not before), if the transaction input spending them has `nSequence` value *m-n* or lower.

If the UTXO (unconditionally) has `<s> OP_CHECKSEQUENCEVERIFY` in (all) its script(s), then that means the `nSequence` of the transaction inputs spending it has to be *s* or higher, and thus indirectly, spending it can happen in block number *n+s* or later.

> Bonus: At what height will such a transaction be eligible for relay on the network?

According to today's relay policy in Bitcoin Core, transactions can be relayed whenever they can legally be included in the next block (among many other rules, of course).


---

### Answer by username_0 on 2023-07-21. Score: 4

A transaction may spend an `OP_CSV`-locked TXO `s` blocks after it was created. I.e. if it was locked for `s` blocks, and created in block `n`, the transaction spending it may be included in block `n+s`.

*If Alice’s transaction confirms in block 100 and contains an output with a 30-block relative time-lock for Bob, Bob may spend this output in a transaction that gets confirmed in block 130.*

Bitcoin Core will consider a transaction spending a relative time-locked TXO policy-valid at a height one lower than it can be included in the blockchain: the transaction will be accepted into the mempool and relayed by nodes whose best chain is at least at height `n+s-1` (block 129 in above example).


---

