BOMBARCHIVE
Explore

A living reference collection. Written in the wiki, preserved in Git.

The archiveBitcoin

Bitcoin sequence numbers

Bitcoin sequence numbers are the four-byte unsigned nSequence values carried by each input of a Bitcoin transaction. The field is old, but its meanings have changed. In the original client it helped distinguish proposed revisions of an unconfirmed transaction; it also helped decide whether a transaction's absolute locktime mattered. Later protocols reused the same field for relative spending delays and as an opt-in signal for replace-by-fee. These uses overlap in the bytes without being the same rule. Bitcoin v0.1.5 — original transaction structure · BIP 68 · BIP 125

Where the number lives

A Bitcoin transaction can have several inputs, and each input has its own nSequence. It is not a single sequence number shared by the whole transaction, nor is it the order in which the transaction appears in a block. It is serialized alongside that input's previous-output reference and unlocking data. Changing it generally changes the transaction's serialized identity and invalidates signatures that commit to that field; any proposed new transaction must still satisfy the applicable signing and spending rules. Bitcoin v0.1.5 — CTxIn and serialization · Bitcoin Core — maintained transaction types

Two distinct questions can be asked of the same number:

  • Finality and locktime: does the transaction satisfy absolute nLockTime, and, for applicable later-version transactions, the relative constraints of BIP 68?
  • Replacement policy: does it carry the historical BIP 125 signal allowing a node to replace an unconfirmed mempool transaction with a fee-paying conflict?

The first involves consensus-enforced transaction eligibility. The second was a convention for deciding which competing unconfirmed candidates a node would relay. See Bitcoin timelocks and Transaction replacement for their separate histories.

2009: proposed revisions in the original client

The v0.1.5 source preserves a default input sequence of UINT_MAX, or 0xffffffff, and an IsFinal() test that treats that value as final. Its transaction finality test could ignore a nonzero locktime when every input was final. At this early point the time cutoff itself was height-based; timestamp interpretation arrived in a later 2009 source revision. Bitcoin v0.1.5 — CTxIn and CTransaction::IsFinal · 29 October 2009 — locktime source change

There was also an actual unconfirmed-transaction replacement path. CTransaction::AcceptTransaction() looked for conflicting in-memory spends, checked that the proposed version used the same inputs, called IsNewerThan() to compare their sequence fields, and could discard the old mempool transaction in favour of the new one. The comparison function considered differences across inputs, rather than simply labelling any transaction with a bigger number newer. These are direct source-code observations, not independently recovered evidence that miners or merchants successfully operated high-frequency channels in 2009. Bitcoin v0.1.5 — AcceptTransaction · Bitcoin v0.1.5 — IsNewerThan

The original mechanism had a fundamental incentive problem: a higher sequence value did not require a higher fee. A relay node could consume bandwidth handling a revision without a corresponding reason for miners to prefer it. This explanation is articulated in '''BIP 125's later retrospective**, rather than in a contemporaneous engineering memorandum establishing why every participant supported the change. BIP 125 — motivation

On **19 August 2010'*, source commit 05454818 inserted an unconditional rejection ahead of the mempool-replacement logic with the comment Disable replacement feature for now. The implementation beneath the new rejection was left in the source. This was a specific code change; the subsequent Bitcoin 0.3.12 release was a different event. It did not remove nSequence from the transaction format or make it disappear from the finality check. 19 August 2010 — direct source diff · Bitcoin v0.3.12 source

2015–2016: relative age becomes consensus

BIP 68, assigned 28 May 2015, proposed a new use for sequence numbers in transactions with version 2 or greater. When bit 31 (the highest bit) is unset, a sequence field can specify that the output being spent must have aged by a minimum number of blocks or a minimum interval measured using median-time-past. This is consensus-enforced eligibility, not negotiation over a mempool candidate. BIP 68 — assigned date, specification and reference implementation

Its encoding has three important parts:

  • Bit 31 set: the relative-locktime disable flag. The input is not subject to BIP 68 relative-lock enforcement.
  • Bit 22 set, with bit 31 unset: choose a time-based delay. The lower sixteen bits specify units of 512 seconds.
  • Bit 22 unset, with bit 31 unset: choose a block-based delay. The lower sixteen bits specify a number of blocks.

The unused bits are not all durations. In particular, displaying the entire four-byte integer as a delay yields nonsense. For time-based age, BIP 68 compares the median time past the block *'before the output's confirming block''' against the median time past the block before the proposed spending block. For block-based age, it uses the output's confirmation height. These rules are more precise than saying the transaction becomes valid some fixed number of wall-clock hours after a block-explorer timestamp. BIP 68 — exact clock definitions

BIP 112, assigned 10 August 2015, repurposed the previously reserved OP_NOP3 as OP_CHECKSEQUENCEVERIFY (CSV). A script can compare a specified minimum relative lock to the spending input's sequence field. This lets an output demand a delayed spending path, not merely hope a previously prepared transaction stays unbroadcast. The opcode's checks and BIP 68's output-age check are separate parts of the arrangement; a script invoking CSV doesn't itself read today's block height. BIP 112 — summary and implementation · BIP 68 — enforcement

BIP 113 aligned time-based transaction finality with the previous eleven blocks' median time past. The three proposals were deployed together through BIP 9, activating at mainnet block 419,328 in July 2016. The consensus change did not automatically launch a Lightning Network or prove that any particular channel used CSV at activation. Bitcoin Core — 21 June 2016 activation guidance · BIP 113

2015–2025: a different reuse, replace-by-fee signalling

