TeachMeBitcoin

The 500 Million Threshold

From TeachMeBitcoin, the free encyclopedia Reading time: 2 min

The 500 Million Threshold

A unique feature of the nLockTime field is that it can represent two completely different types of measurements: Block Heights or Unix Timestamps. The protocol distinguishes between them using a fixed threshold.

1. The Magic Number: 500,000,000

Bitcoin uses the number 500 million as the separator.

Case A: Block Height

If nLockTime is less than 500,000,000, it is interpreted as a Block Height.

Case B: Unix Timestamp

If nLockTime is greater than or equal to 500,000,000, it is interpreted as a Unix Timestamp (seconds since Jan 1, 1970).

2. Why this Threshold?

When Bitcoin was created, the current Unix time was already over 1.2 billion. Satoshi knew that the block height would not reach 500 million for thousands of years (at 10 minutes per block, 500 million blocks takes ~9,500 years). This allowed the protocol to "overload" a single 4-byte field with two different functions without risk of collision.

3. Comparison of Locks

nLockTime Value Interpretation Valid Date (Approx)
0 Immediate Now
750,000 Block Height ~2022
499,999,999 Block Height ~Year 11500
500,000,000 Unix Timestamp Jan 1985 (Retroactive)
1,600,000,000 Unix Timestamp Sept 2020

4. Median Time Past (MTP)

To prevent miners from manipulating their system clocks to "unlock" time-locked transactions early, Bitcoin uses Median Time Past (MTP). A timestamp-based lock is only considered reached if the median of the last 11 blocks is greater than the nLockTime.

In the next section, we will explore the mandatory Interaction with nSequence.

☕ 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!