Utilities.Tron.AddressConverter 8.0.1024

dotnet add package Utilities.Tron.AddressConverter --version 8.0.1024
                    
NuGet\Install-Package Utilities.Tron.AddressConverter -Version 8.0.1024
                    
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="Utilities.Tron.AddressConverter" Version="8.0.1024" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Utilities.Tron.AddressConverter" Version="8.0.1024" />
                    
Directory.Packages.props
<PackageReference Include="Utilities.Tron.AddressConverter" />
                    
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 Utilities.Tron.AddressConverter --version 8.0.1024
                    
#r "nuget: Utilities.Tron.AddressConverter, 8.0.1024"
                    
#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 Utilities.Tron.AddressConverter@8.0.1024
                    
#: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=Utilities.Tron.AddressConverter&version=8.0.1024
                    
Install as a Cake Addin
#tool nuget:?package=Utilities.Tron.AddressConverter&version=8.0.1024
                    
Install as a Cake Tool

Utilities.Tron.AddressConverter

GitHub Build Status Nuget

Coverage Quality Gate Status Reliability Rating Security Rating Vulnerabilities

A simple .NET library for conversion between HEX format addresses and TRON blockchain addresses, targeting .NET 8.

Description

This library provides utility extension methods to convert hexadecimal string representations of addresses to the Base58Check encoded TRON address format. It also includes an object pool for SHA256 instances to optimize performance and reduce memory allocations during repeated hashing operations required for address checksum calculations.

Features

  • Convert hexadecimal addresses to TRON addresses.
  • Handles optional "0x" prefix in hex addresses.
  • Efficiently computes checksums using a pooled SHA256 implementation.

Installation

You can install the package via NuGet Package Manager:

Install-Package Utilities.Tron.AddressConverter

Or via the .NET CLI:

dotnet add package Utilities.Tron.AddressConverter

Usage

Here's a basic example of how to convert a hexadecimal address to a TRON address:

using Utilities.Tron.AddressConverter.Extensions;

public class Example
{
    public static void Main(string[] args)
    {
        string? hexAddress = "0xa614f803b6fd780986a42c78ec9c7f77e6ded13c"; // Example hex address (with or without "0x" prefix)
        string? tronAddress = hexAddress.ToTronAddress();

        if (tronAddress != null)
        {
            Console.WriteLine($"Hex Address: {hexAddress}");
            Console.WriteLine($"Tron Address: {tronAddress}");
            // Expected Tron Address: TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t (for the example hex above without the 0x41 prefix)
            // If the hexAddress already includes the 0x41 prefix, the output will be the same.
        }
        else
        {
            Console.WriteLine("Invalid hex address provided.");
        }
    }
}

Sha256Pool

For applications performing many address conversions, the Sha256Pool class is used internally by ToTronAddress to manage SHA256 crypto provider instances. This helps in reducing GC pressure by reusing SHA256 objects. If you have other parts of your application that require SHA256 hashing, you can also leverage this pool:

using System.Security.Cryptography;
using Utilities.Tron.AddressConverter; // Namespace for Sha256Pool

// ...

SHA256 sha256Instance = Sha256Pool.Rent();
try
{
    // Use sha256Instance for hashing operations
    // byte[] dataToHash = ...;
    // byte[] hash = sha256Instance.ComputeHash(dataToHash);
}
finally
{
    Sha256Pool.Return(sha256Instance);
}
Product 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 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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
8.0.1024 288 6/10/2025