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?

  • 2
    Are you fully synced, or are you still catching up? – Pieter Wuille Mar 31 '16 at 6:20
  • It's had a week to catch up, it should be, how would I check? – erikvold Mar 31 '16 at 21:42
  • What do you get if you query getblockcount? – Pieter Wuille Mar 31 '16 at 21:46
  • bitcoin-cli getinfo should give you at least this "blocks": 405345, – Cole Albon Apr 2 '16 at 2:24
  • ah ok I wasn't sync'd up, and now I am, and now it works :) – erikvold Apr 5 '16 at 1:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.