Skip to main content
Developers often need to run analytical queries on top of on-chain data — for example, to track historical changes and aggregate data from multiple accounts. Since blockchains are not designed for analytical workloads, you need to build an indexing pipeline and run off-chain analytical queries. Creating such pipelines from scratch can be resource-consuming, so we recommend using one of the tools mentioned on this page.

Dune analytics

Dune analytics is one of the leading platforms for running analytical queries and building dashboards. It comes with 100+ blockchain integrations, and TON is among them. Basically, one needs to be familiar with SQL language to write queries, but the Dune AI prompt engine allows users to start working with data even without SQL knowledge.

Raw and decoded tables

Dune analytics consumes data from the public TON Data Lake (see below) and comes with a variety of raw and decoded tables. The raw tables include:
Since mints are not covered by the TEP-74 standard, it is not possible to reconstruct balances based solely on jetton events, so balances history should be used.
Apart from raw tables, there are decoded tables that allow you to work with high-level structures in a unified manner:
  • NFT events — comprehensive source of NFT-related data including sales, transfers and mints.
  • DEX trades — includes a unified data model for DEX trades. The full list of supported DEXs is available here.
  • DEX pools — comes with the full history of DEX pool balances and TVL estimations.
Finally, two tables with off-chain metadata are available:

Bespoke data marts

Dune analytics allows projects to build bespoke data marts for each protocol — it is widely used for EVMs with the help of ABIs.

Decoding raw data

Since TON handles complex data structures and doesn’t have ABIs, a special decoding framework was created. It works on top of the Spellbook — a powerful tool for building custom tables with dbt and Jinja macros. It helps decode important information from raw protocol message payloads. The following protocols are decoded using this framework and serve as examples:

Custom views

In addition to decoding raw data, the Spellbook allows building custom materialized views. Some of them are widely used and maintained to be up to date:
  • ton.prices_daily — prices calculated based on all other tables. The prices include jettons traded on DEXs, LP tokens for DEXs and perpetuals, tsUSDe and other core assets. It is recommended to use this table if you need to build an estimation of assets denominated in TON or USD.
  • ton.accounts — materialized view with information about all accounts. It comes with the latest TON balance, interface (if any), funding information and other fields.
  • ton.latest_balances — helper table to get the latest balances for TON and Jettons.
All tables mentioned above are updated daily.

Getting started with Dune

If you’re just starting to explore TON data on Dune, we recommend checking these articles first: For inspiration to build your own dashboards, check out these examples:

Public Data Lake

Dune integration runs on the public data lake from the TON-ETL project. TON-ETL is built on top of TON Center indexer and allows extraction of data from TON Node into data formats suitable for MPP (Massively Parallel Processing) engines: Presto, Apache Spark, etc.
You can deploy it on your own infrastructure or use publicly available data from the S3 bucket: s3://aws-public-blockchain/v1.1/ton/. This dataset is part of the AWS Public Blockchain Data project and is optimized for use within the AWS big data stack.Examples of AWS Athena and AWS Bedrock integration can be found in this article.
The TON-ETL extracts raw data and performs decoding to create a unified view of high-level on-chain activity. The most important part is decoding DEX activity. The decoding implementation must solve the following tasks:
  • Decoding of swap events. The code must check the authenticity of the swap. For example, you cannot rely on the opcode alone since anyone can generate messages with your opcode.
  • Extracting all swap-related fields: tokens sold and bought, amounts, query IDs, trader, router (if any), and pool.
  • Fetching pool reserves and LP token supply, if applicable.
To add support for a new DEX and decode its activity, you need to prepare a relevant PR on GitHub to TON-ETL’s repo. Use those past PRs as a reference: BidAsk, CoffeeSwap, MemesLab.

Real-time streams

In addition to bulk data export, TON-ETL provides real-time data streaming via Kafka. A public endpoint is available free of charge for non-profit projects. For projects that don’t meet the non-profit criteria or require an in-house solution, you can deploy the infrastructure yourself by:
  1. Running your own TON node
  2. Launching ton-etl
  3. Setting up ton-index-worker

TON Labels

While data availability and integrations are essential, building insightful dashboards requires enriching data with address labels. The TON Labels project simplifies this process by providing a comprehensive taxonomy of addresses in TON Ecosystem. It covers active addresses across various categories including centralized exchanges (CEXs), decentralized applications (dApps), and DeFi protocols. You can access the latest labels either directly from the build branch or through Dune analytics using the dune.ton_foundation.dataset_labels table.

Other platforms

  • Chainbase offers a set of raw and decoded tables with TON data. It allows you to run SQL queries and fetch results via API.
  • TON Console provides analysts with Analytics Service.
  • TokenTerminal comes with high-level metrics across TON Ecosystem.
  • Artemis contains key metrics for TON and allows you to build customized charts.
I