Skip to main content
Open private SQD Network offers access to Tron data. The gateway is at
V2 gateway worker requests require an API key. Get one at portal.sqd.dev and pass it in an Authorization: Bearer <key> header. GET /height on the router works without a key.
SQD Network API distributes the requests over a (potentially decentralized) network of workers. The main gateway URL points at a router that provides URLs of workers that do the heavy lifting. Each worker has its own range of blocks. Suppose you want to retrieve an output of some query on a block range starting at firstBlock (can be the genesis block) and ending at the highest available block. Proceed as follows:
  1. Retrieve the dataset height from the router with GET /height and make sure it’s above firstBlock.
  2. Save the value of firstBlock to some variable, say currentBlock.
  3. Query the router for an URL of a worker that has the data for currentBlock with GET /${currentBlock}/worker.
  4. Retrieve the data from the worker by posting the query (POST /), setting the "fromBlock" query field to ${currentBlock}.
  5. Parse the retrieved data to get a batch of query data plus the height of the last block available from the current worker. Take the header.number field of the last element of the retrieved JSON array - it is the height you want. Even if your query returns no data, you’ll still get the block data for the last block in the range, so this procedure is safe.
  6. Set currentBlock to the height from the previous step plus one.
  7. Repeat steps 3-6 until all the required data is retrieved.
Implementation examples:
Suppose we want all token burns starting from block 58_000_000. We have to:
  1. Verify that the dataset has reached the required height:
    Output
  2. Remember that your current height is 58000000.
  3. Get a worker URL for the current height
    Output is a worker URL, e.g.
  4. Retrieve the data from the worker
    The output is a JSON array of per-block data. Its last element holds the highest block available from this worker:
  5. Observe the header.number of the last list item, say 59286799. To get the rest of the data, request a worker that has blocks from 59286800 on:
    This part of the dataset may be located on another host.
  6. Repeat steps 4 and 5 until the dataset height is reached.
Full code here.

Router API

Example response: 84700964.
The returned worker will be capable of processing POST / requests in which the "fromBlock" field is equal to ${firstBlock}.Example response: https://rb06.sqd-archive.net/worker/query/czM6Ly90cm9uLW1haW5uZXQ.

Worker API

Query Fields
  • fromBlock: Block number to start from (inclusive).
  • toBlock: (optional) Block number to end on (inclusive). If this is not given, the query will go on for a fixed amount of time or until it reaches the height of the dataset.
  • includeAllBlocks: (optional) If true, the Network will include blocks that contain no data selected by data requests into its response.
  • fields: (optional) A selector of data fields to retrieve. Common for all data items.
  • logs: (optional) A list of log requests. An empty list requests no data.
  • transactions: (optional) A list of general transaction requests. An empty list requests no data.
  • transferTransactions: (optional) A list of “transfer” transaction requests. An empty list requests no data.
  • transferAssetTransactions: (optional) A list of “transfer asset” transaction requests. An empty list requests no data.
  • triggerSmartContractTransactions: (optional) A list of “trigger smart contract” transaction requests. An empty list requests no data.
  • internalTransactions: (optional) A list of internal transaction requests. An empty list requests no data.
This requests USDT Transfer(address,address,uint256) event logs together with their parent transactions on a single block:
The response is a JSON array of per-block items shaped as
with header.number, header.hash and header.parentHash always present and the rest of the fields as requested by the fields selector.

Data requests

Addresses in all data requests must be in hex without 0x and in lowercase. Example:
All addresses in the responses will be in this format, too.

Logs

  • address: the set of addresses of contracts emitting the logs. Omit to subscribe to events from all contracts in the network.
  • topicN: the set of values of topicN.
A log will be included in the response if it matches all the requests. An empty array matches no logs; omitted or null request matches any log. With transaction: true all parent transactions will be included into the response.

Transactions

General

  • type: the set of acceptable transaction types.
A transaction will be included in the response if it matches all the requests (just the type request in this case). An empty array matches no transactions; omitted or null request matches any transaction. With logs: true all logs emitted by the transactions will be included into the response. With internalTransactions: true all the internal transactions induced by the selected transactions will be included into the response.

“transfer”

  • owner: the set of owner addresses for which the transfer transactions should be retrieved.
  • to: the set of destination addresses.
A transaction will be included in the response if it matches all the requests. An empty array matches no transactions; omitted or null request matches any transaction. With logs: true all logs emitted by the transactions will be included into the response. With internalTransactions: true all the internal transactions induced by the selected transactions will be included into the response.

“transfer asset”

  • owner: the set of owner addresses for which the transfer transactions should be retrieved.
  • to: the set of destination addresses.
  • asset: the set of asset contract addresses.
A transaction will be included in the response if it matches all the requests. An empty array matches no transactions; omitted or null request matches any transaction. With logs: true all logs emitted by the transactions will be included into the response. With internalTransactions: true all the internal transactions induced by the selected transactions will be included into the response.

“trigger smart contract”

  • owner: the set of addresses of call owners.
  • contract: the set of addresses of contracts being called.
  • sighash: the set of 4-byte signature hashes of the called functions, hex-encoded without a 0x prefix.
A transaction will be included in the response if it matches all the requests. An empty array matches no transactions; omitted or null request matches any transaction. With logs: true all logs emitted by the transactions will be included into the response. With internalTransactions: true all the internal transactions induced by the selected transactions will be included into the response.

Internal transactions

  • caller: the set of addresses of caller contracts.
  • transferTo: the set of addresses of receivers of TRX or TRC10 tokens.
A transaction will be included in the response if it matches all the requests. An empty array matches no transactions; omitted or null request matches any transaction. With transaction: true all parent transactions for the selected internal transactions will be included into the response.

Data fields selector

A selector of fields for the returned data items. Its structure is as follows:
The transaction field selector is common for all transaction types except for the internal transactions. A valid field selector of any given type is a JSON that has a subset of that type’s fields as keys and true as values, e.g. {"hash": true, "timestamp": true}. Fields marked always present below are returned regardless of the selector.

Block fields

number, hash and parentHash are always present. The selectable fields are:

Log fields

logIndex and transactionIndex are always present. The selectable fields are:

Transaction fields

transactionIndex is always present. The selectable fields are:

Internal transaction fields

transactionIndex and internalTransactionIndex are always present. The selectable fields are: