Skip to content

[Clarity-4] block-time #6423

@obycode

Description

@obycode

block-time is a new Clarity keyword that returns the timestamp of the current
block in seconds since the Unix epoch. This is the same timestamp that is in the
block header, which is verified by the signers to be:

  • Greater than the timestamp of its parent block
  • At most 15 seconds into the future

This same timestamp can also be retrieved for previous blocks using
(get-stacks-block-info? time height), which exists since Clarity 3, but cannot
be used for the current block.

  • Output: uint
  • Example:
    (if (> block-time 1755820800)
      (print "after 2025-07-22")
      (print "before 2025-07-22"))

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Status: ✅ Done

Relationships

None yet

Development

No branches or pull requests

Issue actions