MASTERING-BITCOIN ยท Unit 6 ยท Video 3 ยท Interactive Practice
| Concept | Encoding | Meaning |
|---|---|---|
| Final | 0xFFFFFFFF |
No replacement, no timelock |
| RBF disable, timelock disable | 0xFFFFFFFE |
One below max โ reserved |
| Classic BIP 125 RBF signal | 0xFFFFFFFD |
Replaceable, no timelock |
| BIP 68 disable flag | bit 31 = 1 | Timelock OFF for this input |
| BIP 68 type flag | bit 22 = 0 / 1 | Blocks / 512-second multiples |
| BIP 68 lock value | bits 15..0 | Up to 65,535 units |
| Time-mode unit | 512 seconds | โ 8.5 minutes per unit |
The sequence field is a packed bitfield โ different bits carry different meanings. Pick a sequence value below and watch how the network interprets it.
Conceptual question: What information does a single 32-bit number actually communicate to Bitcoin nodes?
โ interactive visualization โ coming to this page format soon
Notice: the same four bytes change role entirely depending on a few key bits. 0xFFFFFFFD and 0x0000001E differ by billions in numeric value, but the network reads them as fundamentally different instructions.
Build your own relative timelock. Pick a mode (blocks or time) and a lock value, and watch the encoded sequence value emerge โ along with the real-world delay it imposes.
Conceptual question: Why does the time-mode unit of 512 seconds matter, and what's the tradeoff against block-mode?
โ interactive visualization โ coming to this page format soon
Reflect: Try setting the lock value to 65535 in both modes. The block mode caps near 455 days; time mode caps near 388 days. Both modes deliberately top out around one year โ that's the maximum relative lock Bitcoin's consensus rules allow on a single input.
Question 1
A wallet wants to broadcast a transaction that signals classic BIP 125 opt-in replace-by-fee while keeping all timelock features disabled. Which sequence value should it set on its input?
โ
Correct! 0xFFFFFFFD signals RBF while keeping timelocks disabled (bit 31 set).
โ Not quite. Remember: RBF is signaled when sequence is strictly less than 0xFFFFFFFE, and 0xFFFFFFFE itself is reserved.
Solution:
BIP 125 says a transaction signals replaceability if any input has sequence below 0xFFFFFFFE. The standard choice is 0xFFFFFFFD โ the maximum minus two.
0xFFFFFFFF is final (not replaceable).0xFFFFFFFE is reserved for "no RBF, timelock disabled" โ it does not signal RBF.0xFFFFFFFD is the classic BIP 125 signal: bit 31 is set, so the BIP 68 relative timelock disable flag is on, but the value is below the BIP 125 threshold so RBF is signaled.0x00000000 would signal RBF and activate a relative timelock (bit 31 = 0).Question 2
In a BIP 68 relative timelock, what role does bit 22 of the sequence field play?
โ Correct! Bit 22 is the type flag selecting block-based vs. time-based locks.
โ Not quite. The disable flag is bit 31, not bit 22. Bit 22 picks the unit of the lock.
Solution:
BIP 68 partitions the 32-bit sequence field as follows:
So bit 22 chooses between counting blocks or counting 512-second time units.
Question 3
A transaction input has sequence value 0x00400007. Bit 31 is 0 (timelock active), bit 22 is 1 (time mode), and the lower 16 bits hold the value 7.
Approximately how long after the funding output is confirmed does this input become spendable?
โ Correct! 7 ร 512 s = 3,584 s โ 1 hour.
โ Not quite. Each time-mode unit is 512 seconds, not 1 second or 1 minute. Multiply 7 ร 512 to get the delay in seconds.
Solution:
In time mode, each unit equals 512 seconds.
So the input becomes spendable about one hour after its funding output is confirmed. This is exactly the encoding shown in the video for a "one-hour time lock."
Question 4
True or False: A relative timelock (BIP 68) and an absolute timelock (nLockTime) measure the same kind of delay โ they both lock a transaction until a specific block height or calendar date.
โ Correct! Absolute timelocks pin to a fixed point; relative timelocks count from confirmation and are per-input.
โ Not quite. A relative timelock starts counting from the moment the funding output is confirmed โ it is not a fixed calendar date.
Solution:
False. The two locks measure fundamentally different things:
nLockTime (absolute): a transaction-level field. The lock points to a specific block height or Unix timestamp โ e.g., "not before block 700,000." It is the same for everyone, regardless of when the inputs were confirmed.Both can coexist in the same transaction, but they are independent mechanisms.
Solved: 0 / 4