Checking time onchain

Hi, I’m creating an auction smart contract with the possibility to set a start and an end to the auction. In the current version I used the round number for that. But as ther’s the possibility that the block time will deacrease to 2.5s that would led to auctions ending early. Is better to use timestamps for this?

1 Like

Yes, You should use timestamps rather than round height since the block times may change.

You should know that timestamps aren’t guaranteed to be exactly accurate since time is difficult to track in a distributed system but as long as you understand that it may be off by some number of seconds you should be able to design around it.


Yes Thanks, i used the round height just for the problem.