A modern, comprehensive .NET SDK for the TON (The Open Network) blockchain. Built from scratch with clean architecture, targeting compatibility with the official TON JavaScript SDK.
- 🎯 API compatibility with TON JavaScript SDK
- 🔒 Type-safe primitives and TL-B structures
- 🧪 553+ tests with comprehensive coverage
- 📦 Modular architecture - use only what you need
- 🚀 Production-ready with .NET 8 & 9 support
- 📚 Complete documentation with examples
Install packages:
dotnet add package Ton.LiteClientCreate a wallet and check balance:
using Ton.Crypto.Mnemonic;
using Ton.Contracts.Wallets.V5;
using Ton.LiteClient;
// Generate mnemonic
var mnemonic = Mnemonic.New(24);
var keys = Mnemonic.ToWalletKey(mnemonic);
// Create wallet
var wallet = new WalletV5R1(keys.PublicKey);
Console.WriteLine($"Address: {wallet.Address}");
// Connect to blockchain
var client = await LiteClientFactory.CreateFromUrlAsync(
"https://ton.org/global-config.json"
);
// Get balance
var info = await client.GetMasterchainInfoAsync();
var state = await client.GetAccountStateAsync(wallet.Address, info.Last);
Console.WriteLine($"Balance: {state.BalanceInTon} TON");- Installation - Setup and requirements
- First Steps - Basic operations
- Key Concepts - TON fundamentals
- LiteClient - Direct blockchain queries via ADNL
- HttpClient - HTTP API access
- Core - Cells, Addresses, Types
- Crypto - Cryptography primitives
- Contracts - Wallet operations
- Common Tasks - Practical examples and patterns
- API Documentation - Complete API reference
dotnet testTest Coverage:
- 298 Core tests (BOC, TL-B, Dictionaries, Addresses)
- 47 Crypto tests (Mnemonics, Ed25519, Hashing)
- 41 Contracts tests (Wallets)
- 156 ADNL tests (Protocol, Serialization, Crypto)
- 11 LiteClient tests (Integration)
Total: 553 passing tests
All tests validate compatibility with TON JavaScript SDK behavior.
Ton.LiteClient → High-level blockchain queries (ADNL protocol)
├── Ton.Adnl → Low-level ADNL protocol
├── Ton.Core → Core primitives (Cell, Address, BOC)
└── Ton.Crypto → Cryptographic operations
Ton.HttpClient → HTTP API client (Toncenter v2/v4)
├── Ton.Core
└── Ton.Crypto
Ton.Contracts → Smart contract implementations
├── Ton.Core
└── Ton.Crypto
- Type Safety - Nullable reference types, records, pattern matching
- Zero External Dependencies - Only System.Text.Json for HTTP clients
- Performance - Efficient cell serialization and hashing
- Compatibility - 1:1 API compatibility with TON JS SDK
- Testability - Comprehensive test coverage
- .NET 8.0 or .NET 9.0
- C# 12 language features
Check out the /samples directory:
- LiteClientPlayground - LiteClient usage examples
- AdnlSample - Low-level ADNL protocol examples
Contributions are welcome! This project aims for API compatibility with the TON JavaScript SDK.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
MIT License - see LICENSE file for details.
Made with ❤️ for the TON community
