TON SDKs
TON SDKs, or TON software development kits, are collections of software libraries designed to facilitate the development of applications and smart contracts interaction on TON network.
Overview
TON SDKs provide developers with a comprehensive set of resources, including APIs, code samples, documentation, and testing frameworks. These tools abstract away much of the underlying complexity of blockchain development, enabling developers to build on TON without needing extensive expertise.TON SDKs are typically language-specific, catering to different programming languages.
SDKs for different languages
Node.js
For Node.js developers, the node-tonlib package provides a wrapper around tonlibjson library, allowing interaction with TON directly from your Node.js applications.
node-tonlib is a C++ addon that serves as a Node.js wrapper for tonlibjson, the JSON interface of TON Client Library. It provides a straightforward way to integrate TON functionality into your Node.js projects, enabling you to perform various operations such as wallet creation and management, transactions send or receive, interaction with smart contracts, and querying TON blockchain.
Installing node-tonlib is simple and can be done using the Node.js package manager. Pre-built binaries for platforms, including Ubuntu 20.04 and macOS Mojave.
TON JS Client library, created by Whales Corp., maintained by Dan Volkov, provides a cross-platform client for interacting with TON using JavaScript or TypeScript environments. It offers a high-level, intuitive API for common blockchain operations.
Key features include:
Wallet Creation:
Simplifies wallet creation with functions like mnemonicNew() and mnemonicToPrivateKey().Essential for holding, transferring TON coins, and smart contract interaction.
Wallet Contract Interaction:
Instantiates wallet contracts effortlessly with WalletContractV4.create().Abstracts low-level contract details, focusing on application logic.
Balance Queries:
Provides contract.getBalance() method for straightforward balance queries.Crucial for displaying user balances and decision-making based on funds.
Transaction Handling:
Streamlines transaction creation and sending with methods like contract.getSeqno().Enables construction and sending of transactions with contract.createTransfer().
Flexible Transaction Configuration:
Allows for various transaction types, including internal messages with specified values and recipient addresses.Offers versatility from simple transfers to complex contract interactions.
Cross-Platform Support:
Designed for use across different JavaScript environments.Minimal additional setup required for browser-based applications with the browser polyfill (require("buffer")).
Network Configuration:
Supports interaction with both mainnet and testnet environments by specifying the HTTP API endpoint.Crucial for development, testing, and production deployment.
tonutils
This is a cutting-edge TypeScript toolkit designed to simplify interactivity with TON's network protocols.Its modular architecture includes components like `tonutils/adnl`, `tonutils/dht`, `tonutils/keyring`, `tonutils/config`, and `tonutils/tl`. It focuses on TON's advanced networking features and interacts with TON services such as TON Proxy, TON Sites, and TON Storage.
TonWeb is a powerful JavaScript SDK used for interaction with (TON). It provides a comprehensive set of tools and utilities that enable developers to build a wide range of TON-based applications, from simple wallets to complex decentralized applications (DApps).
Installation
TonWeb can be easily integrated into both web and Node.js environments:
Key Features
The provided example code showcases several powerful features of TonWeb:
Wallet Creation and Management:
Utilize tonweb.wallet.create() to generate TON wallets, requiring a public key generated or derived from a mnemonic phrase.
Address Handling:
Obtain wallet addresses using wallet.getAddress(). TonWeb supports various address formats, including non-bounceable addresses.
Wallet Deployment:
Deploy wallets to TON blockchain with wallet.deploy(secretKey).send(), an essential step for wallet activation on the network.
Transaction Creation and Fee Estimation:
Create and send transactions with wallet.methods.transfer(), supporting recipient, amount (in nanoTON), sequence number, payload, and send mode specification.Estimate transaction fees before sending with .estimateFee().
Python
TON Tools
tontools library is an object-oriented programming (OOP) library that provides a user-friendly set of tools for blockchain interactions, managing wallets, deploying smart contracts, and interacting with various TON-specific features.
Key aspects of tontools include:
Provider Flexibility: Supports multiple providers:TonCenterClient (TonCenter API)LsClient (Lite servers)DtonClient (GraphQL API)TonApiClient (Indexing API)Developers choose based on needs: performance, rate limits, indexing.
Wallet Management: Easily create, deploy, and manage wallets,Create with mnemonics.Checked by address, Deploy and transfer TON coins.
Smart Contract Interaction: Provides classes for interacting with:NFTs (NftItem, NftCollection, NftItemSale).Jettons (Jetton, JettonWallet).Custom contracts (Contract class).
Transaction Handling: Simplifies TON transaction processes:Send and receive TON coins.Transfer Jettons.Query transaction history.
Blockchain Querying: Methods to query TON blockchain:Retrieve block and transaction data.Get contract states.Subscribe to blockchain events.
Object-Oriented Design: Uses OOP approach for intuitive code.
Error Handling and Safety: Includes features like non-bounceable address handling.
Community and Resources: Open-source, maintained by TON community.Examples and documentation provided.
pytoniq
It's designed for direct interaction with TON network, offering features like:
- Native LiteClient implementation
- ADNL support
- Distributed Hash Table (DHT) client
- Block scanning and transaction handling
- Smart contract interaction
This makes pytoniq suitable for a wide range of TON-based applications, from simple wallets to complex decentralized applications (DApps).
Installation
To get started with pytoniq, you can install it via pip, Python's package installer:
pip install pytoniq
Key Components and Features
1. LiteClient
pytoniq's LiteClient allows direct interaction with TON's lite servers. Key features include:
- Configurable trust levels (0 to 2) for data verification.
- Masterchain info retrieval.
- Block and transaction scanning.
- Smart contract method invocation.
2. LiteBalancer
LiteBalancer enhances LiteClient by intelligently routing requests to the "best" lite server based on responsiveness and block height. It also supports retries on timeouts and can specifically target archival servers for historical queries.
3. Block Store
For zero-trust operations, pytoniq uses a local block store (.blockstore folder) to verify data received from lite servers, ensuring data integrity without compromising decentralization.
4. ADNL and DHT
pytoniq provides native implementations of ADNL (Abstract Datagram Network Layer) and DHT (Distributed Hash Table), enabling peer-to-peer communication and decentralized data storage.
tonpy
tonpy is a high-performance Python package having the purpose of interaction with TON. It uniquely combines C++ efficiency with Python's ease of use.
Overview
C++ Core: Performance-critical operations are implemented in C++.
Python Wrapper: User-friendly Python API built on pre-compiled C++ binaries.
Result: Fast, Pythonic interface for TON development.
Key Features
TON Data Structures: Efficient handling of addresses, cells, block IDs.
Wallet Management: Create, manage wallets; sign transactions.
Transaction Handling: Create, sign, send transactions; estimate fees.
Smart Contracts: Deploy, call TON contracts (FunC, TVM).
Network Protocols: ADNL, DHT, RLDP implementations.
Golang(Go)
tonutils-go
It is a robust, Golang library designed for seamless interaction with TON blockchain. It stands out for its efficient implementation of TON's core networking protocols and its focus on high-performance, concurrent operations.
Key Features
Wallet Operations
Initializing Wallet
Create a new wallet with a seed or use an existing one. The wallet contract deploys and initializes with the first message.
Basic Usage
Seed Words: Use seed words to initialize the wallet.
Get Balance: Check the balance of the wallet.
Transfer: Transfer funds if the balance is sufficient, including a message with the transfer.
Contract Interaction
GET Methods
- Obtain block info, run a contract method, and parse the result.
- Create and send a message to a contract address. The contract processes it and deducts fees.
- Deploy contracts using the wallet's method by providing contract code, initial data, and message body.
NFT Operations
- Manage NFTs with minting, transferring, and info retrieval.
- Retrieve NFT data including collection and ownership details.
- Access collection info such as content URI and owner.
- Retrieve full content URLs for NFTs.
Jetton operations and DNS operations also can be performed.
C#
TonSdk.NET
This is a comprehensive suite of libraries. Each package in the suite serves a distinct purpose, helps developers to connect with smart contracts, and utilize advanced networking features.
Packages
This consists of different packages for different purposes TonSdk.Core consists of essential types. TonSdk.Client purpose is to give interaction with TonCenter.TonSdk.Contracts give abstraction and work of smart contracts. TonSdk.Connect is used for integration with Ton Connect 2.0 . TonSdk.Adnl is for network layering.
all these packages are available on NuGet.
SDKs in other languages
TonKotlin
`TonKotlin` offers various modules to manage network operations, blockchain interactions ,virtual machine operations, adhering to the principles outlined in TON whitepaper.
Key Modules and Their Functionalities:
TON-Kotlin is a cross-platform SDK designed for developers to interact with The Open Network (TON) using Kotlin. It offers various modules to manage network operations, blockchain interactions, and virtual machine operations, adhering to the principles outlined in TON whitepaper.
- ton-adnl Implements the Abstract Datagram Networking Layer Protocol.
- ton-api Contains structures from the TL scheme.
- ton-bitstring Manages bit strings used by TON Virtual Machine.
- ton-block Contains structures from the TL-B scheme.
- ton-boc Serializes and deserializes cells as a collection (bag-of-cells).
- ton-cell Represents data in cells, fundamental units in TON Blockchain and VM.
- ton-crypto Provides interfaces for cryptographic algorithms and data conversion methods used in TON.
Tonlib-java
Tonlib-java is a JVM-based wrapper for TonLib, enabling usage with Java, Scala, Kotlin, and other JVM languages.
Overview of TonLib
TonLib, a C++ client-side library, facilitates secure and efficient interaction with The Open Network (TON). It incorporates essential functionalities to ensure secure network communication.
Key Features of Tonlib-java:
- JNI Integration: Java interacts with TonLib through Java Native Interface (JNI), allowing direct calls to native C++ code.
- Client Implementation: Core functionalities are encapsulated within the Client.java class.
- Typed Message Classes: Communication is streamlined using generated typed message classes specified in TonApi.java.
- Security: TonLib validates Merkle proofs for data received from liteservers, ensuring data integrity and authenticity. This allows secure interactions with public liteservers.
ayrat555/ton
- Language: Elixir
- Type: Offchain-only
C++ Tonlib
- Language: C++
- Type: Tonlib binary
Java Tonlib
- Language: Java
- Type: Tonlib binary
labraburn/SwiftyTON
- Language: Swift
- Type: Tonlib binary
tonlib-xcframework
- Language: Swift
- Type: Tonlib binary