After doing some reading on the topic, it looks like the only way to determine if a wallet is up to date, and this is apparently what the wallets do, is just see how old the newest block is. With bitcoin, if the newest block is less than 90 minutes old, you are considered up to date.
I'm trying to recreate this in my own web dashboard using RPC commands. So I do the following....
First I run this
getblockcount
To get the number of the newest block.
Then I run this
getblockhash {number from previous step}
to get the hash of that block
Then I run this to look up all the info on this block and ultimately get it's ['time'] attribute:
getblock {hash from previous step}
But this is where things go awry. This returns an error:
{code} => -32700
{message} => Parse error
This is inside a php shell script using the built in curl module. I also tried running this command using `curl` directly from the command line.
curl --user *username* --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblock", "params": ["08eea4f5d6dfac07937095695aea67ba1548c64b64bae99b2f4f20a34e08aea0"] }' -H 'content-type: text/plain;' http://*lanIP*:*port#*/
Using that, I repeatedly get "Connection Refused" errors. Which is different than a parse error. So I have no idea what's actually going on here?
Any thoughts? Is the `getblock` command broken? Or is there something I'm doing wrong in my code?