TeachMeBitcoin

The Sequence Field Overview

From TeachMeBitcoin, the free encyclopedia Reading time: 2 min

The 4-Byte Sequence Field

Every input in a Bitcoin transaction contains a 4-byte field called nSequence. While often overlooked, this field is the foundation for advanced features like Replace-By-Fee (RBF) and the Lightning Network.

1. Original Purpose

Satoshi Nakamoto originally intended the Sequence field to be used for "High-Frequency Trades" (the first concept of payment channels).

2. Modern Purpose

Today, the Sequence field has been repurposed for three main features:

  1. Enabling Locktime: If all sequence numbers in a transaction are 0xffffffff, the nLockTime field is ignored.

  2. Replace-By-Fee (RBF): Signaling that a transaction in the mempool can be replaced with a higher-fee version.

  3. Relative Timelocks: Locking an input based on the age of the coins being spent.

3. Data Format

The field is a 4-byte Unsigned Integer (uint32) stored in Little-Endian.

4. The RBF Threshold

Any sequence value less than 0xffffffff is generally treated by modern nodes as a signal that the transaction is "malleable" or replaceable while it is still in the mempool.

Property Value
Size 4 Bytes
Storage Little-Endian
Logic Input-level
Scope Mempool replacement \u0026 Timelocks

In the next section, we will explore the mechanics of Replace-By-Fee (RBF).

☕ Help support TeachMeBitcoin

TeachMeBitcoin is an ad-free, open-source educational repository curated by a passionate team of Bitcoin researchers and educators for public benefit. If you found our articles helpful, please consider supporting our hosting and ongoing content updates with a clean donation:

Ethereum: 0x578417C51783663D8A6A811B3544E1f779D39A85
Bitcoin: bc1q77k9e95rn669kpzyjr8ke9w95zhk7pa5s63qzz
Solana: 4ycT2ayqeMucixj3wS8Ay8Tq9NRDYRPKYbj3UGESyQ4J
Address copied to clipboard!