BITCOIN MAINNETLive explorer status
HOW MONEY MOVES

Locktime and sequence

Locktime stops a transaction confirming before a set block or time; sequence numbers enable RBF and relative timelocks. Learn how both work.

Locktime: "not before"

Every transaction has a 4-byte locktime field.

Locktime valueMeaning
0No restriction
Below 500,000,000A block height: can't be mined before this block
500,000,000 or moreA Unix timestamp: can't be mined before this time
A transaction with locktime can't be confirmed before its unlock point🔒 cannot be spent yetunlocks at block 900,000now
A transaction with locktime can't be confirmed before its unlock point

Locktime is only enforced if at least one input's sequence is not 0xffffffff.

Anti fee sniping

Many wallets set locktime to the current block height. This makes it slightly less attractive for a miner to rewrite the last block to steal its fees, because your transaction can't move into an earlier block.

Sequence: per input

Each input has a 4-byte sequence field. Today it is used for:

  • Signalling RBF (any value below 0xfffffffe).
  • Relative timelocks (BIP 68): "this input can't be spent until N blocks after the output it spends was confirmed". Used by CSV scripts and the The Lightning Network.

Quick reference

FieldValueMeaning
nLockTime0No restriction
nLockTime900000Not before block 900,000
nLockTime1900000000Not before that Unix time (2030)
nSequence0xffffffffFinal: disables locktime for this input
nSequence0xfffffffdSignals RBF, locktime enforced
nSequence144 (with bit 22 clear)Relative lock: 144 blocks after confirmation

Relative locks use the lower 16 bits as the count; bit 22 switches the unit from blocks to 512-second intervals.

Share this guide
Share on X ↗

Key takeaways

  • Locktime prevents confirmation before a given height or time.
  • Values under 500 million are heights; larger values are timestamps.
  • Sequence numbers enable RBF signalling and relative timelocks.

Common questions

Why does my wallet set a locktime I didn't ask for?

It's probably anti fee sniping: setting locktime to the current height is harmless and slightly improves security.

What's the difference between locktime and CLTV?

Locktime restricts the whole transaction. CLTV is a script rule that restricts when a specific output can be spent.

Can I schedule a Bitcoin payment for the future?

You can sign a transaction with a future locktime, but someone must broadcast it after that time, and you could spend the coins elsewhere before then.

What is a relative timelock?

A lock counted from when the spent output was confirmed, rather than from a fixed date.