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
Name | Type | Required | Description |
---|---|---|---|
height_or_hash | string or integer | Yes | The block hash (hex string) or block height (integer). |
Returns
This method returns the raw block data as a hexadecimal string:
Field | Description |
---|---|
blockHex | The 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