← Back to Glossary

Input Sequence (nSequence)

The input sequence, or nSequence, is a 4-byte field attached to every input of a Bitcoin transaction. Originally intended by Satoshi Nakamoto for replacing unconfirmed transactions with newer versions, the field was repurposed over time and now signals two things: whether a transaction opts into replace-by-fee, and relative timelocks that delay spending until an output has aged a set number of blocks.

Why it matters

nSequence is a case study in how Bitcoin evolves without breaking itself. The original replacement idea was disabled early because it allowed free transaction spam, leaving four apparently useless bytes in every input. Rather than waste them, later protocol work assigned them meaning: BIP 125 defined signaling for fee replacement, and BIP 68, activated in 2016, gave the field consensus-enforced relative locktime semantics.

Relative timelocks are foundational for second-layer protocols. Lightning Network channels depend on them, using nSequence-based delays to give a wronged party time to contest an outdated channel state before funds move. Without this quiet little field, Lightning's security model would not work.

How it works

A sequence value below the maximum signals that the transaction can be replaced while unconfirmed. When relative locktime is active, bits of the field encode a waiting period, expressed either in blocks or in units of 512 seconds, that must pass after the referenced output's confirmation before the spend becomes valid. Setting all bits to the maximum disables both features and, historically, also fixes the transaction's locktime behavior.

Ready to convert your gold to Bitcoin?

Get Your Free Kit →