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

<pre><code>$ 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 &lt;txid&gt; &lt;priority delta&gt; &lt;fee delta&gt;
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"
</code></pre>

<p>And trying something like <code>bitcoin-cli getbestblockhash</code> doesn't seem to print a hash that matches up with <a href="https://blockchain.info/q/latesthash" rel="nofollow">https://blockchain.info/q/latesthash</a></p>

<p>and I'm not seeing a good option, did I miss something?</p>

CC BY-SA 3.0
2016-03-31T06:20:26.420Z
Are you fully synced, or are you still catching up?
Pieter Wuille
CC BY-SA 3.0
2016-03-31T21:42:01.960Z
It's had a week to catch up, it should be, how would I check?
erikvold
CC BY-SA 3.0
2016-03-31T21:46:24.843Z
What do you get if you query getblockcount?
Pieter Wuille
CC BY-SA 3.0
2016-04-02T02:24:12.100Z
bitcoin-cli getinfo
should give you at least this "blocks": 405345,
Cole Albon
CC BY-SA 3.0
2016-04-05T01:49:41.280Z
ah ok I wasn't sync'd up, and now I am, and now it works :)
erikvold
<full-node><bitcoin-cli>
Getting the lasthash on a bitcoin full node using bitcoin-cli
erikvold
# Getting the lasthash on a bitcoin full node using bitcoin-cli

(Asked by: username_0 on 2016-03-31)

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   
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?

**Tags:** full-node, bitcoin-cli

> **Comments:**
> **username_1**: Are you fully synced, or are you still catching up?  
> **username_0**: It's had a week to catch up, it should be, how would I check?  
> **username_1**: What do you get if you query getblockcount?  
> **username_2**: bitcoin-cli getinfo should give you at least this "blocks": 405345,  
> **username_0**: ah ok I wasn't sync'd up, and now I am, and now it works :)  

---

## 0 answers

