blockchainbitcoinbitcoindcryptocurrencybitcoinj

Getting Bitcoin's block number in a specific date and hour?


I would like to know what is the Bitcoin block number in an existing date at an exact hour. for example what is the block number closest to 1.1.2017 at 00:00 UTC. What is the easiest way to do so?


Solution

  • Convert the time to seconds since the UNIX epoch:

    $ date -ud "1/1/2017"
    Sun Jan 1 00:00:00 UTC 2017
    $ date -ud "1/1/2017" +%s
    1483228800

    You can also use Epoch Converter to convert it.

    Add three zeroes to that number and append it to a blockchain.com URL:

    https://www.blockchain.com/btc/blocks/1483228800000

    And there you have it:

    446033 (Main Chain) 2017-01-01 00:02:33

    And if you want the previous block, clock on the previous button and scroll to the end:

    446032 (Main Chain) 2016-12-31 23:44:04

    So block 446,032 was mined at 12/31/2016 at 23:44:04 UTC and block 446,033 was mined at two minutes and 33 seconds after midnight.