openapi: 3.1.0
info:
  title: SQD Portal API - Tron Dataset Endpoints
  description: >
    API endpoints for interacting with the Tron dataset under the SQD Portal,
    specifically the Tron Mainnet dataset.


    Tron-specific conventions:

    - **Addresses in filters and transaction parameters** (`owner`, `to`,
    `contract`, `caller`, `transferTo`, and the addresses inside a transaction's
    `parameter`) use the native Tron 41-prefixed, lowercase hex form (21 bytes),
    e.g. the USDT contract `TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t` is
    `41a614f803b6fd780986a42c78ec9c7f77e6ded13c`.

    - **Log addresses and addresses encoded inside log topics** use the 20-byte
    EVM-style hex form without the `41` prefix (e.g.
    `a614f803b6fd780986a42c78ec9c7f77e6ded13c`), because the Tron Virtual
    Machine (TVM) is EVM-compatible. TRC-20 events therefore share the same
    `topic0` signatures as their ERC-20 counterparts.

    - **Timestamps** (`block.timestamp`, transaction `expiration` and
    `timestamp`) are Unix time in **milliseconds**.

    - **Numeric resource/value fields** (`fee`, `feeLimit`, `energyFee`,
    `energyUsageTotal`, `netUsage`, `netFee`, TRX amounts, …) are returned as
    decimal strings or `null` to preserve precision.
  version: 1.0.0
servers:
  - url: https://portal.sqd.dev/datasets/tron-mainnet
    description: SQD Portal's endpoint for Tron Mainnet
paths:
  /metadata:
    get:
      summary: Dataset Metadata
      x-mint:
        href: /en/api/tron/metadata
        metadata:
          description: Get Tron dataset metadata from the SQD Portal API.
      x-codeSamples:
        - lang: shell
          label: Get Tron Mainnet Metadata
          source: >
            curl --compressed
            'https://portal.sqd.dev/datasets/tron-mainnet/metadata'
        - lang: python
          label: Get Tron Mainnet Metadata
          source: |
            import requests

            response = requests.get(
                "https://portal.sqd.dev/datasets/tron-mainnet/metadata"
            )
            metadata = response.json()
        - lang: javascript
          label: Get Tron Mainnet Metadata
          source: >
            const response = await
            fetch("https://portal.sqd.dev/datasets/tron-mainnet/metadata");

            const metadata = await response.json();
      description: >-
        Retrieves metadata describing the dataset, including its name, aliases,
        start block, and real-time status.
      responses:
        '200':
          description: Dataset metadata response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DatasetMetadata'
              examples:
                tron-mainnet:
                  summary: Tron Mainnet metadata
                  value:
                    dataset: tron-mainnet
                    aliases: []
                    real_time: true
                    start_block: 0
        '404':
          description: Dataset not found (`error.code` is `unknown_dataset`)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  type: invalid_request_error
                  code: unknown_dataset
                  message: 'Unknown dataset: no-such-chain'
  /stream:
    post:
      summary: Stream Blocks
      x-mint:
        href: /en/api/tron/stream
        metadata:
          description: Stream Tron blockchain data with the SQD Portal API.
      x-codeSamples:
        - lang: shell
          label: USDT (TRC-20) Transfers
          source: >
            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,
                    "transactionIndex": true,
                    "logIndex": true
                  }
                },
                "logs": [{
                  "address": ["a614f803b6fd780986a42c78ec9c7f77e6ded13c"],
                  "topic0": ["ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]
                }]
              }'
        - lang: shell
          label: USDT transfer() calls + receipts
          source: >
            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 },
                  "transaction": {
                    "hash": true,
                    "type": true,
                    "parameter": true,
                    "result": true,
                    "energyUsageTotal": true,
                    "netUsage": true
                  }
                },
                "triggerSmartContractTransactions": [{
                  "contract": ["41a614f803b6fd780986a42c78ec9c7f77e6ded13c"],
                  "sighash": ["a9059cbb"],
                  "logs": true
                }]
              }'
        - lang: shell
          label: Native TRX Transfers
          source: >
            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 },
                  "transaction": { "hash": true, "type": true, "parameter": true }
                },
                "transferTransactions": [{}]
              }'
        - lang: python
          label: USDT (TRC-20) Transfers
          source: |
            import requests

            response = requests.post(
                "https://portal.sqd.dev/datasets/tron-mainnet/stream",
                json={
                    "type": "tron",
                    "fromBlock": 79257136,
                    "toBlock": 79257200,
                    "fields": {
                        "block": {"number": True, "timestamp": True},
                        "log": {
                            "address": True,
                            "topics": True,
                            "data": True,
                            "transactionIndex": True,
                            "logIndex": True,
                        },
                    },
                    "logs": [{
                        "address": ["a614f803b6fd780986a42c78ec9c7f77e6ded13c"],
                        "topic0": ["ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"],
                    }],
                },
            )
            blocks = [
                __import__("json").loads(line)
                for line in response.text.splitlines()
                if line
            ]
        - lang: javascript
          label: USDT (TRC-20) Transfers
          source: >
            const response = await
            fetch("https://portal.sqd.dev/datasets/tron-mainnet/stream", {
                method: "POST",
                headers: { "Content-Type": "application/json" },
                body: JSON.stringify({
                    type: "tron",
                    fromBlock: 79257136,
                    toBlock: 79257200,
                    fields: {
                        block: { number: true, timestamp: true },
                        log: {
                            address: true,
                            topics: true,
                            data: true,
                            transactionIndex: true,
                            logIndex: true,
                        },
                    },
                    logs: [{
                        address: ["a614f803b6fd780986a42c78ec9c7f77e6ded13c"],
                        topic0: ["ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"],
                    }],
                }),
            });

            const text = await response.text();

            const blocks = text.split("\n").filter(Boolean).map((line) =>
            JSON.parse(line));
      description: >-
        Streams a list of blocks matching the provided data query, potentially
        including real-time data. Required request headers: `Content-Type:
        application/json`; optional request headers: `Accept-Encoding: gzip`,
        `Content-Encoding: gzip`. The response is JSON lines (one block object
        per line).
      requestBody:
        description: >-
          Data query to filter and retrieve blocks. Request body may be gzipped
          (Content-Encoding: gzip).
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DataQuery'
            examples:
              USDT TRC-20 Transfers:
                summary: USDT (TRC-20) Transfers
                value:
                  type: tron
                  fromBlock: 79257136
                  toBlock: 79257200
                  fields:
                    block:
                      number: true
                      timestamp: true
                    log:
                      address: true
                      topics: true
                      data: true
                      transactionIndex: true
                      logIndex: true
                  logs:
                    - address:
                        - a614f803b6fd780986a42c78ec9c7f77e6ded13c
                      topic0:
                        - >-
                          ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef
              USDT transfer() Calls:
                summary: USDT transfer() calls with receipts and event logs
                value:
                  type: tron
                  fromBlock: 79257136
                  toBlock: 79257200
                  fields:
                    block:
                      number: true
                      timestamp: true
                    transaction:
                      hash: true
                      type: true
                      parameter: true
                      result: true
                      energyUsageTotal: true
                      netUsage: true
                  triggerSmartContractTransactions:
                    - contract:
                        - 41a614f803b6fd780986a42c78ec9c7f77e6ded13c
                      sighash:
                        - a9059cbb
                      logs: true
              Native TRX Transfers:
                summary: Native TRX Transfers
                value:
                  type: tron
                  fromBlock: 79257136
                  toBlock: 79257200
                  fields:
                    block:
                      number: true
                      timestamp: true
                    transaction:
                      hash: true
                      type: true
                      parameter: true
                  transferTransactions:
                    - {}
              Internal Transactions:
                summary: Internal transactions (TRX moved inside contract calls)
                value:
                  type: tron
                  fromBlock: 79257136
                  toBlock: 79257200
                  fields:
                    block:
                      number: true
                      timestamp: true
                    internalTransaction:
                      hash: true
                      callerAddress: true
                      transferToAddress: true
                      callValueInfo: true
                      note: true
                      transactionIndex: true
                      internalTransactionIndex: true
                  internalTransactions:
                    - {}
      responses:
        '200':
          description: >-
            A stream of blocks in JSON lines format, optionally gzipped. Can be
            empty if the data query has a bounded range and all blocks in the
            range have been skipped. May include X-Sqd-Finalized-Head-Number and
            X-Sqd-Finalized-Head-Hash headers, indicating the latest finalized
            block that's on the same chain as the returned blocks.
          headers:
            X-Sqd-Finalized-Head-Number:
              schema:
                type: integer
                format: int64
              description: >-
                Block number of the latest finalized block. Returned blocks can
                be above, at, or below this block number.
              required: false
            X-Sqd-Finalized-Head-Hash:
              schema:
                type: string
              description: >-
                Hash of the latest finalized block. All returned blocks are
                guaranteed to belong to the same (not necessarily final) chain
                as this block.
              required: false
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Block'
              examples:
                USDT Transfer Log:
                  summary: Block with a USDT (TRC-20) transfer log
                  value:
                    - header:
                        number: 79257136
                        hash: >-
                          0000000004b95e300d9e52d878f88dba9776017f01923b8ab8c3680fc49b0771
                        timestamp: 1768435116000
                      logs:
                        - transactionIndex: 2
                          logIndex: 0
                          address: a614f803b6fd780986a42c78ec9c7f77e6ded13c
                          data: >-
                            00000000000000000000000000000000000000000000000000000003c4a67e65
                          topics:
                            - >-
                              ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef
                            - >-
                              000000000000000000000000056d10e7b4ffd1ea56fd26f7ba5cedb3cf022ed7
                            - >-
                              000000000000000000000000201ec2a6830ce97884f284db2c080612de342806
                      transactions: []
                      internalTransactions: []
                USDT transfer() Call:
                  summary: Block with a USDT transfer() smart-contract call
                  value:
                    - header:
                        number: 79257136
                        timestamp: 1768435116000
                      transactions:
                        - transactionIndex: 2
                          hash: >-
                            3efc0ae9bd783baee44a4dde01940fd8436ad4767163cc26f1d5709270dae794
                          type: TriggerSmartContract
                          result: SUCCESS
                          contractAddress: 41a614f803b6fd780986a42c78ec9c7f77e6ded13c
                          energyUsageTotal: '130285'
                          netUsage: '345'
                          parameter:
                            type_url: type.googleapis.com/protocol.TriggerSmartContract
                            value:
                              owner_address: 41056d10e7b4ffd1ea56fd26f7ba5cedb3cf022ed7
                              contract_address: 41a614f803b6fd780986a42c78ec9c7f77e6ded13c
                              data: >-
                                a9059cbb000000000000000000000000201ec2a6830ce97884f284db2c080612de34280600000000000000000000000000000000000000000000000000000003c4a67e65
                      logs: []
                      internalTransactions: []
        '204':
          description: >-
            No new blocks available in the requested range - the range is
            entirely above the current dataset head. Not an error and the
            response has no body; wait and retry to keep following the chain
            head. The portal may wait for up to 5s before returning this.
          content:
            text/plain:
              schema:
                type: string
              example: No new blocks available in the requested range
          headers:
            X-Sqd-Finalized-Head-Number:
              schema:
                type: integer
                format: int64
              description: Block number of the latest finalized block.
              required: false
            X-Sqd-Finalized-Head-Hash:
              schema:
                type: string
              description: Hash of the latest finalized block.
              required: false
        '400':
          description: >
            Invalid request or query (`error.code` is `malformed_request`;
            `error.param` names the request field at fault when one is).
            Possible causes: (1) request headers or body encoding are incorrect;
            (2) the query is invalid - `error.message` includes an explanation;
            (3) fromBlock is below the dataset's start_block (see /metadata).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  type: invalid_request_error
                  code: malformed_request
                  message: 'Bad request: fromBlock must be a non-negative integer'
                  param: fromBlock
        '404':
          description: Dataset not found (`error.code` is `unknown_dataset`)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  type: invalid_request_error
                  code: unknown_dataset
                  message: 'Unknown dataset: no-such-chain'
        '409':
          description: >-
            Parent block hash mismatch (`error.code` is `base_block_mismatch`) -
            the query's parentBlockHash does not match the canonical parent of
            the first requested block, typically after a chain reorganization.
            Walk the top-level previousBlocks list to find the most recent block
            you have already processed, roll back your data to it, then resume
            the stream from the next block, passing that block's hash as
            parentBlockHash. If nothing in the list matches your records,
            restart from an earlier fromBlock, again with parentBlockHash.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConflictResponse'
        '429':
          description: >-
            Rate limited (`error.type` is `rate_limit_error`). Retry after the
            interval in the Retry-After header; it is always present and counts
            seconds
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  type: rate_limit_error
                  code: overloaded
                  message: Service is overloaded, please try again later
          headers:
            Retry-After:
              schema:
                type: integer
              description: Seconds to wait before retrying (at least 1)
        '500':
          description: >-
            Internal server error (`error.type` is `api_error`). Do not retry;
            report the error together with its request_id
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  type: api_error
                  code: internal_error
                  message: Internal server error
                  request_id: 0198c3f1-...
        '502':
          description: >-
            A data source the Portal depends on is unavailable (`error.code` is
            `upstream_unavailable`) - retry later. A proxied upstream failure
            keeps the upstream's own 5xx status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  type: availability_error
                  code: upstream_unavailable
                  message: Upstream data source is unavailable, please try again later
                  request_id: 0198c3f1-...
        '503':
          description: >-
            Service temporarily unavailable (`error.type` is
            `availability_error`, typically `no_workers` or `retries_exhausted`)
            - retry later. May carry Retry-After; honor it when present
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  type: availability_error
                  code: no_workers
                  message: No workers available for dataset
                  request_id: 0198c3f1-...
          headers:
            Retry-After:
              schema:
                type: integer
              description: Seconds to wait before retrying (at least 1)
        '529':
          description: >-
            Overloaded (`error.code` is `overloaded`) - the Portal or a data
            source is at capacity. Retry after the interval in the Retry-After
            header; it is always present and counts seconds
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  type: rate_limit_error
                  code: overloaded
                  message: Service is overloaded, please try again later
                  request_id: 0198c3f1-...
          headers:
            Retry-After:
              schema:
                type: integer
              description: Seconds to wait before retrying (at least 1)
  /finalized-stream:
    post:
      summary: Stream Finalized Blocks
      x-mint:
        href: /en/api/tron/finalized-stream
        metadata:
          description: Stream finalized Tron blockchain data with the SQD Portal API.
      x-codeSamples:
        - lang: shell
          label: USDT (TRC-20) Transfers
          source: >
            curl --compressed -X POST
            'https://portal.sqd.dev/datasets/tron-mainnet/finalized-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,
                    "transactionIndex": true,
                    "logIndex": true
                  }
                },
                "logs": [{
                  "address": ["a614f803b6fd780986a42c78ec9c7f77e6ded13c"],
                  "topic0": ["ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]
                }]
              }'
        - lang: python
          label: USDT (TRC-20) Transfers
          source: |
            import requests

            response = requests.post(
                "https://portal.sqd.dev/datasets/tron-mainnet/finalized-stream",
                json={
                    "type": "tron",
                    "fromBlock": 79257136,
                    "toBlock": 79257200,
                    "fields": {
                        "block": {"number": True, "timestamp": True},
                        "log": {
                            "address": True,
                            "topics": True,
                            "data": True,
                            "transactionIndex": True,
                            "logIndex": True,
                        },
                    },
                    "logs": [{
                        "address": ["a614f803b6fd780986a42c78ec9c7f77e6ded13c"],
                        "topic0": ["ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"],
                    }],
                },
            )
            blocks = [
                __import__("json").loads(line)
                for line in response.text.splitlines()
                if line
            ]
        - lang: javascript
          label: USDT (TRC-20) Transfers
          source: >
            const response = await
            fetch("https://portal.sqd.dev/datasets/tron-mainnet/finalized-stream",
            {
                method: "POST",
                headers: { "Content-Type": "application/json" },
                body: JSON.stringify({
                    type: "tron",
                    fromBlock: 79257136,
                    toBlock: 79257200,
                    fields: {
                        block: { number: true, timestamp: true },
                        log: {
                            address: true,
                            topics: true,
                            data: true,
                            transactionIndex: true,
                            logIndex: true,
                        },
                    },
                    logs: [{
                        address: ["a614f803b6fd780986a42c78ec9c7f77e6ded13c"],
                        topic0: ["ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"],
                    }],
                }),
            });

            const text = await response.text();

            const blocks = text.split("\n").filter(Boolean).map((line) =>
            JSON.parse(line));
      description: >-
        Streams only finalized blocks matching the provided data query
        (finalized data does not reorganize; a 409 here only means the provided
        parentBlockHash is stale). Query structure is identical to that of the
        /stream endpoint. Required request headers: `Content-Type:
        application/json`; optional request headers: `Accept-Encoding: gzip`,
        `Content-Encoding: gzip`.
      requestBody:
        description: >-
          Data query to filter and retrieve finalized blocks. Request body may
          be gzipped (Content-Encoding: gzip).
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DataQuery'
            examples:
              USDT TRC-20 Transfers:
                summary: USDT (TRC-20) Transfers
                value:
                  type: tron
                  fromBlock: 79257136
                  toBlock: 79257200
                  fields:
                    block:
                      number: true
                      timestamp: true
                    log:
                      address: true
                      topics: true
                      data: true
                      transactionIndex: true
                      logIndex: true
                  logs:
                    - address:
                        - a614f803b6fd780986a42c78ec9c7f77e6ded13c
                      topic0:
                        - >-
                          ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef
      responses:
        '200':
          description: >-
            A stream of finalized blocks in JSON lines format, optionally
            gzipped. Can be empty if the data query has a bounded range and all
            blocks in the range have been skipped.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Block'
              examples:
                USDT Transfer Log:
                  summary: Block with a USDT (TRC-20) transfer log
                  value:
                    - header:
                        number: 79257136
                        hash: >-
                          0000000004b95e300d9e52d878f88dba9776017f01923b8ab8c3680fc49b0771
                        timestamp: 1768435116000
                      logs:
                        - transactionIndex: 2
                          logIndex: 0
                          address: a614f803b6fd780986a42c78ec9c7f77e6ded13c
                          data: >-
                            00000000000000000000000000000000000000000000000000000003c4a67e65
                          topics:
                            - >-
                              ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef
                            - >-
                              000000000000000000000000056d10e7b4ffd1ea56fd26f7ba5cedb3cf022ed7
                            - >-
                              000000000000000000000000201ec2a6830ce97884f284db2c080612de342806
                      transactions: []
                      internalTransactions: []
        '204':
          description: >-
            No new blocks available in the requested range - the range is
            entirely above the current dataset head. Not an error and the
            response has no body; wait and retry to keep following the chain
            head. The portal may wait for up to 5s before returning this.
          content:
            text/plain:
              schema:
                type: string
              example: No new blocks available in the requested range
        '400':
          description: >
            Invalid request or query (`error.code` is `malformed_request`;
            `error.param` names the request field at fault when one is).
            Possible causes: (1) request headers or body encoding are incorrect;
            (2) the query is invalid - `error.message` includes an explanation;
            (3) fromBlock is below the dataset's start_block (see /metadata).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  type: invalid_request_error
                  code: malformed_request
                  message: 'Bad request: fromBlock must be a non-negative integer'
                  param: fromBlock
        '404':
          description: Dataset not found (`error.code` is `unknown_dataset`)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  type: invalid_request_error
                  code: unknown_dataset
                  message: 'Unknown dataset: no-such-chain'
        '409':
          description: >-
            Parent block hash mismatch (`error.code` is `base_block_mismatch`).
            Finalized data does not reorganize, so the provided parentBlockHash
            is stale or was carried over from an unfinalized block. Recover as
            for /stream by walking the top-level previousBlocks list.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConflictResponse'
        '429':
          description: >-
            Rate limited (`error.type` is `rate_limit_error`). Retry after the
            interval in the Retry-After header; it is always present and counts
            seconds
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  type: rate_limit_error
                  code: overloaded
                  message: Service is overloaded, please try again later
          headers:
            Retry-After:
              schema:
                type: integer
              description: Seconds to wait before retrying (at least 1)
        '500':
          description: >-
            Internal server error (`error.type` is `api_error`). Do not retry;
            report the error together with its request_id
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  type: api_error
                  code: internal_error
                  message: Internal server error
                  request_id: 0198c3f1-...
        '502':
          description: >-
            A data source the Portal depends on is unavailable (`error.code` is
            `upstream_unavailable`) - retry later. A proxied upstream failure
            keeps the upstream's own 5xx status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  type: availability_error
                  code: upstream_unavailable
                  message: Upstream data source is unavailable, please try again later
                  request_id: 0198c3f1-...
        '503':
          description: >-
            Service temporarily unavailable (`error.type` is
            `availability_error`, typically `no_workers` or `retries_exhausted`)
            - retry later. May carry Retry-After; honor it when present
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  type: availability_error
                  code: no_workers
                  message: No workers available for dataset
                  request_id: 0198c3f1-...
          headers:
            Retry-After:
              schema:
                type: integer
              description: Seconds to wait before retrying (at least 1)
        '529':
          description: >-
            Overloaded (`error.code` is `overloaded`) - the Portal or a data
            source is at capacity. Retry after the interval in the Retry-After
            header; it is always present and counts seconds
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  type: rate_limit_error
                  code: overloaded
                  message: Service is overloaded, please try again later
                  request_id: 0198c3f1-...
          headers:
            Retry-After:
              schema:
                type: integer
              description: Seconds to wait before retrying (at least 1)
  /head:
    get:
      summary: Latest Block
      x-mint:
        href: /en/api/tron/head
        metadata:
          description: Get the latest Tron block number and hash available from SQD Portal.
      x-codeSamples:
        - lang: shell
          label: Get Latest Tron Block
          source: >
            curl --compressed
            'https://portal.sqd.dev/datasets/tron-mainnet/head'
        - lang: python
          label: Get Latest Tron Block
          source: |
            import requests

            response = requests.get(
                "https://portal.sqd.dev/datasets/tron-mainnet/head"
            )
            head = response.json()
        - lang: javascript
          label: Get Latest Tron Block
          source: >
            const response = await
            fetch("https://portal.sqd.dev/datasets/tron-mainnet/head");

            const head = await response.json();
      description: >-
        Returns the block number and hash of the highest block available in the
        dataset, or null if no blocks are available. Takes real-time data into
        account. Useful mostly for diagnostics, as clients using /stream can get
        this info from the X-Sqd-Finalized-Head-Number and
        X-Sqd-Finalized-Head-Hash response headers.
      responses:
        '200':
          description: Highest block information
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BlockHead'
              examples:
                tron-head:
                  summary: Latest Tron block
                  value:
                    number: 83934980
                    hash: >-
                      000000000500bf041e3f1de4e81528fc3225281e4e6bde5a9fbe821de67ef349
        '404':
          description: Dataset not found (`error.code` is `unknown_dataset`)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  type: invalid_request_error
                  code: unknown_dataset
                  message: 'Unknown dataset: no-such-chain'
  /finalized-head:
    get:
      summary: Latest Finalized Block
      x-mint:
        href: /en/api/tron/finalized-head
        metadata:
          description: Get the latest finalized Tron block number and hash from SQD Portal.
      x-codeSamples:
        - lang: shell
          label: Get Latest Finalized Tron Block
          source: >
            curl --compressed
            'https://portal.sqd.dev/datasets/tron-mainnet/finalized-head'
        - lang: python
          label: Get Latest Finalized Tron Block
          source: |
            import requests

            response = requests.get(
                "https://portal.sqd.dev/datasets/tron-mainnet/finalized-head"
            )
            head = response.json()
        - lang: javascript
          label: Get Latest Finalized Tron Block
          source: >
            const response = await
            fetch("https://portal.sqd.dev/datasets/tron-mainnet/finalized-head");

            const head = await response.json();
      description: >-
        Returns the block number and hash of the highest finalized block
        available in the dataset, or null if no blocks are available. Useful
        mostly for diagnostics, as clients using /stream can get this info from
        the X-Sqd-Finalized-Head-Number and X-Sqd-Finalized-Head-Hash response
        headers.
      responses:
        '200':
          description: Highest finalized block information
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BlockHead'
              examples:
                tron-finalized:
                  summary: Latest finalized Tron block
                  value:
                    number: 83934962
                    hash: >-
                      000000000500bef2dfdb39f86fa53f8d5225ee3f8595cc89d5c87904ca76b4ad
        '404':
          description: Dataset not found (`error.code` is `unknown_dataset`)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  type: invalid_request_error
                  code: unknown_dataset
                  message: 'Unknown dataset: no-such-chain'
  /timestamps/{timestamp}/block:
    get:
      summary: Block at Timestamp
      x-mint:
        href: /en/api/tron/timestamp-block
        metadata:
          description: Resolve a Unix timestamp to a Tron block with the SQD Portal API.
      x-codeSamples:
        - lang: shell
          label: Resolve timestamp to block
          source: >
            curl
            'https://portal.sqd.dev/datasets/tron-mainnet/timestamps/1768435200/block'
        - lang: python
          label: Resolve timestamp to block
          source: |
            import requests

            response = requests.get(
                "https://portal.sqd.dev/datasets/tron-mainnet/timestamps/1768435200/block"
            )
            block_number = response.json()["block_number"]
        - lang: javascript
          label: Resolve timestamp to block
          source: >
            const response = await
            fetch("https://portal.sqd.dev/datasets/tron-mainnet/timestamps/1768435200/block");

            const { block_number } = await response.json();
      description: >
        Resolves a Unix timestamp (in seconds) to a block number. Returns the
        first block whose timestamp is greater than or equal to `timestamp`.
        Resolution prefers archival data and falls back to the real-time source
        when available; the `x-sqd-data-source` response header reports which
        source served the result (`network` or `real_time`).
      parameters:
        - name: timestamp
          in: path
          required: true
          schema:
            type: integer
            format: int64
            default: 1768435200
            example: 1768435200
          description: Unix timestamp in seconds.
      responses:
        '200':
          description: Block number resolved.
          headers:
            x-sqd-data-source:
              schema:
                type: string
                enum:
                  - network
                  - real_time
              description: Source that served the result.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BlockNumberResponse'
              examples:
                tron-mainnet:
                  summary: First block at or after the timestamp
                  value:
                    block_number: 79257136
        '400':
          description: >-
            Unparseable `timestamp` path segment (`error.code` is
            `malformed_request`), or the real-time source refused the query the
            Portal generated on the client's behalf; read `error.message`
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  type: invalid_request_error
                  code: malformed_request
                  message: 'Bad request: fromBlock must be a non-negative integer'
                  param: fromBlock
        '404':
          description: >-
            No block at or after the given timestamp yet (`error.code` is
            `not_found`)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  type: invalid_request_error
                  code: not_found
                  message: No block at or after the given timestamp
        '429':
          description: >-
            Rate limited (`error.type` is `rate_limit_error`). Retry after the
            interval in the Retry-After header; it is always present and counts
            seconds
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  type: rate_limit_error
                  code: overloaded
                  message: Service is overloaded, please try again later
          headers:
            Retry-After:
              schema:
                type: integer
              description: Seconds to wait before retrying (at least 1)
        '500':
          description: >-
            Internal server error (`error.type` is `api_error`). Do not retry;
            report the error together with its request_id
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  type: api_error
                  code: internal_error
                  message: Internal server error
                  request_id: 0198c3f1-...
        '502':
          description: >-
            A data source the Portal depends on is unavailable (`error.code` is
            `upstream_unavailable`) - retry later. A proxied upstream failure
            keeps the upstream's own 5xx status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  type: availability_error
                  code: upstream_unavailable
                  message: Upstream data source is unavailable, please try again later
                  request_id: 0198c3f1-...
        '503':
          description: >-
            Service temporarily unavailable (`error.type` is
            `availability_error`, typically `no_workers` or `retries_exhausted`)
            - retry later. May carry Retry-After; honor it when present
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  type: availability_error
                  code: no_workers
                  message: No workers available for dataset
                  request_id: 0198c3f1-...
          headers:
            Retry-After:
              schema:
                type: integer
              description: Seconds to wait before retrying (at least 1)
        '529':
          description: >-
            Overloaded (`error.code` is `overloaded`) - the Portal or a data
            source is at capacity. Retry after the interval in the Retry-After
            header; it is always present and counts seconds
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  type: rate_limit_error
                  code: overloaded
                  message: Service is overloaded, please try again later
                  request_id: 0198c3f1-...
          headers:
            Retry-After:
              schema:
                type: integer
              description: Seconds to wait before retrying (at least 1)
