TonTools: A Comprehensive Python OOP Library for TON Blockchain Interaction

TonTools is an advanced Object-Oriented Programming (OOP) library for Python, specifically designed to facilitate seamless interaction with the TON Blockchain (The Open Network). It offers developers a high-level interface to engage with blockchain operations, making it a pivotal tool for blockchain application development. For further inquiries, the Python - TON developers chat is available for engagement and support.

PyPI version Downloads

Installation Instructions:

To integrate TonTools into your project, execute the following command:

pip install tontools

Capabilities :rocket:

TonTools empowers users to perform a wide range of operations on the TON Blockchain, including but not limited to:

  • Scanning and invoking methods on custom Contracts
  • Creating, deploying, and scanning wallets
  • Interacting with NFT Collections, Items, and Sale contracts
  • Managing Jettons and Jetton Wallets
  • Transferring Tons, Jettons, NFTs
  • Parsing Transactions in both raw and user-friendly formats
  • And many more advanced functionalities…

Sample code and further examples are located in the examples/ directory within the repository.

Support the Project

Contributions to support the project are welcomed at the following TON address:


Data Providers

TonTools retrieves data from the blockchain using various Providers, including TonCenterClient, LsClient, DtonClient, and TonApiClient. While most methods across these providers are consistent, some variations do exist.

Provider Comparisons

Provider Base URL Special Features
TonCenterClient TON HTTP API - Swagger UI API Key rate limit of 10 RPS, Local hosting recommended
LsClient Lite Server (Node-dependent) Advanced usage, may require binary compilation
DtonClient High-level indexing GraphQL API, Private GraphQL with API key
TonApiClient High-level indexing API, Future updates to include V2 methods

Detailed Usage and Initializations

  • TonCenterClient: Ideal for developers seeking to utilize a comprehensive API with support for rate limiting and local hosting capabilities.

  • LsClient: Offers data from blockchain using lite servers, tailored for developers needing advanced control and potentially binary compilation.

  • DtonClient: A GraphQL API designed for high-level indexing, suitable for users with an API key seeking private GraphQL access.

  • TonApiClient: Focused on providing a high-level indexing API, recommended for scanning extensive transaction and contract datasets.

Contract Interactions

TonTools abstracts contract interactions, enabling developers to seamlessly work with various contract types such as NFT items, collections, sales, jettons, and wallets. Each contract inherits from a base Contract class, providing methods like .get_transactions(), .run_get_method(), .get_balance(), and .get_state(), applicable across different contract types.


  • NFT Contracts: Managing NFT Items, Collections, and Sales.
  • Jetton Contracts: Handling Jetton and Jetton Wallet interactions.
  • Wallet Contracts: Includes the Wallet class for managing blockchain wallets, with future plans to introduce HighLoadWallet and MultiSigWallet.

Transactions and Messages

The Transaction class offers methods to convert transaction data into both full and user-friendly formats, aiding in the analysis and presentation of transaction information. Additionally, messages can be categorized using the .try_detect_type() method, enhancing data interpretation and usability.

For detailed examples, installation guides, and more information on how to contribute or seek help, visit the TonTools GitHub repository and the Python - TON developers chat.