Skip to main content

getchaintips

Overview

The 'getchaintips' RPC method provided by CoinAPI offers detailed insights into all recognized chaintips in the block tree. This encompasses information on the main chain as well as any orphaned branches.

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":"getchaintips","params": [ ]}' \
'https://bitcoin-mainnet.node.coinapi.io'

Request Parameters

This method does not require any parameters.

Response

{
"result": [
{
"height": 810528,
"hash": "00000000000000000004749a1d06c52c2442a7bec69ace34edb9a0d6e9102182",
"branchlen": 0,
"status": "active"
},
{
"height": 792379,
"hash": "000000000000000000032956cbfd8721abe0572d81542e75e38e6185312bee09",
"branchlen": 1,
"status": "valid-fork"
},
{
"height": 791130,
"hash": "00000000000000000000e66ee68d93839fbff6f01482562737c05d5be5db033e",
"branchlen": 1,
"status": "valid-headers"
}
],
"error": null,
"id": 1
}

The method returns the following data:

  • height: Represents the height of the chain tip.
  • hash: Indicates the block hash of the tip.
  • branchlen: This is zero for the main chain. For other branches, it indicates the length of the branch connecting the tip to the main chain.
  • status: Describes the status of the chain. The "active" status is assigned to the main chain.

Other potential statuses include:

  • invalid: This status is assigned when the branch contains at least one block that is invalid.
  • headers-only: This status is assigned when only the headers are valid, but not all blocks for this branch are present.
  • valid-headers: This status is assigned when the branch contains all blocks, but they haven't been fully validated.
  • valid-fork: This status is assigned when the branch has been fully validated but is not part of the active chain.
  • active: This status is assigned when the branch represents the tip of the active main chain, which is definitively valid.