In the "Freezing funds until a time in the future" example here https://en.bitcoin.it/wiki/Script it mentions that the "Top stack item is checked against the current time or block height"

Does this mean that the stack has access to variables such as the current block height and time? Or is this incorrect on the wiki. I understand when CTLV is used in conjunction with nlocktime and they are checked against each other. But when nlocktime is used alone, is their a stack operation which pulls the current block time from the system?

If so, what other system level variables does the stack have access to?

1 Answer 1


That description is incorrect. There is no way to access the current time or height from within the Script language.

Instead, there is a level of indirection:

  • A transactions nLockTime or nSequence enforces an absolute or relative locktime on the transaction.
  • The OP_CHECKLOCKTIMEVERIFY and OP_SEQUENCEVERIFY opcodes inside script compare the top stack element with the transaction's nLockTime or nSequence value.

Functionally, together these constructions do let you effectively write scripts that can enforce time constraints. E.g. a script using OP_CHECKLOCKTIMEVERIFY can require the nLockTime of the spending transaction to be at least N, and thereby indirectly force the transaction to not be minable until N has passed.

The advantage of this split is that transaction script validity is a single boolean value that only needs to be verified once: a transaction's script validity is either always valid or always invalid.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.