Bitcoin RPC
Overview
The getchaintips
is a Bitcoin RPC method that returns information about all known tips in the block tree. This method is useful for identifying and analyzing potential forks or alternative chains in the Bitcoin network. It can be used to monitor the health and status of the network or to investigate discrepancies in blockchain data.
Returns
The return object is an array of JSON objects, with each object representing a chain tip. The fields in each object are:
Name | Description |
---|---|
height | The height of the chain tip in the block chain. |
hash | The hash of the block corresponding to the chain tip. |
branchlen | The length of the branch connected to the main chain. |
status | The status of the chain tip, which can be one of the following values:active : The tip is part of the main chain.valid-fork : The tip is part of a valid but inactive forkvalid-headers : The tip is part of a valid fork but with incomplete block data.headers-only : The tip is a fork with valid headers but incomplete block data and an invalid parent block.invalid : The tip is part of an invalid fork.unknown : The tip has an unknown validation state. |
Request Example
curl --location 'https://api.tatum.io/v3/blockchain/node/bitcoin-mainnet/' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {API_KEY}' \
--data '{
"jsonrpc": "2.0",
"method": "getchaintips",
"id": 1
}'
// yarn add @tatumio/tatum
import { TatumSDK, Bitcoin, Network } from '@tatumio/tatum'
const tatum = await TatumSDK.init<Bitcoin>({ network: Network.BITCOIN })
const result = await tatum.rpc.getChainTips()
await tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs