What Is a Time-Locked Bitcoin Transaction and How Does It Work?
A time-locked Bitcoin transaction is one that cannot be confirmed until a specific future time or block height. The Bitcoin network enforces the delay automatically, and no single party can override it. Time locks let you send bitcoin that the recipient cannot spend until a date you choose, or create transactions that only become valid if certain conditions are met by a deadline.
How time locks work in bitcoin
Bitcoin has two types of time locks, both built into the transaction protocol. They operate at different levels of the transaction.
Absolute time locks (locktime)
Every Bitcoin transaction contains a field called locktime. By default, this field is set to zero, meaning the transaction can be confirmed immediately. If you set it to a future block height or a Unix timestamp, miners will not include the transaction in a block until that time has passed.
- Block height lock: The transaction becomes spendable only after a specific block number is reached. For example, setting locktime to block 900,000 means the transaction cannot be confirmed until that block exists on the blockchain.
- Timestamp lock: The transaction becomes spendable only after a specific Unix timestamp. The network considers timestamps reliable because miners must include a valid time in each block header.
A transaction with a non-zero locktime can still be broadcast immediately. Nodes and miners will reject it from inclusion until the condition is met, but they will relay it. The transaction sits in the mempool until the lock expires.
Relative time locks (checksequenceverify)
Relative time locks restrict how long a specific output must wait before it can be spent, measured from when that output was first confirmed. Bitcoin implements this with an opcode called OP_CHECKSEQUENCEVERIFY (CSV) and a transaction field called nSequence.
- Block-based CSV: The output cannot be spent until a set number of new blocks have been mined after the transaction that created it.
- Time-based CSV: The output cannot be spent until a set number of seconds have passed since the confirming block's median time.
Relative locks are commonly used in payment channels and vaults, where you want a delay after a transaction appears before the funds can move again.
Practical uses for time-locked transactions
1. Payment Channels and the Lightning Network
Time locks are essential for Lightning Network channels. When you open a channel, both parties sign a funding transaction with a relative time lock on their refund path. If one party disappears, the other can close the channel unilaterally, but must wait for the time lock to expire before they can claim their funds. This prevents one side from broadcasting an old state.
2. Inheritance and Estate Planning
You can create a transaction that sends bitcoin to a trusted heir, locked until a future date. You retain access until then. If you are still alive, you can move the funds before the lock expires, effectively cancelling the inheritance plan. If you do not, the heir can broadcast the pre-signed transaction after the time lock ends.
3. Escrow and Conditional Payments
Time locks let you set a deadline. For example, you can send bitcoin to a multisignature address with a time-locked refund. If the other party does not release the funds within a set time, you can claim them back. This removes the need to trust a third party.
4. Vaults and Theft Protection
A vault uses a relative time lock on a "hot" wallet address. If an attacker steals the private key and tries to move funds, the transaction triggers a time lock. During that delay, you can use a recovery key to move the bitcoin to a safe address before the attacker can finalise the theft.
Limitations and Risks
- Non-refundable by design: Once you broadcast a time-locked transaction, you cannot cancel it. If you set the lock incorrectly, the funds may be stuck until the lock expires. There is no "undo" button.
- Mempool expiry: Nodes may drop a transaction from their mempool if it sits there too long before the lock expires. You may need to rebroadcast it when the lock time approaches.
- Fee estimation is critical: You set the fee when you sign the transaction. If the lock is far in the future, the fee you chose may be too low by the time the transaction becomes valid. The transaction could get stuck indefinitely.
- No enforcement by miners: Miners follow the consensus rules. If your transaction meets the lock condition, they may include it. If it does not, they will not. There is no appeal.
How to Create a Time-Locked Transaction
The exact steps depend on your wallet software. Not all wallets expose time lock features.
- Choose a wallet that supports locktime. Some desktop wallets and advanced mobile wallets let you set a block height or timestamp when creating a transaction.
- Set the locktime value. If you want the transaction valid at block 900,000, enter that number. If you want a date, convert it to a Unix timestamp and enter that.
- Sign and broadcast normally. The transaction will appear in the mempool and remain there until the lock expires.
- Monitor the mempool. If the transaction gets dropped, rebroadcast it when the lock time is near.
For relative time locks, you need a wallet that supports OP_CHECKSEQUENCEVERIFY and lets you set the nSequence field. This is more common in Lightning wallets and specialised vault software.
The Bottom Line
Time-locked transactions are a mechanism for delaying when bitcoin can be spent. The delay is enforced by the network, not by any person or company. They are useful for inheritance, escrow, payment channels, and theft protection, but require careful planning. Mistakes with locktime values or fees can make funds temporarily inaccessible, so test the feature with small amounts before relying on it.
Not financial advice. babybitcoin.space publishes market data and general information about babybitcoin. Crypto assets are volatile and you can lose everything you put in. Nothing here is a recommendation to buy, sell or hold, and we make no price predictions.
Prices are sourced from third parties and may be delayed or wrong. Verify anything you intend to act on against a primary source.