This simple squid uses the EVM-compatible subset of the Tron JSON API to get the following data off the Tron network:
- USDT
Transfer(address,address,uint256)
events - Transactions that burn TRX
The data is ingested from a Tron JSON RPC endpoint using .addLog()
and .addTransaction()
methods of EvmBatchProcessor
. Data fields are chosen with .setFields()
.
The requested data is transformed in batches by a single handler provided to the processor.run()
method. The final data is presented as a GraphQL API.
Dependencies: Node.js v20 or newer, Git, Docker, Squid CLI (optional).
# 1. Retrieve the example
git clone https://github.com/subsquid-labs/squid-tron-evm-example
cd squid-tron-evm-example
# 2. Install dependencies
npm ci
# 3. Start a Postgres database container and detach
docker compose up -d
# 4. Build the squid
npm run build
# 5. Apply DB migrations and start squid services
sqd run .
A GraphiQL playground will be available at localhost:4350/graphql.
You can also start squid services one by one:
npx squid-typeorm-migration apply # applies the DB migration
node -r dotenv/config lib/main.js # starts the processor
npx squid-graphql-server # starts the GraphQL server
See the master dev guide to learn where to go from here.