Skip to main content

getblockhash

Overview

The 'getblockhash' RPC method in CoinAPI allows you to retrieve the hash of a block using its height. This method is essential for developers and blockchain enthusiasts who want to query specific block details in the Bitcoin blockchain.

Request

wget --no-check-certificate --quiet \
--method POST \
--timeout=0 \
--header 'Content-Type: application/json' \
--header 'accept: application/json' \
--header 'X-CoinAPI-Key: 4303fb63-adec-42dc-b571-74bc2f2a5167' \
--body-data '{"jsonrpc":"2.0","id":1,"method":"getblockhash","params": [ ]}' \
'https://bitcoin-mainnet.node.coinapi.io'

Request Parameters

  • Type: Numeric
  • Required: Yes
  • Description: The height index of the block in the blockchain. It represents the position of the block in the blockchain, starting from 0, which is the genesis block.

Response

{
"status": "success",
"data": {
"result": "00000000000000000007f8a09c4c7d0e6c4c76e3d60e1b3fe9e0a3d1a1a2bce9"
}
}

result

  • Type: String
  • Description: This field will return the hash of the block corresponding to the specified height. The hash is a unique identifier for the block and can be used to retrieve further details about the block.

Notes

  • Ensure that you have sufficient API credits before making a request.
  • The API response time may vary depending on the network conditions.