wallet/getblockbyid
Get block information by block hash ID.
Endpoint
POST /wallet/getblockbyid
Parameters
Required Parameters
Parameter | Type | Description |
---|---|---|
value | string | Block hash ID (hex string) |
Optional Parameters
Parameter | Type | Description |
---|---|---|
detail | boolean | Include full transaction details (default: false) |
Response
Returns block information including:
blockID
- Block hash identifierblock_header
- Block header informationraw_data
- Raw block datanumber
- Block heighttxTrieRoot
- Transaction trie rootwitness_address
- Block producer addressparentHash
- Parent block hashtimestamp
- Block timestamp (milliseconds)version
- Block version
witness_signature
- Witness signature
transactions
- Array of transactions in the block
Implementation Examples
- JavaScript
- Python
- cURL
// 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);
import requests
url = "https://api-tron-mainnet.n.dwellir.com/YOUR_API_KEY/wallet/getblockbyid"
# Basic block query
payload = {
"value": "0000000003787ac74d9bb8f8c9c59ac3f3e3b9b8c9e3e8f9c8d7e8f9c8d7e8f9"
}
response = requests.post(url, json=payload)
print(response.json())
# Get block with transaction details
detailed_payload = {
"value": "0000000003787ac74d9bb8f8c9c59ac3f3e3b9b8c9e3e8f9c8d7e8f9c8d7e8f9",
"detail": True
}
detailed_response = requests.post(url, json=detailed_payload)
print(detailed_response.json())
# Get block by hash ID
curl -X POST https://api-tron-mainnet.n.dwellir.com/YOUR_API_KEY/wallet/getblockbyid \
-H "Content-Type: application/json" \
-d '{
"value": "0000000003787ac74d9bb8f8c9c59ac3f3e3b9b8c9e3e8f9c8d7e8f9c8d7e8f9"
}'
# Get block with full transaction details
curl -X POST https://api-tron-mainnet.n.dwellir.com/YOUR_API_KEY/wallet/getblockbyid \
-H "Content-Type: application/json" \
-d '{
"value": "0000000003787ac74d9bb8f8c9c59ac3f3e3b9b8c9e3e8f9c8d7e8f9c8d7e8f9",
"detail": true
}'
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
Related Methods
- wallet/getblockbynum - Get block by height
- wallet/getblockbylatestnum - Get recent blocks
- wallet/getnowblock - Get latest block
- wallet/gettransactionbyid - Get transaction details