A parameter in a transaction that specifies when it can be added to the blockchain.
Locktime is a parameter in a Bitcoin transaction that specifies the earliest time or earliest block height at which the transaction can be added to the blockchain. It's a mechanism that allows users to post-date transactions, making them spendable only after a certain time or block height is reached. Locktime is part of Bitcoin's original design and has been inherited by many Bitcoin-derived cryptocurrencies.
"A transaction with a locktime set to block number 700,000 will remain unconfirmed until the Bitcoin blockchain reaches that block height."
"In both Bitcoin and Bitcoin Cash, you can create a transaction that transfers funds to someone else but won't be valid until a specific date in the future by using the locktime parameter."
In the Bitcoin transaction format, locktime is a 32-bit field that can represent either a block height (if the value is less than 500 million) or a Unix timestamp (if the value is 500 million or greater). When a locktime is specified, all transaction inputs must have a sequence number below the maximum value (0xFFFFFFFF), or the locktime will be ignored.
"A locktime value of 1663000000 would correspond to a Unix timestamp (September 12, 2022), while a value of 750000 would refer to block height 750,000."
"When creating time-locked transactions on Bitcoin Cash, developers must be aware that the sequence numbers of inputs interact with the locktime field to determine if the time constraint is enforced."
Locktime is often used in second layer protocols, where funds are locked up for a certain period. It encourages cooperation among participants by imposing penalties on bad actors through complex locktime contracts. This is particularly important in payment channel networks and other multi-party protocols.
"In the Lightning Network, a type of second layer protocol, locktime is used in Hashed Timelock Contracts (HTLCs) to ensure that all parties cooperate during the routing of payments."
"Similar locktime mechanisms are employed in other payment channel solutions to provide cryptographic guarantees that funds will be returned to the original owner after a specified time if the channel is not properly closed."
Locktime can also be used to put money in escrow until a specified time or condition is met. This ensures that the funds cannot be moved until an agreed-upon time, or they can be released if a pending multi-signature contract isn't fulfilled within the given time. This enables trustless time-bound agreements on the blockchain.
"In a trustless exchange between multiple parties, locktime can be used to ensure that if either side fails to fulfill their part of the deal, the respective funds are returned to each party."
"When creating a crowdfunding campaign on Bitcoin Cash, developers can use locktime to automatically return funds to donors if the campaign doesn't reach its goal by a specific date, eliminating the need for a trusted third party."
While locktime specifies when a transaction can be included in the blockchain, related but distinct mechanisms like Check Lock Time Verify (CLTV) and Check Sequence Verify (CSV) allow for more complex time-based conditions within scripts. These mechanisms enhance the programmability of time-based conditions in cryptocurrencies.
"Unlike a simple locktime, which applies to the entire transaction, CLTV allows specific outputs to be locked until a certain time or block height is reached, enabling more granular control."
"Bitcoin Cash supports both absolute timelocks (via locktime and CLTV) and relative timelocks (via CSV), giving developers flexibility when creating time-sensitive smart contracts."
Locktime provides important security benefits by allowing users to create transactions that aren't immediately valid. This can be useful in creating backup recovery plans or in preventing certain types of theft where immediate transaction broadcast would be harmful.
"A business might prepare backup recovery transactions with locktime set to a future date, allowing recovery of funds if primary key holders become unavailable, while preventing immediate use of these backup transactions under normal circumstances."
"When combined with multi-signature wallets, locktime can create sophisticated security setups where funds require both multiple signatures and a waiting period before they can be moved, significantly enhancing protection against theft."
All terms and definitions may update as the Cryptionary improves.