UsdtDotNet 1.0.0

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

UsdtDotNet


Features

  • Offline HD Wallet Generation: for Tron and Ethereum networks and create USDT, USDC and other transactions on blockchain.
  • Secure & Self-Custodial: Private keys never leave your environment.
  • Supports USDT/USDC: (TRC20 & ERC20) and native coins (TRX/ETH).
  • No API Dependency: Sign transactions locally - offline.
  • Payment with USDT: if you need to add payment service in your project, it is so easy to use it using C#.

HD Wallet

  • UsdtDotNet can generate wallet support TRON and Ethereum addresses
  • generate unlimited HD Wallets
  • Supports BIP-39 English words list

Available coins for transactions

Coin Chain Contract Description
TRX Tron Official Token of Tron
USDT_TRC20 Tron TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t USDT Tether
USDC_TRC20 Tron TEkxiTehnzSmSe2XqrBj4w32RUN966rdz8 USDC Circle
ETH Ethereum Official Token of Ethereum
USDT_ERC20 Ethereum 0xdAC17F958D2ee523a2206206994597C13D831ec7 USDT Tether
USDC_ERC20 Ethereum 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 USDC Circle

UsdtDotNet Service Fees

  • TRX/ETH Transactions: Free.
  • TRC20 Tokens: 5 TRX per 10,000 tokens.
  • ERC20 Tokens: 0.0005 ETH per 10,000 tokens.

Production and test networks

You can choose the network for test your project from available networks (default network is Mainnet)

ApiConnection.Network = Networks.Mainnet; //default network
Chain Production network Test network
Tron Tron Mainnet Nile Testnet (for test only)
Ethereum Ethereum Mainnet Sepolia Testnet (for test only)

Development

First step to start

  • Signup to the Tron Grid https://www.trongrid.io/ for free and get api key to connect to the Tron blockchain
  • Signup to the infura https://www.infura.io/ for free and get api key to connect to the Ethereum blockchain
  • most functions are return object of type TResultObject that containe bool 'Sucsses', you must check the value of result.Sucsses if true then get the function result from object result.Data, else if 'Sucsses' value is false you can get information about Error at object result.ErrorData.ErrorMsg
  • add UsdtDotNet package to your application and using this namespaces:
using HdWalletDotNet.Objects;
using HdWalletDotNet.Services;

Quick Start

1: Generate HD Wallet Offline

Generate your tron HD Wallet Offline by random bytes and get wallet keys and address and secret words at the result

public async void Func_GenerateWalletOffline()
{
    byte[] RandomBytes = new byte[] { 167, 47, 16, 99, 72, 108, 30, 240, 7, 89, 48, 173, 64, 51, 86, 203 };
    ushort Index = 0; //default value is 0 
    var service = new HdWallet();
    var result = await service.GenerateWalletOffline(RandomBytes, Index);
}
result object
Object name Object value Description
result.Data.Mnemonic poet joy boat move sea job buddy champion pull account stick nuclear the secret words for generated wallet
result.Data.TronKey.PrivateKey bfc0760d387d25c77e357d61b0d4caaf124b126e95209c7b1090c2c41646fdba private Key for tron network
result.Data.TronKey.Address TC2XaRjm1wHQA4duyHR6pwqpKZYX6RN6gZ wallet address for tron network
result.Data.EthereumKey.PrivateKey 20e26d730b99ee6a1001519866bb7ce71ad971643d9910e67820a3e2b7471b1a private Key for Ethereum network
result.Data.EthereumKey.Address 0x47d5a094cfbf042ea2981ef0bbb22a4bdb1630bf wallet address for Ethereum network
for Random Bytes length must be as table
Random bytes length Secret words count
16 bytes 12 words
20 bytes 15 words
24 bytes 18 words
28 bytes 21 words
32 bytes 24 words
  • you can use Index for generate multiple wallets with same secret words
  • always you must to use result.Data.TronKey when you call any functions via Tron blockchain and result.Data.EthereumKey for Ethereum blockchain
  • Warning: Always keep private keys secure. UsdtDotNet does not store or transmit your keys.

2: Backup HD Wallet

if you have a wallet and you want to get wallet keys and addresses to use it, you can Backup it using secret words

for secret words count must be as last table

public async void Func_BackupWallet()
{
    string data = "poet joy boat move sea job buddy champion pull account stick nuclear"; // secret words
    var service = new HdWallet();
    var result = await service.BackupWallet(data);
}

3: Create Transaction

by this function you can create transaction and send coins to another wallet

  • Example 1: we will send 100 USDT_TRC20 via Tron network, from the wallet that we generated above (we need just private key), to the address TEwSJVoqQ7omHzx7x2UPkKwGo4ubdARuvE
// Example 1
public async void Func_CreateAndBroadcast()
{
    ApiConnection.Network = Networks.Mainnet; //default network
    ApiConnection.TronApiKey = "------------your Tron api key her-------------";
    var data = new Transaction()
    {
        Coin = Coins.USDT_TRC20,
        ToAddress = "TEwSJVoqQ7omHzx7x2UPkKwGo4ubdARuvE",
        Amount = 100,
        PrivateKey = "bfc0760d387d25c77e357d61b0d4caaf124b126e95209c7b1090c2c41646fdba"
    };            
    var service = new TransactionBroadcast();
    var result = await service.CreateAndBroadcast(data);
}
  • Example 2: we will send 200 USDT_ERC20 via Ethereum network, from the wallet that we generated above (we need just private key), to the address 0x860dbec5965a6c320ccaf46d44671c9a05714f1f
