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:- Blocks
- Transactions
- Messages — includes raw body and state init data.
- Balances history — allows you to get a precise point-in-time balance for any account.
- Jetton events — comes with transfers, burns and mints.
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.
- 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.
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:- EVAA (implementation)
- Affluent (implementation)
- StormTrade (implementation)
- TON DNS (implementation)
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:TON data quick start
TON on-chain data analysis: quickstart on Dune
How to Analyze TON Users and Token Flows on Dune: A Practical Guide
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.- 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.
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:- Running your own TON node
- Launching ton-etl
- 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 thedune.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.