Skip to content
Kriptofoni
Crypto GlossaryBlockchain & Technology

What Is Timelock?

Also known as: Time-lock, Timelock Contract, Time Lock

In short

A timelock is a mechanism that prevents a transaction or smart contract action from being executed until a specific time or block height is reached. It is used for security in Bitcoin scripts, payment channels and DeFi governance.

In Bitcoin, timelocks are applied in two forms. Absolute timelocks ensure that an output cannot be spent before a certain date or block height; the nLockTime field at the transaction level and OP_CHECKLOCKTIMEVERIFY, added with BIP 65, at the script level serve this purpose. Relative timelocks ensure that an output can be spent only a set time after the transaction that created it has entered a block; OP_CHECKSEQUENCEVERIFY, introduced with BIP 112, is used for this purpose.

These tools form the basis of payment channels such as the Lightning Network and of hash time-locked contracts (HTLCs): if the counterparty does not cooperate, the user can reclaim their funds after a set period. Atomic swaps also work on the same logic. In DeFi protocols on Ethereum, changes approved through governance are applied through a timelock contract after a waiting period of, for example, a few days. This period allows users to withdraw their funds before a change they find harmful takes effect. Token vesting and locked liquidity are also implemented with timelocks.

A timelock trades away flexibility: when an urgent vulnerability is found, the waiting period can delay the fix. For this reason, some protocols also define emergency mechanisms with limited powers.

Last updated: · This content is for information purposes only and is not investment advice.

Related terms