// Example 2
public async void Func_CreateAndBroadcast()
{
    ApiConnection.Network = Networks.Mainnet; //default network
    ApiConnection.InfuraApiKey = "------------your Infura api key her-------------";
    var data = new Transaction()
    {
        Coin = Coins.USDT_ERC20,
        ToAddress = "0x860dbec5965a6c320ccaf46d44671c9a05714f1f",
        Amount = 200,
        PrivateKey = "20e26d730b99ee6a1001519866bb7ce71ad971643d9910e67820a3e2b7471b1a"
    };            
    var service = new TransactionBroadcast();
    var result = await service.CreateAndBroadcast(data);
}

both examples at the result if Sucsses is true, you can get txID from the object result.Data.ID, else if Sucsses is false, you can get information about error from object result.ErrorData.ErrorMsg

4: Get Wallet Balance

you can get coin Balances for any wallet by his address

public async void Func_GetBalance()
{
    ApiConnection.Network = Networks.Mainnet; //default network
    ApiConnection.TronApiKey = "------------your Tron api key her-------------";
    ApiConnection.InfuraApiKey = "------------your Infura api key her-------------";
    var service = new HdWallet();
    var result1 = await service.GetBalance(Coins.TRX, "TC2XaRjm1wHQA4duyHR6pwqpKZYX6RN6gZ");
    var result2 = await service.GetBalance(Coins.USDT_TRC20, "TC2XaRjm1wHQA4duyHR6pwqpKZYX6RN6gZ");
    var result3 = await service.GetBalance(Coins.ETH, "0x47d5a094cfbf042ea2981ef0bbb22a4bdb1630bf");
    var result4 = await service.GetBalance(Coins.USDT_ERC20, "0x47d5a094cfbf042ea2981ef0bbb22a4bdb1630bf");
}

5: Get Wallet address by Private Key

public void Func_GetTronAddressByPrivateKey()
{
    var service = new HdWallet();
    string TronPrivateKey = "bfc0760d387d25c77e357d61b0d4caaf124b126e95209c7b1090c2c41646fdba";
    string EthereumPrivateKey = "20e26d730b99ee6a1001519866bb7ce71ad971643d9910e67820a3e2b7471b1a";
    var result1 = service.GetAddressByPrivateKey(Coins.TRX, TronPrivateKey);
    var result2 = service.GetAddressByPrivateKey(Coins.ETH, EthereumPrivateKey);


    //result1 : TC2XaRjm1wHQA4duyHR6pwqpKZYX6RN6gZ
    //result2 : 0x47d5a094cfbf042ea2981ef0bbb22a4bdb1630bf
}

6: Validate values

you can check for wallet Keys and address

public void Func_Validate()
{
    bool result1 = HdWallet.PrivateKeyValidate("bfc0760d387d25c77e357d61b0d4caaf124b126e95209c7b1090c2c41646fdba"); //true
    bool result2 = HdWallet.PrivateKeyValidate("any value 123456"); //false

    bool result3 = HdWallet.AddressValidate(Coins.TRX, "TC2XaRjm1wHQA4duyHR6pwqpKZYX6RN6gZ"); //true
    bool result4 = HdWallet.AddressValidate(Coins.TRX, "0x47d5a094cfbf042ea2981ef0bbb22a4bdb1630bf"); //false

    bool result5 = HdWallet.AddressValidate(Coins.ETH, "0x47d5a094cfbf042ea2981ef0bbb22a4bdb1630bf"); //true
    bool result6 = HdWallet.AddressValidate(Coins.ETH, "TC2XaRjm1wHQA4duyHR6pwqpKZYX6RN6gZ"); //false

    bool result7 = HdWallet.AddressValidate(Coins.ETH, "any valueeeeeeeee"); //false
}

7: Calculate UsdtDotNet Service Fees

Calculate fee by transaction type and coin amount, the fee coin will be always is TRX

public void Func_GetServiceFee()
{
    var service = new TransactionBroadcast();

    var result1 = service.GetServiceFee(Coins.TRX, 850);    // 0 TRX (free)
    var result2 = service.GetServiceFee(Coins.ETH, 0.21);   // 0 ETH (free)

    var result3 = service.GetServiceFee(Coins.USDT_TRC20, 2000);   // 5 TRX
    var result4 = service.GetServiceFee(Coins.USDT_ERC20, 9000);   // 0.0005 ETH
    var result5 = service.GetServiceFee(Coins.USDT_TRC20, 11500); // 10 TRX
}

8: Calculate Tron network Fee

you can Calculate network fee for energy required to create transaction, the fee coin will be always is TRX

public async void Func_GetNetworkFee()
{
    ApiConnection.Network = Networks.Mainnet; //default network
    ApiConnection.InfuraApiKey = "------------your Infura api key her-------------";
    var service = new TransactionBroadcast();
    string FromAddress = "0x47d5a094cfbf042ea2981ef0bbb22a4bdb1630bf";
    string ToAddress = "0x860dbec5965a6c320ccaf46d44671c9a05714f1f";
    var result = await service.GetNetworkFee(Coins.USDT_ERC20, 600, FromAddress, ToAddress);
}

License

MIT

Contact

For more information, suggestions and questions please contact TronDotNet Team by email: trondotnet@hotmail.com

If this is helpful to you and you would like to donate to the team:

  • Tron Address: TEwSJVoqQ7omHzx7x2UPkKwGo4ubdARuvE
  • Ethereum Address: 0x860dbec5965a6c320ccaf46d44671c9a05714f1f
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  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 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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
1.0.0 152 6/23/2025