คลังคำศัพท์

Timelock/Locktime

Moderate

A condition for a transaction to only be processed at a certain time or block on the blockchain.

What Is a Timelock/Locktime?

Timelock can be considered as a schedule by which cryptocurrency transactions are processed by miners on the blockchain. 

Based on the block height approved by miners, transactions will be included in the Merkle Tree. 

Transactions are only approved once this is done. 

Timelocks were initially added by the cryptocurrency Bitcoin’s inventor Satoshi Nakamoto. 

The purpose was for this to be present in all transactions. 

The default blocking time is 0x00000000 (0). 

Timelocks ensure transactions are not verified unless a certain time or block height is reached. 

Timelocks can be absolute or time relative. 

Absolute timelocks ensure blocks are defined relative to a certain time. 

Time-relative timelocks are in place to determine how much time must elapse before transactions can be verified. 

Time can be measured in two following ways in Bitcoin transactions. These are according to the transaction’s block number and its timestamp. 

Miners will receive a specific block number once a timelock is determined based on a block number. 

For timelocks which are based on timestamps, miners must wait until the specific time period has elapsed before confirming the transaction. 

Unix time is used to measure this. 

There are four ways to determine timeblocks for Bitcoin. Half of these are the transaction level meanwhile the other half are on script level. 

These are: nSequence, nLocktime, CheckLockTimeVerify, CheckSquenceVerify. 

nLockTime involves absolute blocking at transaction level. 

nSequence is a timelock relative to transaction levels. 

CheckLockTimeVerify involves absolute time blocking at script level. 

CheckSquenceVerify is a time lock relative to script level.