Skip to main content
This guide moves a Tron squid that reads historical data through the v2 gateway (.setGateway()) to SQD Portal. It is a configuration change: @subsquid/tron-processor 1.0 replaces the gateway with .setPortal() and keeps the rest of the API. Data requests, field selection, the data model and your handlers stay as they are. The HTTP API endpoint keeps its role: it serves the blocks above the Portal’s finalized head, so a real-time squid stays real-time.

Prerequisites

  • A squid based on @subsquid/tron-processor 0.x that calls .setGateway()
  • Node.js 22+
  • The Portal dataset: https://portal.sqd.dev/datasets/tron-mainnet (see the Tron network page)

Migration steps

Jump to: Choosing an HTTP API endpoint · Common errors
1

Upgrade the processor

From your squid’s folder, install the 1.x release:
Version 1 removes .setGateway() and the GatewaySettings type, so the project won’t compile until the next step is done.
2

Replace the gateway with Portal

Point the processor at the Portal dataset instead of the gateway:
.setPortal() accepts a URL or a PortalSettings object. PortalSettings has no apiKey setting, and the processor no longer reads SQD_API_KEY, so drop both:
A Portal that expects a key takes it as a header: headers: {'x-api-key': process.env.PORTAL_API_KEY}. The public Portal is shared capacity. If you need guaranteed capacity, ask in the SquidDevs Telegram chat.
Nothing changes: without an HTTP API endpoint the processor handles only the finalized blocks served by the Portal and keeps following the Portal’s finalized head.
3

Build and smoke-test

Build the squid and run it locally:
The processor logs using archive data source while it reads from the Portal, then using chain RPC data source once it reaches the Portal’s head and switches to the HTTP API.
4

Deploy

A squid that already synced from the gateway does not need a re-sync: the processor state in the database doesn’t depend on the data source, and the Portal serves the same blocks and items. Deploy the new version over the old one.If your squid is deployed to the Cloud, you can also deploy into a new slot first and switch the production tag once it’s ready; see the slots and tags guide.

Choosing an HTTP API endpoint

The HTTP API endpoint now serves only the last blocks above the Portal’s head, so the request load on it drops sharply. Two things still matter when choosing one:
  • Keyless public endpoints are heavily rate-limited, and some refuse keyless requests altogether. Use a private endpoint in production.
  • Internal transactions come from the HTTP API above the Portal’s head. Many public nodes are not configured to record them and return none, so a squid that relies on internal transactions needs a node that records them.

Common errors (Tron)

Reference template (Tron)

tron-example

USDT transfers squid with a Portal data source and an HTTP API endpoint, the setup this guide produces

Next steps (Tron)

General settings

All TronBatchProcessor data source settings

Logs

Log requests and the address formats they use