Welcome TON Builders! In this tutorial, we will guide you through the process of interacting with the Radix Advanced Node API and integrating it for data and development needs. Additionally, we are going to cover the new methods that our TON Indexer instance supports in the API and present the easiest access to the
The TON Blockchain, also known as The Open Network (TON), is a decentralized Layer 1 blockchain network that revolutionizes the way we interact with digital assets and services. Developed by the team behind the popular messaging app Telegram, TON offers a wide range of features and capabilities that make it an attractive choice for developers and businesses alike.
Let’s delve into the guide! You can save this tutorial and share it for the development needs 🙂
P.S. Wanna read it from the NOWNodes blog, follow the link: https://nownodes.io/blog/ton-indexer-api-guide/
What is the TON Indexer API? What are the Main Use Cases?
At its core, TON is designed to provide a scalable and secure platform for the creation and execution of smart contracts, decentralized applications (dApps), and digital currencies. With its unique combination of speed, security, and flexibility, the TON blockchain has the potential to disrupt traditional industries and empower users with new opportunities.
It’s fair to mention that there are various development tools available in the TON ecosystem. The list includes blockchain explorers, SDKs and custom libraries as well as API tools. One of them is the TON Indexer API — a powerful tool that allows developers to retrieve and analyze data from the TON blockchain. With its full set of endpoints, the TON Indexer API provides access to a wide range of data, including transaction history, block details, and account balances.
In our case, we use the updated TON Indexer instance from the Master branch. This ensures the stability and the security of the software.
By accessing the TON Indexer, developers can obtain real-time information about the state of the blockchain, including transaction history, block details, and account balances. This data can be used to build applications, monitor network activity, and conduct research on the TON blockchain.
Differences Between TON RPC Full Node and Indexer API
Despite assisting developers and powering similar functions, the TON RPC Full Node and the Indexer API serve different purposes and needs in the development of applications on TON.
For example, developers typically use TON RPC Full Nodes for interacting directly with the blockchain to perform a wide range of functions: querying blockchain data, submitting transactions, etc. The focus here is on direct interaction with the blockchain and real-time data processing.
On the other hand, the Indexer API is designed to provide more sophisticated, indexed data from the blockchain, making it more suitable for applications that require fast and efficient access to large amounts of data, usually — the historical kind of it. The methods available through the Indexer API are focused on retrieving indexed and processed data. This can include transaction histories, wallet balances, and other blockchain state information that has been indexed for quick access.
This time we focus on utilizing the TON Indexer. Let’s get straight to the details!
Step-by-step tutorial on Integrating TON Indexer API
Step 1: Setting Up The Environment
To utilize the TON Indexer API, we are going to make HTTP (RPC) requests to the API endpoints using any of the preferred programming tools. The API responses will return in a JSON format, making it easy to parse and process the data.
In our guide we will refer to the following TON Indexer API endpoint:
ton-index.nownodes.io.
Make sure you obtain an API key in order to access TON Indexer. You can create it at the NOWNodes website.
If the API environment is ready, the API key is generated, then we’re good to proceed to the next step.
Step 2: Testing the connection
Let’s check if the requests are being sent without any errors and if we receive valid responses. In this case, we’re going to use the masterchainInfo
method. Here’s an example:
curl --request GET \
--url 'https://ton-index.nownodes.io/masterchainInfo?address=EQBwCK26MZ1yEUR9dnSO5reQRbnN9LJcaMtAvvqSk4mbgZBx' \
--header 'api-key: _______'
This method displays the data of the chain with the information on the validators, hashes, etc.
If you receive a 200-type answer, then we’re good to go and move to the next step
Step 3: Browsing Transaction-related Indexer API Methods
The following endpoints and methods would be most useful for crypto enterprises that review and sync the TON blockchain transaction data. Let’s start from the general method — transactions. This type of call will display the transactions of the TON blockchain and filter it by specified categories.
Here’s an example of a request without any filters:
curl --request GET \
--url https://ton-index.nownodes.io/transactions \
--header 'api-key: your-api-key'
If you would like to structure the answer by filtering the transactions, you can use the following filters: account, hash, shard, etc. Let’s adjust the example with an address:
curl --request GET \
--url https://ton-index.nownodes.io/transactions?account=EQDa4VOnTYlLvDJ0gZjNYm5PXfSmmtL6Vs6A_CZEtXCNICq_&limit=128&offset=0&sort=desc \
--header 'api-key: your-api-key'
Please note that these methods require obtaining quite a big part of the data. To optimize your requests and call to TON Indexer API, you can add more parameters to the header.
- Accessing Other Methods of the Indexer API
Since TON Indexer allows to retrieve and process more sophisticated data, there are more commands available for TON developers. The command list that would be most useful and is actively being utilized by the team includes:
estimateFee
– to give users an amount of the gas fee and forecast in within the transaction- NFT Transfers — a universal endpoint to browse the history of Non-fungible Tokens’ transfers (
ton-index.nownodes.io/nft/transfers?direction=both&limit=128&offset=0&sort=desc
) - Adjacent Transactions — to collect the data on the side-transactions related to the main transaction hash
The full list is available in the TON API Docs and the NOWNodes Official Documentation.
Conclusion and resources for further learning
Accessing the TON Indexer is essential for developers and researchers who want to harness the full potential of the TON blockchain. By understanding the TON blockchain and utilizing the TON Indexer API, developers can build powerful applications, analyze network data, and make informed decisions. With its speed, security, and flexibility, the TON blockchain has the potential to transform industries and empower users with new opportunities.
Make sure you rate this guide and leave your feedback on the NOWNodes TON Indexer connection. You can email us at marketing@nownodes.io or leave a message in our builders community.
Recommended resources and documentation for further learning
- TON Documentation — Official documentation for the TON blockchain.
- NOWNodes TON Indexer API — Access the TON Indexer API for comprehensive data analysis.
- TON Telegram Channel — Join the official Telegram channel for the latest updates.
Access the TON Indexer and unlock the full potential of the TON blockchain today!