3

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?

Murch
  • 71,155
  • 33
  • 180
  • 600

2 Answers2

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

Murch
  • 71,155
  • 33
  • 180
  • 600
3

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

Pieter Wuille
  • 98,249
  • 9
  • 183
  • 287