3

I'm trying to do some modification to a test contract and i want to do it valid until a period of time like defining

startingTime= 25/08/2017;
endingTime= 27/08/2017;

is this possible in some way and what type should i use? i already checked the block.timestamp thing and don't like much that function because of the miners influence on that.

  • Use block number, that's how they do for metropolis release and so on – smatthewenglish Aug 26 '17 at 11:30
  • Thank you for your time and answer, any source or example about that release maybe? – Erley Calle Aug 28 '17 at 13:41
4

If you're looking at something happening days in advance you should probably stop worrying and just use block.timestamp. See this discussion on how much you should worry about miner manipulation: Solidity: Timestamp dependency, is it possible to do safely?

If you're looking at an outcome within a few minutes, you should probably also require a minimum block.number, as block.timestamp is easily manipulated between blocks or over small numbers of blocks.

If you really need more confidence and/or precision than that, an alternative is to use some external timestamping service, but obviously that brings its own trust and security issues.

  • Thank you for your time and answer, i know what you are saying, only want to know if is there some other way to control this type of cases – Erley Calle Aug 28 '17 at 13:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.