What is a TON RPC node and how do you use one?
Key Takeaways
- A TON RPC node enables applications to read blockchain data and send transactions on The Open Network.
- TON nodes can run in liteserver, archive liteserver, validator, or collator mode, each serving different use cases.
- Running your own TON full node gives you full control but requires significant operational overhead.
- Managed TON RPC providers offer geo-balanced endpoints, automatic scaling, and reduced latency for production apps.
- When choosing a provider, evaluate factors like latency, uptime, request limits, and support for mainnet and testnet.
- OnFinality provides reliable TON RPC endpoints and dedicated node options for developers.
- Always test your TON RPC connection with a simple JSON-RPC call before integrating into your application.
What is a TON RPC Node?
A TON RPC node is a server that exposes the TON blockchain's API via the Remote Procedure Call (RPC) protocol. It allows external applications—such as wallets, explorers, and dApps—to query the blockchain state, retrieve transaction history, and submit new transactions. TON nodes typically run in liteserver mode, which means they serve lightweight client requests without requiring the client to store the full blockchain.
The TON blockchain uses a unique architecture with sharding and masterchains. A full node stores the latest shards and tracks the masterchain, enabling it to respond to queries about account balances, block information, and transaction statuses. For applications that need historical data, an archive liteserver stores the entire blockchain history.
TON Node Modes and Their Use Cases
TON documentation defines several node modes, each optimized for different tasks:
Choosing the right mode depends on your application's requirements. Most dApps only need a liteserver for real-time data, while explorers and analytics platforms require archive nodes.
| Criterion | What to check | Why it matters |
|---|---|---|
| Liteserver | Stores latest shards, tracks masterchain, serves data to lite-clients | Suitable for wallets, dApps, and custom APIs that need current state and recent transactions. |
| Archive liteserver | Stores all blockchain data including old blocks and states | Required for block explorers, historical analytics, and services that query past events. |
| Validator | Signs blocks, participates in elections, earns rewards | Needed if you want to run a validator node with your own stake or operate a nominator pool. |
| Collator | Produces blocks for validators | Reduces load on validator nodes by offloading block creation to a separate machine. |
Self-Hosted vs. Managed TON RPC Nodes
You have two primary options for accessing a TON RPC node: run your own node or use a managed RPC provider. Each approach has trade-offs in terms of cost, control, and operational complexity.
Running your own TON full node gives you full control over the infrastructure, data privacy, and no rate limits. However, it requires significant DevOps effort: you must provision hardware, sync the blockchain (which can take days), monitor uptime, and handle scaling. The TON documentation recommends at least 8 CPU cores, 32 GB RAM, and a fast SSD for a full node.
Managed RPC providers like OnFinality handle node deployment, maintenance, and scaling. They offer geo-balanced endpoints that reduce latency by routing requests to the nearest server. This is ideal for production applications that need high availability and low response times without the operational burden.
- Self-hosted: Full control, no rate limits, but high operational overhead and upfront sync time.
- Managed: Low latency, automatic scaling, built-in monitoring, and support for both mainnet and testnet.
- Hybrid: Some teams run their own validator nodes while using a managed provider for public RPC traffic.
How to Choose a TON RPC Provider
When evaluating TON RPC providers, consider the following criteria to ensure your application performs reliably:
Many providers offer free tiers or trial periods, so you can test performance before committing. OnFinality provides TON RPC endpoints with competitive performance and dedicated node options for high-demand projects.
| Criterion | What to check | Why it matters |
|---|---|---|
| Latency | Round-trip time from your application's location | Lower latency improves user experience, especially for real-time applications like trading bots. |
| Uptime SLA | Guaranteed uptime percentage (e.g., 99.9% or 99.99%) | Production apps require high availability to avoid service disruptions. |
| Request Limits | Monthly request cap or rate limits per second | Ensure the plan matches your expected traffic volume without unexpected throttling. |
| Network Support | Mainnet and testnet availability | Testnet is essential for development and testing before deploying to mainnet. |
| Archive Access | Support for historical data queries | Needed for analytics, explorers, and auditing past transactions. |
| Geo-Distribution | Number and location of data centers | Global endpoints reduce latency for users worldwide. |
Making Your First TON RPC Call
Once you have a TON RPC endpoint, you can interact with the blockchain using standard JSON-RPC calls. TON uses the ADNL protocol for node communication, but most managed providers expose a standard HTTP RPC interface.
Here's an example using curl to get the latest masterchain block number:
Replace YOUR_ENDPOINT_URL with your actual RPC endpoint. The method 'getMasterchainInfo' returns the current masterchain block number, which you can use to verify connectivity.
- curl -X POST YOUR_ENDPOINT_URL -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1,"method":"getMasterchainInfo","params":[]}'
- Common methods: getAccountState, getTransactions, sendBoc (send external message), runGetMethod.
- Always handle errors gracefully and implement retry logic for transient failures.
Best Practices for Production TON RPC Usage
To ensure your TON dApp runs smoothly in production, follow these best practices:
By following these practices, you can build a resilient application that handles traffic spikes and network issues gracefully.
- Use multiple RPC endpoints for redundancy—fallback to a secondary provider if the primary is unavailable.
- Implement connection pooling and keep-alive to reduce overhead from repeated handshakes.
- Monitor RPC response times and error rates to detect issues early.
- Cache frequently accessed data (e.g., account balances) to reduce RPC calls.
- Use testnet for development and staging to avoid mainnet costs and risks.
- Consider dedicated nodes if your application has high throughput or requires custom configuration.
Conclusion
A TON RPC node is the essential gateway for building on The Open Network. Whether you choose to run your own node or use a managed provider like OnFinality, understanding the different node modes and selection criteria will help you make an informed decision. For most production applications, a managed RPC service offers the best balance of performance, reliability, and ease of use.
Start by testing with a free tier or trial, evaluate latency from your target regions, and scale up as your user base grows. With the right infrastructure, you can focus on building great dApps on TON.
Frequently Asked Questions
What is a TON RPC node?
A TON RPC node is a server that exposes the TON blockchain's API, allowing applications to query data and send transactions. It typically runs in liteserver mode, serving lightweight client requests.
Do I need to run my own TON node?
Not necessarily. Managed RPC providers offer reliable endpoints without the operational overhead of self-hosting. Running your own node gives you full control but requires significant DevOps effort.
What is the difference between a liteserver and an archive node?
A liteserver stores only recent blockchain data, while an archive node stores the entire history. Archive nodes are needed for block explorers and historical analytics.
How do I make an RPC call to TON?
Use a standard JSON-RPC POST request to your endpoint with methods like getMasterchainInfo, getAccountState, or sendBoc. Example: curl -X POST <endpoint> -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1,"method":"getMasterchainInfo","params":[]}'.
What should I look for in a TON RPC provider?
Key factors include latency, uptime SLA, request limits, support for mainnet and testnet, archive access, and geo-distribution. Test with a free tier before committing.