Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • I think most contracts chose this option and accepted to expose themselves to the fluctuation because it is better than block.timestamp as miners can change timestamp. So what's your alternative ? Commented Jun 7, 2019 at 9:03
  • 1
    @KevinWad Miners can influence block.timestamp, but only by a few seconds up and down. It's not like they can make the timestamp 12 hours in the future, or 12 hours in the past. block.timestamp is a lot better for time-dependent code than block.number Commented Jun 7, 2019 at 9:21
  • @JesseBusman thanks. In fact I always read "block number is a much better substitute for time-dependent computation" but I did not realize it was only for applications that are relying on under 30 seconds margin. For anyone dealing with this dilema you can check medium.com/@phillipgoldberg/… " a general rule of thumb is your contract can tolerate a 30-second timestamp variation and maintain integrity, then it is safe to use a timestamp." Commented Jun 7, 2019 at 9:36
  • @KevinWad It is a common misunderstanding. Please mark the answer correct if you think this has solved your issue. Commented Jun 7, 2019 at 10:45