In a contract, when I execute block.timestamp what is exactly this value?

Is it:

  • The time the block was created?
  • The time the block was mined?
  • The time the execution is being run?
  • Anything else?

The documentation says: current block timestamp as seconds since unix epoch, but I don't what current block exactly means. I'd like to know precisely what is the timestamp!

Thanks in advance!

3 Answers 3


From the ethereum documentation

reference: https://ethereum.org/en/developers/docs/blocks/#block-anatomy.

It is the time the block was mined, as you can find in the link to the official documentation above.

  • What I find interesting is that when a transaction has a pre-requisite in the form of block.timestamp >= someTimeStamp This validation needs to happen before the block is actually mined, right? So how can it have the actual mined at timestamp if it hasn't actually happened yet?
    – manija
    Feb 4, 2022 at 22:59
  • But validating the transaction is not the same as executing the transaction. Validating the transaction is verifying that the signatures are correct, it does not need to execute the functions. Feb 4, 2022 at 23:13

It is whatever the miner decide. The consensus protocol define certain conditions it has to be monotonically increasing and not too far in the future.

Outside those conditions the miner has the freedom to choose the timestamp.


Well, the timestamp is set before the block mining process starts (Block header hash calculation), so... it is set when the block is created, but the miner has much freedom for this time.

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.