2

E.g: uint8, uint16, uint32, uint64, uint128, uint256? Which of these is best recommended to future-proof the application? And given each uint, what year is the furthest it could be stored?

4

In the Yellow Paper the block's timestamp is storead as a scalar integer less than 2256.

If you do not care about space then an uint256 should be good enough for your future needs.

Ethereum uses the unix time representation for timestamps, you can use an utility like this to convert integer ranges to dates

  • Using uint8 should be good until '1970-01-01T00:04:15+00:00'
  • Using uint16 should be good until '1970-01-01T18:12:15+00:00'
  • Using uint32 should be good enough until '2106-02-07T06:28:15+00:00'
  • Using uint64 should be good for 584,942,417,355 years after 1970

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.