Dzeta.TonSdk.Core 0.5.0

Prefix Reserved
dotnet add package Dzeta.TonSdk.Core --version 0.5.0
                    
NuGet\Install-Package Dzeta.TonSdk.Core -Version 0.5.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Dzeta.TonSdk.Core" Version="0.5.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Dzeta.TonSdk.Core" Version="0.5.0" />
                    
Directory.Packages.props
<PackageReference Include="Dzeta.TonSdk.Core" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Dzeta.TonSdk.Core --version 0.5.0
                    
#r "nuget: Dzeta.TonSdk.Core, 0.5.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Dzeta.TonSdk.Core@0.5.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Dzeta.TonSdk.Core&version=0.5.0
                    
Install as a Cake Addin
#tool nuget:?package=Dzeta.TonSdk.Core&version=0.5.0
                    
Install as a Cake Tool

Dzeta.TonSdk.NET

Note: This is a fork of TonSdk.NET with critical bug fixes and improvements.

Key changes:

  • Thread-safety fixes: Replaced Dictionary with ConcurrentDictionary in LiteClient for concurrent request handling
  • Bounds checking: Added BOC deserialization safety checks to prevent "Index out of range" errors
  • Address struct: Rewritten Address as a high-performance struct using fixed byte and ReadOnlySpan<byte>
  • EF Core integration: New extension package for Entity Framework Core value converters
  • Atomic operations: Proper use of TryAdd/TryRemove for thread-safe request management

Status: Currently only Core, Adnl, and EntityFrameworkCore packages are published. Other packages (Client, Contracts, Connect, DeFi) will be added incrementally with improvements.

Packages

Dzeta.TonSdk.Core

NuGet NuGet

Core library with types and structures for TON Blockchain. Includes:

  • Address as high-performance struct with fixed byte hash storage
  • Coins for TON, Jetton amounts
  • BOC serialization/deserialization with bounds checking
  • Cell, Builder, Slice
  • Mnemonic (BIP39 and TON standards)
  • Ed25519 signing
dotnet add package Dzeta.TonSdk.Core

Dzeta.TonSdk.Adnl

NuGet NuGet

Thread-safe ADNL client and LiteClient for interacting with TON blockchain nodes. Includes:

  • ADNL protocol implementation
  • LiteClient with concurrent request handling (ConcurrentDictionary)
  • Atomic operations for safe multi-threaded access
  • Block and account state queries
dotnet add package Dzeta.TonSdk.Adnl

Dzeta.TonSdk.Core.EntityFrameworkCore

NuGet NuGet

Entity Framework Core integration for TonSdk.Core types. Includes:

  • AddressValueConverter - stores Address as 36 bytes (4 bytes workchain + 32 bytes hash)
  • AddressStringValueConverter - stores Address as human-readable string (~80 bytes)
  • Extension methods for easy configuration
dotnet add package Dzeta.TonSdk.Core.EntityFrameworkCore

Usage example:

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
    modelBuilder.Entity<Wallet>()
        .Property(e => e.Address)
        .HasAddressConversion<Wallet>(); // Binary storage (36 bytes)
}

Features and Status

  • Builder, Cell, Slice
  • BOC (de)serialization with bounds checking
  • Hashmap(E) (dictionary) (de)serialization
  • Mnemonic BIP39 standard
  • Mnemonic TON standard
  • Coins (class for TON, JETTON, etc.)
  • Address (struct with fixed byte for high performance)
  • Message layouts (MessageX, etc.)
  • Popular structures from block.tlb
  • Ed25519 signing of transactions
  • ADNL client (thread-safe)
  • Lite client over ADNL client (thread-safe)
  • EF Core value converters for TON types
  • Client with HTTP API (coming soon)
  • Contracts abstraction (coming soon)
  • TON Connect 2.0 (coming soon)
  • DeFi integrations (coming soon)

Installation

Install via NuGet Package Manager or .NET CLI:

dotnet add package Dzeta.TonSdk.Core
dotnet add package Dzeta.TonSdk.Adnl
dotnet add package Dzeta.TonSdk.Core.EntityFrameworkCore  # Optional, for EF Core users

Quick Start

Using Address

using TonSdk.Core;

// Parse address
var address = new Address("EQDk2VTvn04SUKJrW7rXahzdF8_Qi6utb0wj43InCu9vdjrR");

// Get raw format
string raw = address.ToRaw(); // "0:e4d954ef9f4e1250a26b5bbad76a1cdd17cfc08babaddf4c23e37227..."

// Get workchain and hash
int workchain = address.Workchain; // 0
ReadOnlySpan<byte> hash = address.Hash; // 32 bytes

Using LiteClient

using TonSdk.Adnl;
using TonSdk.Adnl.LiteClient;

var client = new LiteClient(LiteClientOptions.GetFromUrl("https://ton-blockchain.github.io/global.config.json"));
await client.Connect();

var masterchain = await client.GetMasterchainInfo();
Console.WriteLine($"Last block: {masterchain.Last.Seqno}");

Using with Entity Framework Core

using TonSdk.Core;
using TonSdk.Core.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;

public class Wallet
{
    public int Id { get; set; }
    public Address Address { get; set; } // TON address stored efficiently
    public decimal Balance { get; set; }
}

public class MyDbContext : DbContext
{
    public DbSet<Wallet> Wallets { get; set; }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        // Binary storage (36 bytes) - recommended
        modelBuilder.Entity<Wallet>()
            .Property(e => e.Address)
            .HasAddressConversion<Wallet>();
    }
}

License

MIT License

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Dzeta.TonSdk.Core:

Package Downloads
Dzeta.TonSdk.Adnl

Library that allows to interact with Ton ADNL (Thread-safe fork with event-driven LiteClient architecture)

Dzeta.TonSdk.Core.EntityFrameworkCore

Entity Framework Core integration for TonSdk.Core, providing value converters for Address and other TON types

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.5.0 335 10/25/2025
0.4.0 192 10/25/2025
0.3.10 130 10/25/2025