Getting the lasthash on a bitcoin full node using bitcoin-cli

0

I'm trying to figure out how to get the last block hash using bitcoin-cli. I read the help:

$ bitcoin-cli help
== Blockchain ==
getbestblockhash
getblock "hash" ( verbose )
getblockchaininfo
getblockcount
getblockhash index
getchaintips
getdifficulty
getmempoolinfo
getrawmempool ( verbose )
gettxout "txid" n ( includemempool )
gettxoutproof ["txid",...] ( blockhash )
gettxoutsetinfo
verifychain ( checklevel numblocks )
verifytxoutproof "proof"

== Control ==
getinfo
help ( "command" )
stop

== Mining ==
getblocktemplate ( "jsonrequestobject" )
getmininginfo
getnetworkhashps ( blocks height )
prioritisetransaction <txid> <priority delta> <fee delta>
submitblock "hexdata" ( "jsonparametersobject" )

== Network ==
addnode "node" "add|remove|onetry"
getaddednodeinfo dns ( "node" )
getconnectioncount
getnettotals
getnetworkinfo
getpeerinfo
ping

== Rawtransactions ==
createrawtransaction [{"txid":"id","vout":n},...] {"address":amount,...}
decoderawtransaction "hexstring"
decodescript "hex"
getrawtransaction "txid" ( verbose )
sendrawtransaction "hexstring" ( allowhighfees )
signrawtransaction "hexstring" ( [{"txid":"id","vout":n,"scriptPubKey":"hex","redeemScript":"hex"},...] ["privatekey1",...] sighashtype )

== Util ==
createmultisig nrequired ["key",...]
estimatefee nblocks
estimatepriority nblocks
validateaddress "bitcoinaddress"
verifymessage "bitcoinaddress" "signature" "message"

And trying something like bitcoin-cli getbestblockhash doesn't seem to print a hash that matches up with https://blockchain.info/q/latesthash

and I'm not seeing a good option, did I miss something?

erikvold

Posted 2016-03-31T05:38:33.163

Reputation: 683

2Are you fully synced, or are you still catching up?Pieter Wuille 2016-03-31T06:20:26.420

It's had a week to catch up, it should be, how would I check?erikvold 2016-03-31T21:42:01.960

What do you get if you query getblockcount?Pieter Wuille 2016-03-31T21:46:24.843

bitcoin-cli getinfo should give you at least this "blocks": 405345,Cole Albon 2016-04-02T02:24:12.100

ah ok I wasn't sync'd up, and now I am, and now it works :)erikvold 2016-04-05T01:49:41.280

No answers