# wallet/getblockbynum - Get TRON Block by Height

Get block information by block height number.

## Endpoint

```
POST /wallet/getblockbynum
```

## Request Parameters

- `num` (`number, required`): Required parameter: Block height number

## Request Example

```bash
curl -X POST https://api-tron-mainnet.n.dwellir.com/YOUR_API_KEY/wallet/getblockbynum \
      -H "Content-Type: application/json" \
      -d '{
        "num": 58234567
      }'
```

## Response Fields

- `result` (`OBJECT, required`): `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

## Successful Response

```json
{
  "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..."]
    }
  ]
}
```

## Implementation Examples

cURL
JavaScript
Python

```bash
curl -X POST https://api-tron-mainnet.n.dwellir.com/YOUR_API_KEY/wallet/getblockbynum \
  -H "Content-Type: application/json" \
  -d '{
    "num": 58234567
  }'
```

```javascript
// 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);
```

```python
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())
```

## 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](https://www.dwellir.com/docs/tron/wallet-getnowblock) - Get latest block
- [wallet/gettransactionbyid](https://www.dwellir.com/docs/tron/wallet-gettransactionbyid) - Get transaction details
- [wallet/getaccount](https://www.dwellir.com/docs/tron/wallet-getaccount) - Get account information
