27

I would like to set a timer like

uint timeout = now + 1 year;

Is it possible that a miner cheats the timestamp of the block that it's included more then let's say a month.

So if I need roughly 1 year until timeout (+/- one month) would that be safe?

And is block.timestamp serenity-proof?

1

2 Answers 2

26

Yes, you can guarantee long run time accuracy. Miners can't cheat that much to change the timestamp over days. Blocktime is adjusted to be constant within certain error margins, and timestamps is guaranteed to be rejected if they are excessive. Serenity and PoS 'proven' until core team decides otherwise. It is very very unlikely to happen, what reason could they possibly have? Its a feature not a bug.

16

The miner could cheat in the timestamp by a tolerance of 900 seconds. so if you check outside this intervall you are safe.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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