Glossary | Locktime

Locktime nLockTime

Setting a locktime is like post-dating a bitcoin transaction

Locktime sets the eariest time a transaction can be mined in to a block.

It's the last field in a piece of transaction data.


You can use locktime to make sure that a transaction is locked until a specific block height, or a point in time.

Locktime Description
< 500000000 Unlocked at block height.
>= 500000000 Unlocked at specific time (in Unix time)

If you do not want your transaction to be locked until a specific block or time, set the locktime field to 0x00000000 (or anything below the current block height or unix time).

Nodes validate every transaction (and block) they receive. So if they receive a transaction (or a block containing a transaction) with a locktime in the future, they will reject it.


Most transactions do not make use of locktime, so their locktime is set to 0x00000000.


Locktime Decimal Descrpition
0xede80600 452845 This transaction could only be relayed on the network after the blockchain reached a height of 452,845. (tx)
0x06241559 1494557702 This is Fri, 12 May 2017 02:55:02 in Unix Time. The transaction could only be relayed on the network after the median time of the last 11 blocks (according to the time field in their block headers) is greater than this. (tx)
0xb154c233 868373681 This is Tue, 08 Jul 1997 14:54:41 in Unix Time. This is effectively like setting the locktime to 0x00000000, as the first ever block was mined on 02 Feb 2011 23:16:42. (tx)


In order for the locktime to be effective, you need to set one of the sequence values (for one of the inputs in the transaction data) to anything below the defaut maximum (0xffffffff).

Unix Time is the number of seconds since 1st January 1970.

As mentioned, the locktime has a dual-purpose for setting either a block height or time. This works because:

  • It's going to take 9,503 years before we hit block 500,000,000.
  • The current unix time is 1,498,392,420 (also known as 25 June 2017, 13:07:00), which is already above 500,000,000.


Source Code