babybitcoin.space

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.

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.

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

How to Create a Time-Locked Transaction

The exact steps depend on your wallet software. Not all wallets expose time lock features.

  1. 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.
  2. 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.
  3. Sign and broadcast normally. The transaction will appear in the mempool and remain there until the lock expires.
  4. 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.

Back to bitcoin