2

What would be a formula for calculating the block height at a certain point in time, approximative How would I calculate the block height for a date like next Christmas 0h midnight?

6

If you just mean a general formula, rather than something written in Solidity...

Something along the lines of:

last_block_number + ((future_time - time_now) / block_time)

Where the future_time and time_now are in seconds since the epoch, and block_time is the average expected block time.

The block time is currently hovering between 14 and 14.5 seconds.


So, for example, using a current epoch time of 1481214124, the epoch time of 1482537600 for midnight Christmas Eve, and the last block of 2771338:

2771338 + ((1482537600 - 1481214124) / 14) = 2865872

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.