rubyweb3.TransactionLibrary 1.0.6

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

Web3TransactionLibrary Documentation

A .NET library for Ruby blockchain interactions with Ruby-style address formatting support.

Installation

dotnet add package rubyweb3.Web3TransactionLibrary 

Quick Start

1. Service Registration

using Microsoft.Extensions.DependencyInjection;
using Web3TransactionLibrary.Extensions;

// Basic registration
services.AddWeb3TransactionService("https://bridge-rpc.rubyscan.io", "rYOUR_PRIVATE_KEY");

// With custom logger
services.AddWeb3TransactionService(
    "https://bridge-rpc.rubyscan.io", 
    "rYOUR_PRIVATE_KEY", 
    logger);

// Register wallet services
services.AddRubyWeb3Services();

2. Basic Usage

Send Transaction
public class MyService
{
    private readonly ITransactionService _transactionService;

    public MyService(ITransactionService transactionService)
    {
        _transactionService = transactionService;
    }

    public async Task SendRUBY()
    {
        try
        {
            // Send 0.1 RUBY to a Ruby-formatted address
            string transactionHash = await _transactionService.SendTransactionAsync(
                "r742d45d5f2e6f9e5a1d3a8b7c6e5f4a3b2c1d0e9f8a7b6", // Ruby format address
                0.1m, // Amount in RUBY
                25.0m // Gas price in Gwei (optional)
            );
            
            Console.WriteLine($"Transaction sent: {transactionHash}");
        }
        catch (Exception ex)
        {
            Console.WriteLine($"Error: {ex.Message}");
        }
    }
}
Check Balance
public async Task CheckBalance()
{
    decimal balance = await _transactionService.GetBalanceAsync("r742d45d5f2e6f9e5a1d3a8b7c6e5f4a3b2c1d0e9f8a7b6");
    Console.WriteLine($"Balance: {balance} RUBY");

    // Detailed balance information
    var detailedBalance = await _transactionService.GetBalanceDetailedAsync("r742d45d5f2e6f9e5a1d3a8b7c6e5f4a3b2c1d0e9f8a7b6");
    Console.WriteLine($"Address: {detailedBalance.Address}");
    Console.WriteLine($"Balance: {detailedBalance.Balance} {detailedBalance.Unit}");
    Console.WriteLine($"Retrieved at: {detailedBalance.RetrievedAt}");
}
Get Transaction Data
public async Task GetTransactionInfo()
{
    var transactionData = await _transactionService.GetTransactionDataAsync("r9f8a7b6c5d4e3f2a1b0c9d8e7f6a5b4c3d2e1f0a9b8c7d6e5f4a3b2c1d0e9f8a7b6");
    
    Console.WriteLine($"From: {transactionData.FromAddress}");
    Console.WriteLine($"To: {transactionData.ToAddress}");
    Console.WriteLine($"Value: {transactionData.Value} RUBY");
    Console.WriteLine($"Status: {transactionData.Status}");
    Console.WriteLine($"Block: {transactionData.BlockNumber}");
}

3. Wallet Management

public class WalletServiceExample
{
    private readonly IWalletService _walletService;

    public WalletServiceExample(IWalletService walletService)
    {
        _walletService = walletService;
    }

    public void WalletOperations()
    {
        // Create new wallet
        var newWallet = _walletService.CreateWallet();
        Console.WriteLine($"New wallet created:");
        Console.WriteLine($"Address: {newWallet.Address}");
        Console.WriteLine($"Private Key: {newWallet.PrivateKey}");
        Console.WriteLine($"Created: {newWallet.CreatedAt}");

        // Get address from private key
        string address = _walletService.GetAddressFromPrivateKey("rYOUR_PRIVATE_KEY");
        Console.WriteLine($"Derived address: {address}");

        // Validate private key
        bool isValidPrivateKey = _walletService.ValidatePrivateKey("rYOUR_PRIVATE_KEY");
        Console.WriteLine($"Private key valid: {isValidPrivateKey}");

        // Validate address
        bool isValidAddress = _walletService.ValidateAddress("r742d45d5f2e6f9e5a1d3a8b7c6e5f4a3b2c1d0e9f8a7b6");
        Console.WriteLine($"Address valid: {isValidAddress}");
    }
}

4. Contract Interactions

public async Task ContractOperations()
{
    // Deploy contract
    string bytecode = "0x606060..."; // Your contract bytecode
    string abi = "[{...}]"; // Your contract ABI
    string contractAddress = await _transactionService.DeployContractAsync(bytecode, abi);
    Console.WriteLine($"Contract deployed at: {contractAddress}");

    // Call contract function
    string result = await _transactionService.CallContractAsync(
        contractAddress, 
        abi, 
        "getBalance", 
        "r742d45d5f2e6f9e5a1d3a8b7c6e5f4a3b2c1d0e9f8a7b6"
    );
    Console.WriteLine($"Contract call result: {result}");
}

Address Formats

Ruby Format

  • Starts with r
  • 40 hex characters
  • Example: r742d45d5f2e6f9e5a1d3a8b7c6e5f4a3b2c1d0e9f8a7b6

Configuration

appsettings.json

{
  "Blockchain": {
    "RpcUrl": "https://bridge-rpc.rubyscan.io",
    "PrivateKey": "rYOUR_PRIVATE_KEY"
  }
}

Program.cs

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddWeb3TransactionService(
    builder.Configuration["Blockchain:RpcUrl"],
    builder.Configuration["Blockchain:PrivateKey"]
);

builder.Services.AddRubyWeb3Services();

Error Handling

try
{
    var result = await _transactionService.SendTransactionAsync(toAddress, amount);
}
catch (ApplicationException ex)
{
    // Handle blockchain-specific errors
    Console.WriteLine($"Transaction failed: {ex.Message}");
}
catch (Exception ex)
{
    // Handle general errors
    Console.WriteLine($"Error: {ex.Message}");
}

Best Practices

  1. Security: Never hardcode private keys
  2. Error Handling: Always wrap blockchain calls in try-catch
  3. Gas Management: Monitor gas prices and adjust accordingly
  4. Address Validation: Always validate addresses before using them
  5. Disposal: Services implement IDisposable for proper resource cleanup

Dependencies

  • .NET 6.0+
  • Nethereum library
  • Microsoft.Extensions.DependencyInjection
  • Microsoft.Extensions.Logging

Support

For issues and questions:

  • Check the library documentation
  • Review error messages carefully
  • Ensure proper RPC endpoint configuration
  • Validate address formats before use

This library provides seamless integration with Ruby blockchain while maintaining Ruby-style address formatting for compatibility with existing systems.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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. 
.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 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 is compatible.  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.6 129 9/24/2025