/wallet/getblockbynum - Tron

This endpoint returns a block by its height, including its header and transactions.

This is a read endpoint. It is also served by the Solidity node at https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/walletsolidity/getblockbynum, which returns only confirmed, irreversible data. Use the Solidity node for balance and payment verification.

Parameters

ParameterTypeRequiredDescription
numintegerYesThe block height to retrieve

Request

bashcurl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/wallet/getblockbynum' \
--header 'Content-Type: application/json' \
--data-raw '{
  "num": 68000000
}'

example.js

javascriptconst response = await fetch(
    'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/wallet/getblockbynum',
    {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({"num": 68000000})
    }
);
console.log(await response.json());

example.py

pythonimport requests

response = requests.post(
    'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/wallet/getblockbynum',
    headers={'Content-Type': 'application/json'},
    json={"num": 68000000}
)

print(response.json())

Response

json{
  "blockID": "0000000002f3a5b0f6d2e6c9a1b4e7f0a3b6c9d2e5f8a1b4c7d0e3f6a9b2c5d8",
  "block_header": {
    "raw_data": {
      "number": 68000000,
      "timestamp": 1719400000000,
      "witness_address": "41e72d833e0c46837c0802864acc5f119a0a904d05"
    }
  },
  "transactions": [
    {
      "txID": "d5ec749ecc2a615399d8a6c864ea4c74ff9f523c2be0e341ac9be5d47d7c2d62"
    }
  ]
}

Response Parameters

FieldTypeDescription
blockIDstringThe block hash
block_header.raw_data.numberintegerBlock height
block_header.raw_data.timestampintegerBlock time in milliseconds
transactionsarrayTransactions included in the block

Use Cases

  • Block Explorers: Render a block by height
  • Chain Indexing: Stream blocks by height into a store
  • USDT Tracking: Scan a block's transactions for TRC-20 transfers
  • Confirmation Context: Read a block's time and producer

Error Handling

HTTP StatusMessageDescription
200OKThe request succeeded; some TRON errors are returned in the 200 body as an Error field
400Bad requestThe request body is malformed or a required field is missing
500Internal errorThe node failed to process the request