blockchainBlockGet

Electrum for Bitcoin

Overview

The blockchain.block.get method allows retrieving a full block based on its hash or height. This is particularly useful for obtaining detailed block information, including transactions within the block.

Parameters

NameTypeRequiredDescription
height_or_hashstring or integerYesThe block hash (hex string) or block height (integer).

Returns

This method returns the raw block data as a hexadecimal string:

FieldDescription
blockHexThe full block data encoded as a hexadecimal string.

Example Result

{
  "blockHex": "0100...abcd"
}

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.block.get",
    "params": ["00000000000000000176c6f9e3b8c23a5f9a07ae2b0f6cc6cc2d1b16869f97a3"],
    "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 blockData = await tatum.rpc.getBlock('00000000000000000176c6f9e3b8c23a5f9a07ae2b0f6cc6cc2d1b16869f97a3')

console.log(blockData)

await tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs