⚠️Blast API (blastapi.io) ends Oct 31. Migrate to Dwellir and skip Alchemy's expensive compute units.
Switch Today →
Skip to main content

wallet/getblockbyid

Get block information by block hash ID.

Endpoint

POST /wallet/getblockbyid

Parameters

Required Parameters

ParameterTypeDescription
valuestringBlock hash ID (hex string)

Optional Parameters

ParameterTypeDescription
detailbooleanInclude full transaction details (default: false)

Response

Returns block information including:

  • blockID - Block hash identifier
  • block_header - Block header information
    • raw_data - Raw block data
      • number - Block height
      • txTrieRoot - Transaction trie root
      • witness_address - Block producer address
      • parentHash - Parent block hash
      • timestamp - Block timestamp (milliseconds)
      • version - Block version
    • witness_signature - Witness signature
  • transactions - Array of transactions in the block

Implementation Examples

// Get block by hash ID
const response = await fetch('https://api-tron-mainnet.n.dwellir.com/YOUR_API_KEY/wallet/getblockbyid', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
value: '0000000003787ac74d9bb8f8c9c59ac3f3e3b9b8c9e3e8f9c8d7e8f9c8d7e8f9'
}),
});

const data = await response.json();
console.log(data);

// Get block with full transaction details
const detailedResponse = await fetch('https://api-tron-mainnet.n.dwellir.com/YOUR_API_KEY/wallet/getblockbyid', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
value: '0000000003787ac74d9bb8f8c9c59ac3f3e3b9b8c9e3e8f9c8d7e8f9c8d7e8f9',
detail: true
}),
});

const detailedData = await detailedResponse.json();
console.log(detailedData);

Example Response

{
"blockID": "0000000003787ac74d9bb8f8c9c59ac3f3e3b9b8c9e3e8f9c8d7e8f9c8d7e8f9",
"block_header": {
"raw_data": {
"number": 58234567,
"txTrieRoot": "7d9bb8f8c9c59ac3f3e3b9b8c9e3e8f9c8d7e8f9c8d7e8f9c8d7e8f9c8d7e8f9",
"witness_address": "41928c9af0651632157ef27a2cf17ca72c575a4d21",
"parentHash": "0000000003787ac64d9bb8f8c9c59ac3f3e3b9b8c9e3e8f9c8d7e8f9c8d7e8f8",
"version": 27,
"timestamp": 1702456789000
},
"witness_signature": "a3e5b8c9d7f8e9c8d7e8f9c8d7e8f9..."
},
"transactions": [
{
"txID": "7c2d4206c03a883dd9066d6c839d0deaef32dc5a0d9b15f6d06e506906c90332",
"raw_data": {
"contract": [
{
"parameter": {
"value": {
"amount": 1000000,
"owner_address": "41e552726909b5c951a9e0d365674e5a48b46f79d3",
"to_address": "41d1e7a6bc354106cb410e65ff8b181c600ff14292"
},
"type_url": "type.googleapis.com/protocol.TransferContract"
},
"type": "TransferContract"
}
],
"ref_block_bytes": "7ac6",
"ref_block_hash": "4d9bb8f8c9c59ac3",
"expiration": 1702456849000,
"timestamp": 1702456789000
},
"signature": ["b8c9d7e8f9c8d7e8f9c8d7e8f9..."]
}
]
}

Use Cases

  • Block Verification: Verify block contents by hash
  • Transaction Confirmation: Confirm transaction inclusion in specific block
  • Chain Reorganization Detection: Monitor for block hash changes
  • Block Explorer: Display block details by hash
  • Forensic Analysis: Investigate specific blocks