Skip to content

A squid that indexes Tron USDT transfers and TRX burns using SQD's EvmBatchProcessor

License

Notifications You must be signed in to change notification settings

subsquid-labs/squid-tron-evm-example

Repository files navigation

Tron indexer based on SQD EvmBatchProcessor

This simple squid uses the EVM-compatible subset of the Tron JSON API to get the following data off the Tron network:

  1. USDT Transfer(address,address,uint256) events
  2. 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).

Quickstart

# 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.

About

A squid that indexes Tron USDT transfers and TRX burns using SQD's EvmBatchProcessor

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published