What is “nLockTime”?


just memo for nLockTime

What is nLockTime?

Bitcoin Wiki

nLockTime is a parameter that can be attached to a transaction, that mandates a minimal time (specified in either unix time or block height), that before this time, the transaction cannot be accepted into a block.

The block number or timestamp at which this transaction is locked:

Value Description
0 Not locked
< 500000000 Block number at which this transaction is locked | |>= 500000000 | UNIX timestamp at which this transaction is locked

If all TxIn inputs have final (0xffffffff) sequence numbers then lock_time is irrelevant. Otherwise, the transaction may not be added to a block until after lock_time (see NLockTime).

Stack Exchange

Mastering Bitcoin

Transaction Locktime
Locktime, also known as nLockTime from the variable name used in the reference client, defines the earliest time that a transaction is valid and can be relayed on the network or added to the blockchain. It is set to zero in most transactions to indicate immediate propagation and execution. If locktime is nonzero and below 500 million, it is interpreted as a block height, meaning the transaction is not valid and is not relayed or included in the blockchain prior to the specified block height. If it is above 500 million, it is interpreted as a Unix Epoch timestamp (seconds since Jan-1-1970) and the transaction is not valid prior to the specified time. Transactions with locktime specifying a future block or time must be held by the originating system and transmitted to the bitcoin network only after they become valid. The use of locktime is equivalent to postdating a paper check.

Developer Guide


What is “Sequence Number”?


Part of all transactions. A number intended to allow unconfirmed time-locked transactions to be updated before being finalized; not currently used except to disable locktime in a transaction

Stack Exchange

Sequence numbers are intended to be used for replacement. Replacement is currently disabled, but how it would work is:

You send a transaction with a LockTime in the future and a sequence number of 0. The transaction is then not considered by the network to be “final”, and it can’t be included in a block until the specified LockTime is reached.
Before LockTime expires, you can replace the transaction with as many new versions as you want. Newer versions have higher sequence numbers.
If you ever want to lock the transaction permanently, you can set the sequence number to UINT_MAX. Then the transaction is considered to be final, even if LockTime has not been reached.


OP_CHECKLOCKTIMEVERIFY is not released yet.











図解即戦力 ブロックチェーンのしくみと開発がこれ1冊でしっかりわかる教科書

ブロックチェーン イーサリアムへの入り口 第二版 (ブロックチェーン技術書籍)