BIP 125, assigned 4 December 2015, gave nSequence a second, policy-level meaning. Under its original opt-in relay policy, a transaction explicitly signalled replaceability if any input had a value below 0xfffffffe. An unconfirmed descendant could inherit replaceability from an unconfirmed ancestor that signalled it. This did not change whether two conflicting transactions could coexist in a valid Bitcoin block. BIP 125 — summary and original implementation

BIP 125 deliberately allowed a spender to retain absolute locktime without opting in: 0xfffffffe is below the all-final value but not below the BIP 125 signalling threshold. Bitcoin Core 0.12.0 introduced opt-in RBF in February 2016. Thus '''BIP 68's consensus interpretation** and **BIP 125's relay signal''' arrived in overlapping periods while governing different behaviour. BIP 125 — spending-wallet policy · Bitcoin Core 0.12.0

That signal later lost its role as a required gate in Bitcoin Core's default replacement policy. Core 28.0 made full RBF the default in October 2024, so a higher-fee replacement could be considered regardless of the original transaction's opt-in signal. Core 29.0 removed the -mempoolfullrbf configuration option in April 2025. These were relay-policy changes, not revisions to BIP 68's consensus locktime encoding. Historical BIP 125 still documents the intent and rules of the original opt-in design; it is not a complete statement of all later mempool replacement checks. Bitcoin Core 28.0 release notes · Bitcoin Core 29.0 release notes

Reading common values

These examples apply to an individual input. '''Other inputs, transaction version, scripts, confirmation history and the software's mempool policy still matter.** The RBF descriptions here use the historical BIP 125 explicit signal, not a promise that an unconfirmed transaction will or will not be replaced today. BIP 125 · BIP 68

  • 0xffffffff: **final'''. If every input uses it, the transaction's absolute nLockTime can be bypassed. The BIP 68 disable bit is set, and this input does not opt in to BIP 125.
  • 0xfffffffe: one step below final. Can keep absolute nLockTime operative, disables BIP 68 age checks, and does not explicitly opt in to BIP 125.
  • 0xfffffffd: can keep absolute nLockTime operative and does explicitly opt in to BIP 125, while its set high bit disables BIP 68 age checks.
  • 0x00000090: if transaction version is at least 2 and the rules apply, expresses a 144-block relative minimum for this input. It also lies below the BIP 125 signal threshold.
  • 0x00400008: under BIP 68, encodes eight 512-second units (4,096 seconds) of relative time, measured using median time past, not a guaranteed 4,096-second wait on a human clock. It also explicitly signals under historical BIP 125.

Because BIP 68 reserves future space in the bit field, inventing meanings for the remaining bits is unsafe. A decoder should read the relevant bits, assess the transaction version, and then apply the consensus rules at the chain height being investigated. BIP 68 — specification

Why this matters to channel and asset history

For Bitcoin payment channels, a revision of an unconfirmed candidate, a pre-signed time-locked refund, and a confirmed output whose script enforces a relative delay describe three different commitments. Original sequence replacement was not itself a modern Lightning channel, and the 2016 CSV consensus upgrade was not another version of the old mempool rule. Lightning used relative delays in revocable settlement constructions because one participant might publish a commitment at an unpredictable future height. BIP 112 — bidirectional channel examples

For Ordinals and Bitmap, the difference is similarly practical. A wallet may show an unconfirmed inscription reveal or claim, but its input sequences cannot determine which conflicting transaction ultimately becomes Bitcoin history. Conversely, a genuine CSV lock can restrict when an output becomes spendable, but it does not assert what that output means to an external indexer. Confirmation order, scripts and the chosen application rules remain separate evidence.

An early asset protocol that also used sequence bits

Not every historic use of nSequence was a Bitcoin fee or timelock design. In November–December 2013, the experimental Bitfield-tagged color kernel (BFTC) assigned each bit of a colored input's sequence number to a transaction output index. The competing EPOBC kernel, implemented in February 2014, instead used the '''first input's** sequence value to encode genesis-versus-transfer and a padding exponent. Both conventions preceded the 2016 BIP 68 and BIP 125 deployments, and neither made its application meaning a Bitcoin consensus rule. BFTC contemporary design · EPOBC implementation

A collision becomes visible if the old BFTC interpretation is applied hypothetically to a later version-2 transaction: 0x00000010 would select output 4 under BFTC, yet would independently encode a 16-block relative age for that input under BIP 68 (after activation). Under the original BIP 125 opt-in policy, the same sequence also signalled replaceability in the mempool. These are **three different interpretations''', not evidence of a historical conflict in the 2013 wallet: BFTC was marked obsolete in February 2014 and no post-2016 BFTC use has been verified. The Bitfield-tagged color kernel article examines the worked source-level example and its separate bounds-check defect. Historical BFTC interpreter · BIP 68 · BIP 125

What the record proves

A source tag documents the fields and code path preserved in that version. The 2010 commit documents a specific replacement-policy suspension. A BIP documents a specified interpretation and an assigned proposal date. Core release notes document claimed rollout and activation milestones. None of those alone identifies a specific early sequence-replacement transaction or proves how many historical wallets used relative timelocks.

From the archivist's desk

This is one of those tiny Bitcoin fields that carried several generations of arguments. First it marked revisions that could be negotiated; later it helped constrain when coins could move; and then it became a public hint about how a pending transaction might be treated. The bytes stayed in the transaction while software, incentives and consensus accumulated around them.

It is tempting to call every one of those meanings finality. I think the history is clearer when we ask final according to whom, and enforced where?

Open question
Recover a reproducible early mainnet transaction or developer test that demonstrably exercised the pre-August-2010 sequence-based mempool replacement path, rather than inferring actual use from source code.
Open question
Trace which early Bitcoin wallets deliberately used non-final sequence numbers before BIP 68 and BIP 125, distinguishing released-wallet defaults from planned channel protocols.