Skip to content
buybitcoinsmart

Glossary / Transactions & fees

Sequence number

Also known as nSequence.

Definition
The sequence number is a four byte field on every transaction input that signals fee replacement, switches locktime on, and can encode a relative timelock.

Specified in BIP-68.

Three unrelated jobs share one field because bitcoin could not afford to add another. Satoshi's original plan for it, a crude payment channel where each new version raised the number, was abandoned around 2010 because no rule forced miners to prefer the higher one. What survived is a set of magic values that decide how your wallet's transactions behave.

How it works

Reading a sequence number means checking it against three separate rules, in order of how old they are.

The final value. A sequence of 0xffffffff, decimal 4,294,967,295, marks an input as final. If every input in a transaction is final, the locktime field is ignored completely. This was the default in early wallets and is still what you see on transactions built by software that has never thought about the field.

The replacement signal. BIP125 assigned meaning to the low end of the range: any input set to 0xfffffffd or below advertises that the sender may replace the transaction with a higher paying version. The value 0xfffffffe threads the needle, enabling locktime while withholding the replacement signal. That distinction has lost most of its force, because Bitcoin Core has relayed replacements regardless of the signal since version 28.0 in October 2024.

The relative timelock. BIP68 reinterpreted the low bits for transactions that declare version 2 or higher, and the rule became enforceable at block 419,328 in July 2016. When bit 31 is clear, the bottom 16 bits state how much time must pass after the input's own coin was confirmed. Bit 22 selects the unit: clear means blocks, so a maximum of 65,535 blocks or roughly 455 days, and set means periods of 512 seconds, giving a ceiling near 388 days. The clock starts at the parent's confirmation, not at any fixed date, which is exactly what a contract between two people needs.

Where you see it

The sequence number shows up as a column in raw transaction dumps and as a checkbox in wallet software, and the two views rarely use the same words.

A block explorer that decodes inputs will print values like 4294967293 next to each one. That is 0xfffffffd, and it tells you the wallet built a replaceable transaction. Bitcoin Core's decoderawtransaction shows the same figure, and Sparrow and Electrum expose it behind a "replace by fee" toggle rather than as a number.

Lightning is the heaviest real user. A channel's revocation delay, the window during which your counterparty can be punished for publishing an old state, is a relative timelock enforced through this field on the commitment transaction's input. The same mechanism underpins submarine swaps, vault designs and any contract where a refund path has to become available only after the other party has had a fair chance to act.

Sequence number vs locktime

Sequence numbers are per input; locktime is per transaction. That is the fastest way to keep them apart, and it explains why the two are used for different things.

Locktime sets one absolute deadline for the entire transaction, expressed as a block height or a wall clock time, and it applies whether the coins being spent are a day old or five years old. A relative timelock in a sequence number measures from the confirmation of the specific coin that input is spending, so each input can carry its own waiting period and the same script works no matter when it is funded. The two also depend on each other in an awkward way: locktime is only enforced when at least one sequence number is below the final value, so a wallet that sets everything to 0xffffffff quietly disables the other field.

Not to be confused with

Frequently asked questions

What does a sequence number of 4294967293 mean?

It is 0xfffffffd, the value wallets use to signal that a transaction may be replaced by a higher paying version. It also leaves locktime enforcement switched on, which is why most modern wallets pick it by default.

Is a relative timelock the same as a locktime?

No. A relative timelock in a sequence number counts from the confirmation of the coin being spent, so it starts whenever that coin was mined. Locktime names one fixed block height or date for the whole transaction.

Related terms

More in Transactions & fees