Reading the following BIPs: 68, 112, 125, I got a few questions about the sematics of sequence numbers. As far as I understood, in version 1 transactions, sequence numbers have the following meaning:

  • If any input has a sequence less than 0xfffffffe, than the whole transaction is signalling replaceability

On the other hand, in version >=2 transactions, the above rule applies, plus:

  • If a sequence number has the disable flag (1 << 31) set to 1, then the sequence has no additional meaning (but can still be used to signal replaceability, right?)
  • If the disable flag is not set, then the sequence number is interpreted as a relative locktime with the format specified in BIP68. This means that transaction will not be included in a block until the output it spends reaches the specified age.

So, putting it all together, if one wants to signal replaceability in a version >=2 transaction, one can just use a sequence number which is less than 0xfffffffe but has an active disable flag (i.e. is greater than 0x80000000), on the other hand, how should one set the sequence number if one wants to both signal replaceability and also spend a relative timelocked output? Would it be ok to use a sequence number according to BIP68 and increase the bits that have no meaning in that format to replace the transaction? (i.e. changing all bits except 1 << 31, 1 << 22 and 0xffff)

1 Answer 1


If you're creating a version 2 transaction with the disable flag not set, then by definition the whole nSequence value will be less than 0xFFFFFFFE (because it will be at most 0x7FFFFFFF).

This implies that a transaction with an active relative locktime will always be replacable according to BIP125.

This is intentional. Nonreplacable transactions attempt to make use of the existing network policy rules to favor the first broadcasted version of a transaction. A transaction that will only become valid at a future point in time cannot make use of that, as it can't be broadcast until it becomes valid.

  • I don't see why the time delay means non-replaceability can't be useful. I can't think of a use, but someone may, for whatever reason, not want their transaction replaced, even if they are spending an output with relative locktime. Feb 7, 2020 at 20: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.