wallet/getblockbynum
Get block information by block height number.
Endpoint
POST /wallet/getblockbynum
Parameters
Required Parameters
Parameter | Type | Description |
---|---|---|
num | number | Block height number |
Response
Returns block information including:
blockID
- Block hashblock_header
- Block header informationraw_data
- Raw block datanumber
- Block heighttxTrieRoot
- Transaction trie rootwitness_address
- Block producer addressparentHash
- Parent block hashtimestamp
- Block timestamp
witness_signature
- Witness signature
transactions
- Array of transactions in the block
Implementation Examples
- JavaScript
- Python
- cURL
// 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);
import requests
url = "https://api-tron-mainnet.n.dwellir.com/YOUR_API_KEY/wallet/getblockbynum"
payload = {
"num": 58234567
}
response = requests.post(url, json=payload)
print(response.json())
curl -X POST https://api-tron-mainnet.n.dwellir.com/YOUR_API_KEY/wallet/getblockbynum \
-H "Content-Type: application/json" \
-d '{
"num": 58234567
}'
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
Related Methods
- wallet/getnowblock - Get latest block
- wallet/gettransactionbyid - Get transaction details
- wallet/getaccount - Get account information