api/v2/rawblock - Litecoin

This endpoint returns the raw serialized hex of a block, selected by height or hash.

Parameters

ParameterTypeLocationRequiredDescription
blockIdstringpathYesBlock height or block hash

Request

bashcurl --location --request GET 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/api/v2/rawblock/0fc24234c2379a5262023a4b4a653ff3a11df6bb1c12851aff820d27ea02b0b6'

example.js

javascriptconst response = await fetch(
    'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/api/v2/rawblock/0fc24234c2379a5262023a4b4a653ff3a11df6bb1c12851aff820d27ea02b0b6'
);
console.log(await response.json());

example.py

pythonimport requests

response = requests.get('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/api/v2/rawblock/0fc24234c2379a5262023a4b4a653ff3a11df6bb1c12851aff820d27ea02b0b6')

print(response.json())

Response

json{
    "hex": "1400002041399939802e19d56942bdb74571b1af8fcf0ae3f8be1eb20bbfa19974b9a9e82bd23b23..."
}

Response Parameters

FieldTypeDescription
hexstringThe complete block, serialized and hex-encoded

The response is a single hex string covering the whole block and is large: the block above serializes to roughly 181,000 hex characters. The value is truncated in this example.

Use Cases

  • Independent Parsing: Decode a block with your own parser
  • Verification: Recompute the merkle root or block hash locally
  • Archival: Store blocks in their canonical serialized form

Error Handling

HTTP StatusMessageDescription
400Bad requestThe block id is not a valid height or hash
403ForbiddenMissing or invalid ACCESS-TOKEN
404Not foundNo block matches the requested id
500Internal errorThe indexer failed to read the block