Complete TON API guide for developers. Learn to use Toncoin RPC, query blockchain data, and interact with smart contracts.">

TON API Guide

Developer documentation for TON (Toncoin) blockchain API. RPC endpoints, data queries, and integration.

What is TON?

The Open Network (TON) is a fast, scalable blockchain originally developed by Telegram. It offers high throughput and low fees for decentralized applications.

Public RPC Endpoints

JSON-RPC: https://toncenter.com/api/v2/jsonRPC
API: https://tonapi.io

Get Block Data

import requests

url = "https://toncenter.com/api/v2/jsonRPC"
data = {
    "jsonrpc": "2.0",
    "method": "getBlock",
    "params": {"seqno": 12345678},
    "id": 1
}

response = requests.post(url, json=data)
print(response.json())

Get Account Balance

import requests

url = "https://tonapi.io/v2/accounts/{address}/balance"

# Replace with actual address
address = "EQCD39VS5jcptHL8vMjEXrzEqr5f6yXRAxyy43pZNL2u"
response = requests.get(url.replace("{address}", address))
print(response.json())

Get Transaction History

import requests

url = "https://tonapi.io/v2/accounts/{address}/transactions"
address = "EQCD39VS5jcptHL8vMjEXrzEqr5f6yXRAxyy43pZNL2u"
response = requests.get(url.replace("{address}", address))
data = response.json()
print(data["transactions"][:5])  # Last 5 transactions

Send Transaction

import requests
from pytonlib import Tonlib

# Using pytonlib library
client = Tonlib(ls_index=0)

# Transfer TON
result = client.transfer(
    wallet_mnemonic=["word1", "word2", ...],
    destination="EQ...",
    amount=1_000_000_000  # in nanoTON
)
print(result["hash"])

Popular TON Libraries