Trying to get some insight as to whether or not it's more optimal to call block.timestamp repeatedly for comparisons or to set a (memory) variable to hold the value and use it instead.

I've looked at the gas cost table here:


but am not certain about where block.timestamp fits in.

1 Answer 1


The TIMESTAMP op code costs 2 gas, according to the yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), Appendix G and Appendix H.

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.