components:
  schemas:
    BlockNumberResponse:
      type: object
      properties:
        block_number:
          type: integer
          format: int64
          description: >-
            Number of the first block whose timestamp is greater than or equal
            to the requested timestamp.
          example: 79257136
      required:
        - block_number
    DatasetMetadata:
      type: object
      properties:
        dataset:
          type: string
          description: >-
            The default name used to reference this dataset (e.g.,
            tron-mainnet).
          example: tron-mainnet
        aliases:
          type: array
          items:
            type: string
          description: Alternative names for the dataset.
          example: []
        real_time:
          type: boolean
          description: Indicates if the dataset has real-time data.
          example: true
        start_block:
          type: integer
          format: int64
          description: The block number of the first known block.
          example: 0
      required:
        - dataset
        - aliases
        - real_time
    DataQuery:
      type: object
      properties:
        type:
          type: string
          enum:
            - tron
          default: tron
          description: The type of blockchain data (fixed to Tron for this API).
        fromBlock:
          type: integer
          format: int64
          description: The block number to start fetching from (inclusive).
        toBlock:
          type: integer
          format: int64
          description: >-
            The block number to fetch up to (inclusive). Optional; if omitted,
            streams until dataset height or timeout.
        parentBlockHash:
          type: string
          description: Expected hash of the parent of the first requested block.
        includeAllBlocks:
          type: boolean
          description: If true, includes blocks with no matching data in the response.
          default: false
        fields:
          type: object
          description: Field selector for data items to retrieve.
          properties:
            block:
              type: object
              description: Field selector for block headers.
              properties:
                number:
                  type: boolean
                  description: Block number.
                hash:
                  type: boolean
                  description: Block ID (hash). The first 8 bytes encode the block number.
                parentHash:
                  type: boolean
                  description: ID (hash) of the parent block.
                txTrieRoot:
                  type: boolean
                  description: Root hash of the block's transaction Merkle trie.
                version:
                  type: boolean
                  description: Block version number.
                timestamp:
                  type: boolean
                  description: Block timestamp in Unix milliseconds.
                witnessAddress:
                  type: boolean
                  description: >-
                    Address of the Super Representative (witness) that produced
                    the block (41-prefixed hex).
                witnessSignature:
                  type: boolean
                  description: Signature of the producing witness over the block header.
              default:
                number: true
                hash: true
                parentHash: true
            transaction:
              type: object
              description: Field selector for transactions.
              properties:
                transactionIndex:
                  type: boolean
                  description: Index of the transaction in the block.
                hash:
                  type: boolean
                  description: Transaction hash (txID).
                type:
                  type: boolean
                  description: >-
                    Contract type of the transaction, e.g. TransferContract,
                    TransferAssetContract, TriggerSmartContract.
                ret:
                  type: boolean
                  description: >-
                    Transaction result array; each entry carries fields such as
                    contractRet (e.g. SUCCESS, REVERT).
                signature:
                  type: boolean
                  description: List of signatures authorizing the transaction.
                parameter:
                  type: boolean
                  description: >-
                    Decoded contract payload (type_url plus a value object
                    holding the contract-specific fields).
                permissionId:
                  type: boolean
                  description: Permission id used for multi-signature accounts.
                refBlockBytes:
                  type: boolean
                  description: Reference block bytes used for transaction expiration.
                refBlockHash:
                  type: boolean
                  description: Reference block hash used for transaction expiration.
                feeLimit:
                  type: boolean
                  description: >-
                    Maximum fee (in SUN) the sender is willing to pay for
                    smart-contract execution.
                expiration:
                  type: boolean
                  description: Expiration time of the transaction in Unix milliseconds.
                timestamp:
                  type: boolean
                  description: Transaction timestamp in Unix milliseconds.
                rawDataHex:
                  type: boolean
                  description: Hex-encoded raw transaction data.
                fee:
                  type: boolean
                  description: Total fee charged for the transaction, in SUN.
                contractResult:
                  type: boolean
                  description: Hex-encoded return value of the executed smart contract.
                contractAddress:
                  type: boolean
                  description: >-
                    Address of the contract invoked or created (41-prefixed
                    hex).
                resMessage:
                  type: boolean
                  description: Result message returned by the virtual machine, if any.
                withdrawAmount:
                  type: boolean
                  description: Amount withdrawn (e.g. staking rewards), in SUN.
                unfreezeAmount:
                  type: boolean
                  description: Amount unfrozen by the transaction, in SUN.
                withdrawExpireAmount:
                  type: boolean
                  description: Amount of expired unfreeze withdrawn, in SUN.
                cancelUnfreezeV2Amount:
                  type: boolean
                  description: >-
                    Map of amounts re-frozen when cancelling pending Stake 2.0
                    unfreezes.
                result:
                  type: boolean
                  description: Execution result of the transaction receipt (e.g. SUCCESS).
                energyFee:
                  type: boolean
                  description: Fee paid for energy consumed, in SUN.
                energyUsage:
                  type: boolean
                  description: Energy consumed from the caller's own resources.
                energyUsageTotal:
                  type: boolean
                  description: Total energy consumed by the transaction.
                netUsage:
                  type: boolean
                  description: Bandwidth (net) consumed from the caller's own resources.
                netFee:
                  type: boolean
                  description: Fee paid for bandwidth consumed, in SUN.
                originEnergyUsage:
                  type: boolean
                  description: >-
                    Energy paid by the contract owner (origin) under an
                    energy-sharing policy.
                energyPenaltyTotal:
                  type: boolean
                  description: Additional energy penalty applied to the transaction.
              default:
                hash: true
            log:
              type: object
              description: Field selector for logs (TVM event logs).
              properties:
                transactionIndex:
                  type: boolean
                  description: Index of the parent transaction in the block.
                logIndex:
                  type: boolean
                  description: Index of the log in the block.
                address:
                  type: boolean
                  description: >-
                    Contract address that emitted the log (20-byte EVM-style
                    hex, no 41 prefix).
                data:
                  type: boolean
                  description: Non-indexed log data.
                topics:
                  type: boolean
                  description: Indexed log topics (topic0 is the event signature).
              default:
                topics: true
            internalTransaction:
              type: object
              description: Field selector for internal transactions.
              properties:
                transactionIndex:
                  type: boolean
                  description: Index of the parent transaction in the block.
                internalTransactionIndex:
                  type: boolean
                  description: >-
                    Index of the internal transaction within its parent
                    transaction.
                hash:
                  type: boolean
                  description: Hash of the internal transaction.
                callerAddress:
                  type: boolean
                  description: >-
                    Address that initiated the internal transaction (41-prefixed
                    hex).
                transferToAddress:
                  type: boolean
                  description: >-
                    Recipient address of the internal transaction (41-prefixed
                    hex).
                callValueInfo:
                  type: boolean
                  description: >-
                    List of transferred values, each with callValue (amount in
                    SUN) and tokenId (null for TRX, a TRC-10 asset id
                    otherwise).
                note:
                  type: boolean
                  description: >-
                    Hex-encoded note describing the internal call (e.g. 63616c6c
                    for "call").
                rejected:
                  type: boolean
                  description: Whether the internal transaction was rejected.
                extra:
                  type: boolean
                  description: Optional extra data attached to the internal transaction.
        transactions:
          type: array
          description: Transaction data requests. Matches transactions by contract type.
          items:
            type: object
            properties:
              type:
                type: array
                items:
                  type: string
                description: >-
                  Contract types to match, e.g. ["TransferContract",
                  "TriggerSmartContract"].
              logs:
                type: boolean
                description: Fetch all event logs emitted by matching transactions.
              internalTransactions:
                type: boolean
                description: Fetch all internal transactions of matching transactions.
            description: >-
              An empty object matches all transactions; an empty array matches
              no transactions.
        transferTransactions:
          type: array
          description: >-
            Native TRX transfer requests (TransferContract). Addresses are
            41-prefixed lowercase hex.
          items:
            type: object
            properties:
              owner:
                type: array
                items:
                  type: string
                description: Sender (owner) addresses (41-prefixed hex).
              to:
                type: array
                items:
                  type: string
                description: Recipient addresses (41-prefixed hex).
              logs:
                type: boolean
                description: Fetch all event logs emitted by matching transactions.
              internalTransactions:
                type: boolean
                description: Fetch all internal transactions of matching transactions.
            description: An empty object matches all TRX transfers.
        transferAssetTransactions:
          type: array
          description: TRC-10 asset transfer requests (TransferAssetContract).
          items:
            type: object
            properties:
              owner:
                type: array
                items:
                  type: string
                description: Sender (owner) addresses (41-prefixed hex).
              to:
                type: array
                items:
                  type: string
                description: Recipient addresses (41-prefixed hex).
              asset:
                type: array
                items:
                  type: string
                description: TRC-10 asset ids to match.
              logs:
                type: boolean
                description: Fetch all event logs emitted by matching transactions.
              internalTransactions:
                type: boolean
                description: Fetch all internal transactions of matching transactions.
            description: An empty object matches all TRC-10 transfers.
        triggerSmartContractTransactions:
          type: array
          description: >-
            Smart-contract call requests (TriggerSmartContract). Covers TRC-20
            and all other contract interactions.
          items:
            type: object
            properties:
              owner:
                type: array
                items:
                  type: string
                description: Caller (owner) addresses (41-prefixed hex).
              contract:
                type: array
                items:
                  type: string
                description: >-
                  Target contract addresses (41-prefixed hex), e.g. the USDT
                  contract 41a614f803b6fd780986a42c78ec9c7f77e6ded13c.
              sighash:
                type: array
                items:
                  type: string
                description: >-
                  Function selectors (first 4 bytes of calldata), e.g. a9059cbb
                  for transfer(address,uint256).
              logs:
                type: boolean
                description: Fetch all event logs emitted by matching transactions.
              internalTransactions:
                type: boolean
                description: Fetch all internal transactions of matching transactions.
            description: An empty object matches all smart-contract calls.
        logs:
          type: array
          description: Log data requests (TVM event logs).
          items:
            type: object
            properties:
              address:
                type: array
                items:
                  type: string
                description: >-
                  Contract addresses emitting the logs (20-byte EVM-style hex,
                  no 41 prefix, lowercase).
              topic0:
                type: array
                items:
                  type: string
                description: First topic of the log (e.g., event signature).
              topic1:
                type: array
                items:
                  type: string
              topic2:
                type: array
                items:
                  type: string
              topic3:
                type: array
                items:
                  type: string
              transaction:
                type: boolean
                description: Fetch the parent transaction for matching logs.
            description: An empty object matches all logs; an empty array matches no logs.
        internalTransactions:
          type: array
          description: Internal transaction data requests.
          items:
            type: object
            properties:
              caller:
                type: array
                items:
                  type: string
                description: Caller addresses (41-prefixed hex).
              transferTo:
                type: array
                items:
                  type: string
                description: Recipient addresses (41-prefixed hex).
              transaction:
                type: boolean
                description: >-
                  Fetch the parent transaction for matching internal
                  transactions.
            description: >-
              An empty object matches all internal transactions; an empty array
              matches none.
      required:
        - type
        - fromBlock
    Block:
      type: object
      properties:
        header:
          type: object
          description: >-
            Block header data. Fields are conditionally returned based on the
            `fields.block` parameter in the request. Only requested fields will
            be included in the response.
          properties:
            number:
              type: integer
              format: uint64
              description: Block number.
            hash:
              type: string
              description: Block ID (hash).
            parentHash:
              type: string
              description: Parent block ID (hash).
            txTrieRoot:
              type: string
              description: Root hash of the block's transaction Merkle trie.
            version:
              type: integer
              description: Block version number.
            timestamp:
              type: integer
              format: int64
              description: Block timestamp in Unix milliseconds.
            witnessAddress:
              type: string
              description: Address of the producing witness (41-prefixed hex).
            witnessSignature:
              type: string
              description: Signature of the producing witness over the block header.
        transactions:
          type: array
          items:
            type: object
            properties:
              transactionIndex:
                type: integer
                description: Index of the transaction in the block.
              hash:
                type: string
                description: Transaction hash (txID).
              type:
                type: string
                description: >-
                  Contract type of the transaction, e.g. TransferContract,
                  TriggerSmartContract.
              ret:
                type: array
                description: Transaction result entries.
                items:
                  type: object
                  properties:
                    contractRet:
                      type: string
                      description: Contract execution result, e.g. SUCCESS or REVERT.
              signature:
                type: array
                items:
                  type: string
                description: Signatures authorizing the transaction.
              parameter:
                type: object
                description: >-
                  Decoded contract payload (type_url plus a contract-specific
                  value object). Address fields inside value are 41-prefixed
                  hex.
                properties:
                  type_url:
                    type: string
                    description: >-
                      Protobuf type URL of the contract, e.g.
                      type.googleapis.com/protocol.TriggerSmartContract.
                  value:
                    type: object
                    description: >-
                      Contract-specific fields (e.g. owner_address, to_address,
                      amount, contract_address, data, asset_name).
              permissionId:
                type:
                  - integer
                  - 'null'
                description: >-
                  Permission id used for multi-signature accounts. Null when not
                  set.
              refBlockBytes:
                type: string
                description: Reference block bytes used for transaction expiration.
              refBlockHash:
                type: string
                description: Reference block hash used for transaction expiration.
              feeLimit:
                type:
                  - string
                  - 'null'
                description: >-
                  Maximum fee (in SUN) the sender is willing to pay, as a
                  decimal string. May be null.
              expiration:
                type: integer
                format: int64
                description: Expiration time of the transaction in Unix milliseconds.
              timestamp:
                type:
                  - integer
                  - 'null'
                format: int64
                description: Transaction timestamp in Unix milliseconds. May be null.
              rawDataHex:
                type: string
                description: Hex-encoded raw transaction data.
              fee:
                type:
                  - string
                  - 'null'
                description: Total fee charged, in SUN, as a decimal string. May be null.
              contractResult:
                type: string
                description: Hex-encoded smart-contract return value.
              contractAddress:
                type:
                  - string
                  - 'null'
                description: >-
                  Address of the contract invoked or created (41-prefixed hex).
                  Null for transactions that do not target a contract.
              resMessage:
                type:
                  - string
                  - 'null'
                description: >-
                  Result message returned by the virtual machine, if any. May be
                  null.
              withdrawAmount:
                type:
                  - string
                  - 'null'
                description: Amount withdrawn, in SUN, as a decimal string. May be null.
              unfreezeAmount:
                type:
                  - string
                  - 'null'
                description: Amount unfrozen, in SUN, as a decimal string. May be null.
              withdrawExpireAmount:
                type:
                  - string
                  - 'null'
                description: >-
                  Amount of expired unfreeze withdrawn, in SUN, as a decimal
                  string. May be null.
              cancelUnfreezeV2Amount:
                type:
                  - object
                  - 'null'
                description: >-
                  Map of amounts re-frozen when cancelling pending Stake 2.0
                  unfreezes. May be null.
              result:
                type:
                  - string
                  - 'null'
                description: >-
                  Execution result of the transaction receipt, e.g. SUCCESS. May
                  be null.
              energyFee:
                type:
                  - string
                  - 'null'
                description: >-
                  Fee paid for energy consumed, in SUN, as a decimal string. May
                  be null.
              energyUsage:
                type:
                  - string
                  - 'null'
                description: >-
                  Energy consumed from the caller's own resources, as a decimal
                  string. May be null.
              energyUsageTotal:
                type:
                  - string
                  - 'null'
                description: >-
                  Total energy consumed by the transaction, as a decimal string.
                  May be null.
              netUsage:
                type:
                  - string
                  - 'null'
                description: >-
                  Bandwidth (net) consumed from the caller's own resources, as a
                  decimal string. May be null.
              netFee:
                type:
                  - string
                  - 'null'
                description: >-
                  Fee paid for bandwidth consumed, in SUN, as a decimal string.
                  May be null.
              originEnergyUsage:
                type:
                  - string
                  - 'null'
                description: >-
                  Energy paid by the contract owner (origin), as a decimal
                  string. May be null.
              energyPenaltyTotal:
                type:
                  - string
                  - 'null'
                description: >-
                  Additional energy penalty applied, as a decimal string. May be
                  null.
        logs:
          type: array
          items:
            type: object
            properties:
              transactionIndex:
                type: integer
                description: Index of the parent transaction.
              logIndex:
                type: integer
                description: Index of the log in the block.
              address:
                type: string
                description: >-
                  Contract address emitting the log (20-byte EVM-style hex, no
                  41 prefix).
              data:
                type:
                  - string
                  - 'null'
                description: >-
                  Non-indexed log data. Null when the event has no non-indexed
                  data.
              topics:
                type: array
                items:
                  type: string
                description: Indexed log topics (topic0 is the event signature).
        internalTransactions:
          type: array
          items:
            type: object
            properties:
              transactionIndex:
                type: integer
                description: Index of the parent transaction.
              internalTransactionIndex:
                type: integer
                description: Index of the internal transaction within its parent.
              hash:
                type: string
                description: Hash of the internal transaction.
              callerAddress:
                type: string
                description: >-
                  Address that initiated the internal transaction (41-prefixed
                  hex).
              transferToAddress:
                type: string
                description: Recipient address (41-prefixed hex).
              callValueInfo:
                type: array
                description: Transferred values for the internal transaction.
                items:
                  type: object
                  properties:
                    callValue:
                      type:
                        - integer
                        - 'null'
                      format: int64
                      description: Transferred amount in SUN. May be null.
                    tokenId:
                      type:
                        - string
                        - 'null'
                      description: TRC-10 asset id, or null for TRX transfers.
              note:
                type: string
                description: >-
                  Hex-encoded note describing the internal call (e.g. 63616c6c
                  for "call").
              rejected:
                type:
                  - boolean
                  - 'null'
                description: Whether the internal transaction was rejected. May be null.
              extra:
                type:
                  - string
                  - 'null'
                description: >-
                  Optional extra data attached to the internal transaction. Null
                  when absent.
    BlockHead:
      type: object
      properties:
        number:
          type: integer
          format: int64
          description: Block number of the highest available block.
          example: 83934980
        hash:
          type: string
          description: ID (hash) of the highest available block.
          example: 000000000500bf041e3f1de4e81528fc3225281e4e6bde5a9fbe821de67ef349
      nullable: true
    ErrorDetail:
      type: object
      description: >-
        Machine-readable error detail. Branch on `type`; match on `code` for one
        specific case.
      properties:
        type:
          type: string
          description: >-
            Coarse category to branch on. One of `invalid_request_error`,
            `rate_limit_error`, `availability_error`, or `api_error`. Treat an
            unknown `code` according to its `type`.
          example: invalid_request_error
        code:
          type: string
          description: >-
            Specific cause, stable across releases. Match on this rather than on
            `message`.
          example: base_block_mismatch
        message:
          type: string
          description: >-
            Human-readable detail. Prose, not stable; do not parse or match on
            it.
        param:
          type: string
          description: The request parameter at fault, when the error is about one.
        request_id:
          type: string
          description: >-
            Echo of the `x-request-id` response header, included in the body on
            5xx errors. Quote it when reporting a problem.
      required:
        - type
        - code
        - message
    ErrorResponse:
      type: object
      description: Error body shared by every failing response.
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetail'
      required:
        - error
      example:
        error:
          type: invalid_request_error
          code: unknown_dataset
          message: 'Unknown dataset: no-such-chain'
    ConflictResponse:
      type: object
      description: >-
        The 409 body carries the standard error envelope plus a top-level
        `previousBlocks` list - a slice of the current canonical chain at and
        below the conflict point, in ascending block-number order.
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetail'
        previousBlocks:
          type: array
          description: >-
            `{ number, hash }` pairs from the current canonical chain in
            ascending order; the last entry is the most recent block at or below
            the conflict point. Guaranteed to contain at least the parent of the
            requested fromBlock.
          items:
            type: object
            properties:
              number:
                type: integer
                format: int64
              hash:
                type: string
            required:
              - number
              - hash
      required:
        - error
        - previousBlocks
      example:
        error:
          type: invalid_request_error
          code: base_block_mismatch
          message: Base block mismatch
        previousBlocks:
          - number: 21780871
            hash: 0xab12cd...
          - number: 21780872
            hash: 0xf6a96a29...
