6

Is there a tool or a source that tells how many total days are currently on the ledger? I know that monerod tells how many days behind you are on the ledger, but is there an easy way to look up the total number of days without syncing up with the blockchain for the first time?

Edit: This may just need to be a feature request, but I am running a windows machine in this case and seeking a cross platform solution. I was hoping there is a built in argument to do something like the following code in monerod:

LOG_PRINT_CCONTEXT_YELLOW("Sync data returned a new top block candidate: " << m_core.get_current_blockchain_height() << " -> " << hshd.current_height << " [Your node is " << std::abs(diff) << " blocks (" << ((abs(diff) - diff_v2) / (24 * 60 * 60 / DIFFICULTY_TARGET_V1)) + (diff_v2 / (24 * 60 * 60 / DIFFICULTY_TARGET_V2)) << " days) "

Part of the output then is something like Your node is 73520 blocks (102 days) behind

4

If you're on a UNIX-like OS such as Linux or macOS, and have jq installed, you can do this:

curl -s -X POST http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"getblock","params":{"height":1}}' -H 'Content-Type: application/json' | jq '.result.block_header.timestamp' | gawk '{print strftime("%c", $0)}'

Fri 18 Apr 2014 12:49:53

The first part displays the genesis block in JSON format. The jq-filter, selects the "UNIX" timestamp (1397818193), which gets converted to a readable date and time with gawk.

Obviously, instead of 127.0.0.1, you could point to any node, such as node.moneroworld.com. The RPC-call is described in the Daemon RPC Documentation.

Update: I just realized you don't want the date, but the number of days since. The following one-liner, using bc, gives you the number of days:

echo "scale = 1; ($(date +%s) - $(curl -s -X POST http://node.moneroworld.com:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"getblock","params":{"height":1}}' -H 'Content-Type: application/json' | jq '.result.block_header.timestamp')) / 86400" | bc

993.4

1

I'm hoping a better answer is posted with a way to calculate this directly from the blockchain, but the first block listed at moneroblocks has a timestamp of 2014-04-18 10:49:53 UTC.

I used Wolfram Alpha to calculate it quickly and it shows 991.1 days at the time of this post.

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.