This project shows how one can index TRC-20 transfers using Subsquid SDK.
This squid sources finalized historical data from the public SQD Portal
(https://portal.sqd.dev/datasets/tron-mainnet) and blocks above the Portal's head from a
TRON HTTP API endpoint. Migrating an older squid from the v2 gateway (.setGateway(...))? See the
Portal migration guide.
- Node.js (version 20.x and above)
- Docker
# Install dependencies
npm i
# Compile the project
npx tsc
# Launch Postgres database to store the data
docker compose up -d
# Apply database migrations to create the target schema
npx squid-typeorm-migration apply
# Run indexer
node -r dotenv/config lib/main.js
# Run the indexer GraphQL API in a separate terminal window
npx squid-graphql-serverIf the commands from above were successful then http://localhost:4000/graphql will be available for exploration.
For further details, please consult heavily commented main.ts.
@subsquid/evm-typegen package allows to easily generate fast and type-safe codec for Tron data.
abi module gives an example of how that look like.