Difference between "time" and "mediantime" in getblock?

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?

Edward Kerstein

Posted 2018-01-05T21:50:52.410

Reputation: 137

Answers

4

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.

MeshCollider

Posted 2018-01-05T21:50:52.410

Reputation: 8 735