TECHNICAL_DOC // BLOCK / TIME
TIME
The time-field-header-offset-68/">time field is a 4-byte Unix timestamp in the block-header/">block header representing
when the miner claims the block was produced. It is used in difficulty retargeting
calculations and enforced by two consensus rules: the block time must exceed the
Median Time Past (MTP) and must not be more than 2 hours ahead
of the receiving node's clock.
TIME_FIELD_RULES
CONSENSUS VALIDITY RULES FOR BLOCK TIME
Block header time field: 4 bytes, uint32, little-endian
Range: 0 to 2^32-1 (valid until year 2106)
Rule 1 — Must exceed Median Time Past (MTP):
MTP = median of last 11 block timestamps
block.time > MTP ← required
Why MTP: prevents miners from lying about time
to game timelocks (CLTV/CSV). Monotonically
non-decreasing in practice (hard to manipulate).
Rule 2 — Must not be too far in the future:
block.time ≤ node_clock + 7200 seconds (2 hours)
Nodes reject blocks timestamped more than 2 hours
into the future relative to their own clock.
Note: time can go backwards between consecutive blocks
as long as each block exceeds MTP.
Time in Timelocks — CLTV and CSV
SCRIPT OPCODES
Bitcoin's two timelock opcodes use block time (and block height) to enforce spending conditions. MTP is used specifically to prevent miner manipulation of time-based locks.
OP_CHECKLOCKTIMEVERIFY (CLTV, BIP 65):
Locks output until: block height OR Unix timestamp
Uses: MTP of current chain tip (not block.time directly)
nLockTime in tx must match the CLTV value
OP_CHECKSEQUENCEVERIFY (CSV, BIP 112):
Locks relative to when UTXO was mined
Uses: block height delta OR MTP delta
nSequence in input must encode the CSV value
Genesis block time:
1231006505 = 2009-01-03 18:15:05 UTC
(Encodes "The Times 03/Jan/2009 Chancellor on brink...")
Block time is also miner-adjustable (within rules), which
is why it appears as a small miner-controlled nonce field
in some ASIC firmware implementations.
TERMINOLOGY_INDEX
Time Field
4-byte Unix timestamp in the block header. Set by the miner. Subject to MTP and future-clock rules.
Median Time Past (MTP)
Median of the last 11 block timestamps. Block time must exceed MTP. Used by timelocks.
Unix Timestamp
Seconds elapsed since January 1, 1970 00:00:00 UTC. Standard time representation in Bitcoin.
2-Hour Rule
Nodes reject blocks timestamped more than 7200 seconds ahead of their local clock.