Electrum for Bitcoin
Overview
The blockchain.headers.tip
method retrieves the latest block header, known as the tip of the blockchain. This method provides a snapshot of the most recent block header without subscribing to continuous header updates.
Returns
The method returns a dictionary with the latest block header information:
Field | Description |
---|---|
hex | The block header as a hexadecimal string. |
height | The height of the block, represented as an integer. |
Example Result
{
"hex": "0000...8ce804c4",
"height": 520481
}
Request Example
curl --location 'https://api.tatum.io/v3/blockchain/node/bitcoin-mainnet-electrs/' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {API_KEY}' \
--data '{
"method": "blockchain.headers.tip",
"params": [],
"id": 1,
"jsonrpc": "2.0"
}'
// yarn add @tatumio/tatum
import { TatumSDK, BitcoinElectrs, Network } from '@tatumio/tatum'
const tatum = await TatumSDK.init<BitcoinElectrs>({ network: Network.BITCOIN_ELECTRS })
const tipHeader = await tatum.rpc.getHeadersTip()
console.log(tipHeader)
await tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs