> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sqd.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Tron

> Index Tron data with SQD

<Info>Blocks, transactions, TVM event logs, and internal transactions. Tron is the leading network for USDT (TRC-20) settlement; because the TVM is EVM-compatible, TRC-20 events share the same topic signatures as ERC-20.</Info>

| Property   | Value          |
| ---------- | -------------- |
| Network ID | `tron-mainnet` |
| Real-time  | Yes            |

## Endpoint

```
https://portal.sqd.dev/datasets/tron-mainnet
```

## Quick start

Stream USDT (TRC-20) transfers — the flagship Tron query:

```bash theme={"system"}
curl --compressed -X POST \
  'https://portal.sqd.dev/datasets/tron-mainnet/stream' \
  -H 'Content-Type: application/json' \
  -d '{
    "type": "tron",
    "fromBlock": 79257136,
    "toBlock": 79257200,
    "fields": {
      "block": { "number": true, "timestamp": true },
      "log": { "address": true, "topics": true, "data": true }
    },
    "logs": [{
      "address": ["a614f803b6fd780986a42c78ec9c7f77e6ded13c"],
      "topic0": ["ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]
    }]
  }'
```

<Info>Account and contract addresses in filters (`owner`, `to`, `contract`, `caller`, `transferTo`) use the native 41-prefixed lowercase hex form. Log addresses and addresses encoded in topics use the 20-byte EVM-style hex form (no `41` prefix). Timestamps are Unix milliseconds; resource and value fields are decimal strings.</Info>

## Schema

<AccordionGroup>
  <Accordion title="Blocks">
    | Field              | Type    | Description                                 |
    | ------------------ | ------- | ------------------------------------------- |
    | `number`           | integer | Block number                                |
    | `hash`             | string  | Block ID (hash)                             |
    | `parentHash`       | string  | Parent block ID                             |
    | `txTrieRoot`       | string  | Root hash of the transaction Merkle trie    |
    | `version`          | integer | Block version                               |
    | `timestamp`        | integer | Block timestamp (Unix ms)                   |
    | `witnessAddress`   | string  | Producing witness address (41-prefixed hex) |
    | `witnessSignature` | string  | Witness signature over the header           |
  </Accordion>

  <Accordion title="Transactions">
    | Field              | Type    | Description                                                                    |
    | ------------------ | ------- | ------------------------------------------------------------------------------ |
    | `transactionIndex` | integer | Index in the block                                                             |
    | `hash`             | string  | Transaction hash (txID)                                                        |
    | `type`             | string  | Contract type (e.g. `TransferContract`, `TriggerSmartContract`)                |
    | `parameter`        | object  | Decoded contract payload (`type_url` + `value`; addresses are 41-prefixed hex) |
    | `ret`              | array   | Result entries (e.g. `contractRet: SUCCESS`)                                   |
    | `result`           | string  | Receipt result (e.g. `SUCCESS`)                                                |
    | `signature`        | array   | Authorizing signatures                                                         |
    | `contractAddress`  | string  | Contract invoked or created (41-prefixed hex)                                  |
    | `contractResult`   | string  | Hex-encoded smart-contract return value                                        |
    | `feeLimit`         | string  | Max fee for execution (SUN)                                                    |
    | `fee`              | string  | Total fee charged (SUN)                                                        |
    | `energyUsageTotal` | string  | Total energy consumed                                                          |
    | `energyFee`        | string  | Fee paid for energy (SUN)                                                      |
    | `netUsage`         | string  | Bandwidth (net) consumed                                                       |
    | `netFee`           | string  | Fee paid for bandwidth (SUN)                                                   |
    | `timestamp`        | integer | Transaction timestamp (Unix ms)                                                |
    | `expiration`       | integer | Expiration time (Unix ms)                                                      |
  </Accordion>

  <Accordion title="Logs">
    | Field              | Type    | Description                                               |
    | ------------------ | ------- | --------------------------------------------------------- |
    | `transactionIndex` | integer | Parent transaction index                                  |
    | `logIndex`         | integer | Index in the block                                        |
    | `address`          | string  | Emitting contract (20-byte EVM-style hex, no `41` prefix) |
    | `data`             | string  | Non-indexed log data                                      |
    | `topics`           | array   | Indexed topics (`topic0` is the event signature)          |
  </Accordion>

  <Accordion title="Internal transactions">
    | Field                      | Type    | Description                                                   |
    | -------------------------- | ------- | ------------------------------------------------------------- |
    | `transactionIndex`         | integer | Parent transaction index                                      |
    | `internalTransactionIndex` | integer | Index within the parent transaction                           |
    | `hash`                     | string  | Internal transaction hash                                     |
    | `callerAddress`            | string  | Initiator (41-prefixed hex)                                   |
    | `transferToAddress`        | string  | Recipient (41-prefixed hex)                                   |
    | `callValueInfo`            | array   | Transferred values (`callValue` in SUN, `tokenId` for TRC-10) |
    | `note`                     | string  | Hex-encoded note (e.g. `63616c6c` for "call")                 |
    | `rejected`                 | boolean | Whether the internal transaction was rejected                 |
    | `extra`                    | string  | Optional extra data                                           |
  </Accordion>
</AccordionGroup>

## Reference

<CardGroup cols={2}>
  <Card title="API Reference" icon="code" href="/en/api/tron/stream">
    Field definitions and query syntax
  </Card>

  <Card title="Portal Migration" icon="arrow-right" href="/en/portal/migration">
    Migrate from v2 archives to Portal
  </Card>
</CardGroup>
