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

wallet/getblockbynum

Get block information by block height number.

Endpoint

POST /wallet/getblockbynum

Parameters

Required Parameters

ParameterTypeDescription
numnumberBlock height number

Response

Returns block information including:

  • blockID - Block hash
  • 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
    • witness_signature - Witness signature
  • transactions - Array of transactions in the block

Implementation Examples

// Get block by height number
const response = await fetch('https://api-tron-mainnet.n.dwellir.com/YOUR_API_KEY/wallet/getblockbynum', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
num: 58234567
}),
});

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

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 Explorer: Display block details and transactions
  • Transaction Verification: Confirm transaction inclusion
  • Chain Analysis: Analyze block production patterns
  • Data Indexing: Index historical blockchain data
  • Network Monitoring: Track block production rate