3

For bitcoin-cli getblock, what's the difference between "time" and "mediantime"?

If i'm looking for a strictly increasing series of timestamps, is one better to choose than the other?

5

mediantime is better for your purpose. The timestamp is chosen by the miners, and has some restrictions on it such as it can't be too far in the future/past (no more than 2 hours into the future), but it is not strictly increasing. Mediantime, on the other hand, is. Mediantime is the median time of the past 11 block timestamps, and a block must have a timestamp greater than that median time, so the mediantime always increases.

|improve this answer|||||
  • So it's possible to have a higher block with a lower time than a lower block?! – M.K. Safi Feb 21 at 4:57
  • Correct, as long as it obeys the other rules – MeshCollider Feb 22 at 21:58

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.