The Time Locks: CheckLockTimeVerify and Sequence Rules
The Time Locks: CheckLockTimeVerify and Sequence Rules
Bitcoin is not just about "Space" (who owns what); it is also about Time. You can send a transaction that cannot be spent until a certain date or until a certain number of blocks have passed. These are called Time Locks. It’s like a trust fund that only opens when you turn 18. This allows for complex financial contracts like "Payment Channels" (the Lightning Network). It is the "Programmability of the Future." It is the "Time-Machine of Money." It is the "Architecture of the After." It is the "Will of the Wait." It is the "Contract of the Calendar." It is the "Patience of the Program."
The CheckSequence Logic
In src/script/interpreter.cpp, the node checks the "Watch" on the transaction. It says: "Is it late enough to spend this money yet?" If the answer is "No," the node throws the transaction back and says: "Come back later!" It is the "Guardian of the Garden." It is the "Warden of the Wait." It is the "Sentinel of the Second."
/**
* Ensures that a transaction cannot be spent until a certain time has passed.
* This is the foundation of smart contracts in Bitcoin.
*/
bool CheckSequence(const CScriptNum& nSequence, int nHeight, int64_t nTime)
{
// Checking the "Maturity" of the transaction.
// "Has it been 1,000 blocks since this money was received?"
if (!IsMatured(nSequence, nHeight, nTime)) return false;
return true;
}
Explaining the Code: The Warden of Time
-
nSequence: This is the "Timer" set by the sender. It can represent "Blocks" (e.g., 144 blocks = 1 day) or "Seconds." It is the "Will of the Past" controlling the "Action of the Present." It is the "Echo of the Earlier." It is the "Injunction of the Init." It is the "Mandate of the Memory." -
IsMatured: The node looks at the current "Block Height" and the "Median Time Past." If the criteria are met, the money is "Ripe" and can be harvested. If not, it stays locked in the digital vault. It is the "Patience of the Protocol." It is the "Wisdom of the Wait." It is the "Fruit of the Future." It is the "Harvest of the History."
TeachMeBitcoin is an ad-free, open-source educational repository curated by a passionate team of Bitcoin researchers and educators for public benefit. If you found our articles helpful, please consider supporting our hosting and ongoing content updates with a clean donation: