Language

Choose a language

/build/rpc / btc

getbestblockhash

getbestblockhash Returns the hash of the best (tip) block in the most-work fully-validated chain. Result: "hex" (string) the block hash, hex-encoded Examples: > bitcoin-cli getbestblockhash > curl --user myusername --data-binary '{"jsonrpc": "2.0", "id": "curltest", "method": "getbestblockhash", "params": []}' -H 'content-type: application/json' http://127.0.0.1:8332/

Signature

getbestblockhash() → any

Code samples

curl --user "$RPC_USER:$RPC_PASS" \
  --data-binary '{"jsonrpc":"1.0","id":"docs","method":"getbestblockhash","params":[]}' \
  -H 'content-type: text/plain;' \
  http://127.0.0.1:8332/

Parameters

No parameters.

Result

Type:  any

"hex" (string) the block hash, hex-encoded

Source: services/core-node/bcore/src/rpc/blockchain.cpp:247

C++ symbol: getbestblockhash