nSequence
Originally for partial transaction updates, repurposed by BIP 68 to enforce relative locktimes in OP_CSV scripts.
nSequence is a 32-bit field per transaction input in Bitcoin. Originally intended as a partial-replacement mechanism in Bitcoin's earliest design, it has since been repurposed by BIP-68 (and signaling for BIP-125 RBF) to encode:
- Relative locktimes. Lower 16 bits encode a block-count or time-based delay since the input's UTXO was confirmed.
- Type flag. Bit 22 chooses between block-based and time-based interpretation.
- Disable flag. Bit 31, when set, disables relative-locktime enforcement for that input.
- RBF signaling. Any
nSequencevalue less than0xfffffffesignals BIP-125 opt-in RBF.
The current default value is 0xfffffffd (BIP-125 RBF signaling enabled) or 0xffffffff (no relative locktime, no RBF signaling), depending on the wallet.
The semantics matter for a few cases users actually encounter:
- A wallet that supports RBF sets
nSequenceto0xfffffffdso the transaction can be replaced via BIP-125. - A Lightning commitment transaction uses specific
nSequencevalues to encode the channel-close delay window enforced via OP_CHECKSEQUENCEVERIFY. - A scripted contract with relative locktime sets
nSequenceto the delay value and pairs the input with a CSV check in the locking script.
nSequence is one of those Bitcoin protocol details that most users will never encounter directly, but that's quietly load-bearing for Lightning, vaults, and most advanced multi-party constructions. The history of repurposing it from "partial replacement" to "relative locktime + RBF signaling" is a small example of how Bitcoin's protocol pragmatically reuses field semantics over time.
See BIP-68 for the relative-locktime semantics and Locktime for the broader time-based scripting framework.
Key takeaways
- Transformed from a partial replace mechanism to a relative locktime indicator
- BIP 68 + OP_CSV enable advanced channel logic using nSequence
- Crucial for second-layer solutions requiring time-based outputs
Related terms (12)
- Absolute Locktime
- BIP 65 (OP_CHECKLOCKTIMEVERIFY) — Plain-English Explainer
- BIP 68 (Relative Locktime)
- BIP 113
- CheckLockTimeVerify (CLTV)
- CheckSequenceVerify (CSV)
- Delayed Justice Transaction
- Locktime
- MTP (Median Time Past) — How Bitcoin Tracks Network Time
- nLocktime
- Time-Locked Contract
- Transaction