|
1 | 1 | --- |
2 | 2 | title: "Overview" |
| 3 | +description: "Understand the main ways to access the TON blockchain." |
3 | 4 | --- |
4 | 5 |
|
5 | | -import { Stub } from '/snippets/stub.jsx'; |
| 6 | +## Types of API |
6 | 7 |
|
7 | | -<Stub issue="159" /> |
| 8 | +TON exposes several access layers for interacting with the blockchain, each serving different needs: |
| 9 | + |
| 10 | +- **HTTP API** - standard web access for querying accounts, blocks, and sending transactions. |
| 11 | +- **Indexed API** - database-backed API providing structured, decoded, and historical data. |
| 12 | +- **ADNL** - low-level peer-to-peer protocol for direct communication with nodes. |
| 13 | + |
| 14 | +<Note> |
| 15 | +**Indexed vs Non-Indexed** |
| 16 | +In TON, APIs differ by how deeply they process data before returning it. |
| 17 | +**Non-indexed APIs** fetch results from liteservers through `tonlibjson`. They’re simple and fast, but the data comes directly from the node: no decoding, joins, or long-term history. |
| 18 | +**Indexed APIs** run an indexer alongside a node. The indexer reads blocks from RocksDB, decodes transactions and actions, and stores them in PostgreSQL for structured access. |
| 19 | +That extra database layer makes it possible to query decoded, historical, and aggregated data without talking to the node directly. |
| 20 | +</Note> |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | +## HTTP API |
| 25 | + |
| 26 | +The HTTP API exposes the TON blockchain through both **REST** and **JSON-RPC** interfaces. |
| 27 | +It allows developers to fetch account and wallet information, explore blocks and transactions, send messages, call smart contract methods, and more. |
| 28 | + |
| 29 | +<Note> |
| 30 | +For production, it’s recommended to integrate at least two providers to ensure uptime. |
| 31 | +</Note> |
| 32 | + |
| 33 | +### Typical use cases |
| 34 | +- Querying accounts, balances, or transactions |
| 35 | +- Sending messages or deploying smart contracts |
| 36 | +- Building wallets and basic dApps |
| 37 | + |
| 38 | +### Run your own instance |
| 39 | +Use the open-source [ton-http-api](https://github.com/toncenter/ton-http-api) to host your own endpoint. |
| 40 | + |
| 41 | +## Indexed API |
| 42 | + |
| 43 | +Indexed APIs extend HTTP functionality by offering structured, decoded, and historical blockchain data. |
| 44 | +They are built on top of the **TON Indexer**, which reads data from a full node, decodes transactions and actions, and stores them in a PostgreSQL database for efficient querying. |
| 45 | + |
| 46 | +These APIs power explorers and analytics tools that need complex searches or decoded data. |
| 47 | + |
| 48 | +### Typical use cases |
| 49 | +- Blockchain explorers and analytics dashboards |
| 50 | +- Historical or decoded transaction queries |
| 51 | +- NFT and Jetton tracking |
| 52 | + |
| 53 | +### HTTP vs Indexer |
| 54 | + |
| 55 | +| Type | Best for | What you get | |
| 56 | +| --- | --- | --- | |
| 57 | +| **HTTP** | Sending messages or performing standard read requests | Data processed by `tonlib` and served through liteservers over REST or JSON-RPC. Useful for querying accounts, balances, or transactions without indexing overhead. | |
| 58 | +| **Indexer** | Accessing decoded, historical, or aggregated data | Responses served from an indexing database built from a full node’s data. Ideal for explorers, analytics, and structured blockchain queries. | |
| 59 | + |
| 60 | + |
| 61 | +<Tip> |
| 62 | +Prefer **Indexed APIs** for nearly all read operations, as they provide broader coverage, better performance, and decoded data. |
| 63 | +Use **HTTP APIs** when you need to **send messages or transactions** directly to the network. |
| 64 | +</Tip> |
| 65 | + |
| 66 | +### Run your own instance |
| 67 | +Use the open-source [ton-indexer](https://github.com/toncenter/ton-indexer) to host your own endpoint. |
| 68 | + |
| 69 | +## ADNL API |
| 70 | + |
| 71 | +**ADNL (Abstract Datagram Network Layer)** is TON’s peer-to-peer protocol for direct node communication. |
| 72 | +It provides verifiable, low-level access to blockchain data and transaction submission. |
| 73 | + |
| 74 | +Clients connect directly to **liteservers** using a binary protocol, downloading key blocks, account states, and Merkle proofs to verify data authenticity. |
| 75 | + |
| 76 | +For read operations (such as `runGetMethod`), the client executes a local TVM run using the verified state, without downloading the full blockchain. |
| 77 | + |
| 78 | +### Typical use cases |
| 79 | +- Running validators or custom node software |
| 80 | +- Building node management and monitoring tools |
| 81 | +- Applications requiring Merkle-proof validation |
| 82 | + |
| 83 | +### HTTP vs ADNL |
| 84 | + |
| 85 | +| Type | Best for | What you get | |
| 86 | +| --- | --- | --- | |
| 87 | +| **HTTP** | General-purpose access to blockchain data and message submission | Returns processed data produced by `tonlib` through liteservers, exposed over REST or JSON-RPC. The data is already parsed and formatted for applications, not a raw or verifiable ledger snapshot. | |
| 88 | +| **ADNL** | Direct and verifiable access to the blockchain state | Native peer-to-peer protocol used by TON nodes. Provides binary responses with Merkle proofs, allowing clients to verify the authenticity of account states and transactions directly. | |
| 89 | + |
| 90 | +<Tip> |
| 91 | +For most applications, prefer an **Indexed API** for reads, because it provides broader coverage and faster, decoded data. |
| 92 | +Use **HTTP** when you need to **send messages or transactions** directly to the network. |
| 93 | +Choose **ADNL** for low-level, verifiable access or when running your own node or validator infrastructure. |
| 94 | +</Tip> |
| 95 | + |
| 96 | +### Run your own instance |
| 97 | +Use [MyTonCtrl](../node/setup-mytonctrl) to enable a liteserver and expose an ADNL endpoint. |
| 98 | + |
| 99 | +## Providers |
| 100 | + |
| 101 | +### Official providers |
| 102 | + |
| 103 | +| Provider | Type | Public Endpoints | Docs | |
| 104 | +| --- | --- | --- | --- | |
| 105 | +| [TON Center API v2](https://github.com/toncenter/ton-http-api) | HTTP | `https://toncenter.com/api/v2/`, `https://testnet.toncenter.com/api/v2/` | [Docs](./get-api-key) | |
| 106 | +| [TON Center API v3](https://github.com/toncenter/ton-indexer) | Indexer | `https://toncenter.com/api/v3/` | [Docs](./get-api-key) | |
| 107 | +| [dTON](https://t.me/dtontech_bot) | ADNL | Provided by dTON via [request through official bot](https://t.me/dtontech_bot) | — | |
| 108 | +| Public liteservers | ADNL | `https://ton.org/global-config.json`, `https://ton.org/testnet-global.config.json` | — | |
| 109 | + |
| 110 | +### Third party providers |
| 111 | +| Provider | Type | Public Endpoints | Docs | |
| 112 | +| --- | --- | --- | --- | |
| 113 | +| [Chainstack](https://chainstack.com/build-better-with-ton/) | HTTP, Indexer, ADNL | Access via dashboard or project workspace | [Docs](https://docs.chainstack.com/reference/getting-started-ton#getting-started-ton) | |
| 114 | +| [TON API](https://docs.tonconsole.com/tonapi) | Indexer | `https://testnet.tonapi.io`,`https://tonapi.io` | [Docs](https://docs.tonconsole.com/tonapi) | |
| 115 | +| [Ankr](https://www.ankr.com/rpc/ton/) | HTTP | `https://rpc.ankr.com/http/ton_api_v2` | [Docs](https://www.ankr.com/docs/rpc-service/chains/chains-api/ton/) | |
| 116 | +| [QuickNode](https://www.quicknode.com/chains/ton) | HTTP | Access via dashboard or project workspace | [Docs](https://www.quicknode.com/docs/ton) | |
| 117 | +| [Tatum](https://tatum.io/) | HTTP, Indexer | `https://ton-mainnet.gateway.tatum.io`, `https://ton-testnet.gateway.tatum.io` | [Docs](https://docs.tatum.io/guides/blockchain/the-open-network-ton) | |
| 118 | +| [GetBlock](https://getblock.io/nodes/ton/) | HTTP | `https://ton.getblock.io/mainnet/`, `https://ton.getblock.io/testnet/` | [Docs](https://docs.getblock.io/api-reference/the-open-network-ton) | |
| 119 | +| [Chainbase](https://chainbase.com/) | HTTP | Access via dashboard or project workspace | [Docs](https://docs.chainbase.com/api-reference/overview) | |
| 120 | +| [NowNodes](https://nownodes.io/nodes/ton) | HTTP, Indexer | `https://ton-open-api.nownodes.io/v2`, `https://ton-index.nownodes.io/api/v3` | [Docs](https://nownodes.gitbook.io/ton-toncoin) | |
0 commit comments