Time-Lock
What Is a Time-Lock?
A time-lock is a programmable rule used in some blockchain transactions or scripts to delay when funds can be spent. In Bitcoin, time-locks are commonly used to make a transaction or output spendable only after a specified block height, timestamp, or relative waiting period. The constraint applies only when the funds are actually locked by the relevant script or transaction rule; not all transactions are subject to a time-lock by default.
Time-locks can add a security delay, which may help in recovery-oriented wallet designs or staged spending arrangements. While they do not stop an attacker from attempting a transaction, they can prevent the immediate movement of funds until the lock condition is satisfied.
How Does a Time-Lock Work?
Time-locks generally come in two forms, depending on the rules of the specific blockchain:
- Absolute Time-Locks: These require a transaction to wait until a specific block height or timestamp.
- Relative Time-Locks: These require a certain number of blocks or time to pass after a referenced event, such as the confirmation of a prior output.
In Bitcoin, the precise behavior depends on the script or transaction rule used, such as nLockTime, CheckLockTimeVerify, or CheckSequenceVerify. The lock parameters should be checked carefully before funds are sent to such an address or contract.
Security Use Cases
Time-locks are a foundational tool for designing sophisticated, multi-layered security strategies:
- Staged Spending: You can use time-locks to restrict access to funds for a defined period, though actual enforcement depends on the script design and whether the funds are properly locked by the relevant rule.
- Delayed Execution: In some script designs, a time-lock can prevent the immediate movement of locked funds, creating a window that may allow a legitimate owner to respond depending on how the script is constructed.
By separating the act of signing from the ability to spend, time-locks allow users to move beyond simple transfers and build robust, delayed-spend arrangements for long-term asset management.