Ton.Crypto
0.2.5
See the version list below for details.
dotnet add package Ton.Crypto --version 0.2.5
NuGet\Install-Package Ton.Crypto -Version 0.2.5
<PackageReference Include="Ton.Crypto" Version="0.2.5" />
<PackageVersion Include="Ton.Crypto" Version="0.2.5" />
<PackageReference Include="Ton.Crypto" />
paket add Ton.Crypto --version 0.2.5
#r "nuget: Ton.Crypto, 0.2.5"
#:package Ton.Crypto@0.2.5
#addin nuget:?package=Ton.Crypto&version=0.2.5
#tool nuget:?package=Ton.Crypto&version=0.2.5
Ton.NET
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.
โจ Features
- ๐ฏ 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
๐ฆ Packages
๐ Quick Start
Install packages:
dotnet add package Ton.LiteClient
Create 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");
๐ Documentation
Getting Started
- Installation - Setup and requirements
- First Steps - Basic operations
- Key Concepts - TON fundamentals
Modules
- LiteClient - Direct blockchain queries via ADNL
- HttpClient - HTTP API access
- Core - Cells, Addresses, Types
- Crypto - Cryptography primitives
- Contracts - Wallet operations
Guides
- Common Tasks - Practical examples and patterns
API Reference
- API Documentation - Complete API reference
๐งช Testing
dotnet test
Test 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.
๐๏ธ Architecture
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
Key Design Principles
- 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
๐ ๏ธ Development
Requirements
- .NET 8.0 or .NET 9.0
- C# 12 language features
Samples
Check out the /samples directory:
- LiteClientPlayground - LiteClient usage examples
- AdnlSample - Low-level ADNL protocol examples
๐ค Contributing
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
๐ License
MIT License - see LICENSE file for details.
๐ Resources
Official TON
Community
Ton.NET
Made with โค๏ธ for the TON community
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- BouncyCastle.Cryptography (>= 2.6.2)
-
net9.0
- BouncyCastle.Cryptography (>= 2.6.2)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Ton.Crypto:
| Package | Downloads |
|---|---|
|
Ton.HttpClient
TON blockchain HTTP client library for .NET - Toncenter API v2/v4, wallet contracts (V1-V5), jettons, multisig. 1:1 API compatibility with @ton/ton JavaScript library. |
|
|
Ton.Contracts
TON smart contract implementations for .NET - Wallet contracts (V1-V5), Jettons, and NFTs. 1:1 API compatibility with @ton/ton JavaScript library. |
|
|
Ton.Adnl
ADNL (Abstract Datagram Network Layer) client for TON blockchain - Direct node communication with TL serialization, encryption, and auto-generated schema. Enables lite client implementation for TON. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.2.7 | 682 | 12/2/2025 |
| 0.2.6 | 355 | 11/16/2025 |
| 0.2.5 | 251 | 11/6/2025 |
| 0.2.4 | 257 | 10/30/2025 |
| 0.2.3 | 248 | 10/30/2025 |
| 0.2.2 | 243 | 10/29/2025 |
| 0.2.1 | 247 | 10/29/2025 |
| 0.2.0 | 218 | 10/29/2025 |
| 0.1.5 | 227 | 10/28/2025 |
| 0.1.4 | 212 | 10/28/2025 |
| 0.1.3 | 192 | 10/27/2025 |
| 0.1.2 | 194 | 10/27/2025 |
| 0.1.1 | 186 | 10/27/2025 |
| 0.1.0 | 163 | 10/26/2025 |
| 0.0.13 | 158 | 10/26/2025 |
| 0.0.12 | 156 | 10/26/2025 |
| 0.0.11 | 159 | 10/26/2025 |
| 0.0.10 | 157 | 10/26/2025 |
| 0.0.9 | 161 | 10/26/2025 |
| 0.0.8 | 158 | 10/26/2025 |
| 0.0.7 | 161 | 10/26/2025 |
| 0.0.6 | 157 | 10/26/2025 |
| 0.0.5 | 162 | 10/26/2025 |
| 0.0.4 | 161 | 10/26/2025 |
| 0.0.3 | 160 | 10/26/2025 |