rubyweb3.Web3TransactionLibrary
1.0.5
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package rubyweb3.Web3TransactionLibrary --version 1.0.5
NuGet\Install-Package rubyweb3.Web3TransactionLibrary -Version 1.0.5
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.Web3TransactionLibrary" Version="1.0.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="rubyweb3.Web3TransactionLibrary" Version="1.0.5" />
<PackageReference Include="rubyweb3.Web3TransactionLibrary" />
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.Web3TransactionLibrary --version 1.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: rubyweb3.Web3TransactionLibrary, 1.0.5"
#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.Web3TransactionLibrary@1.0.5
#: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.Web3TransactionLibrary&version=1.0.5
#tool nuget:?package=rubyweb3.Web3TransactionLibrary&version=1.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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
- Security: Never hardcode private keys
- Error Handling: Always wrap blockchain calls in try-catch
- Gas Management: Monitor gas prices and adjust accordingly
- Address Validation: Always validate addresses before using them
- 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 | 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 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.
-
net8.0
- Microsoft.Extensions.DependencyInjection (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.0)
- Nethereum.Accounts (>= 4.25.0)
- Nethereum.Web3 (>= 4.25.0)
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.1.5 | 572 | 12/1/2025 |
| 1.1.4 | 469 | 12/1/2025 |
| 1.1.3 | 468 | 12/1/2025 |
| 1.1.2 | 467 | 12/1/2025 |
| 1.1.1 | 464 | 12/1/2025 |
| 1.1.0 | 466 | 12/1/2025 |
| 1.0.9 | 462 | 12/1/2025 |
| 1.0.8 | 460 | 12/1/2025 |
| 1.0.7 | 465 | 12/1/2025 |
| 1.0.6 | 181 | 9/24/2025 |
| 1.0.5 | 181 | 9/23/2025 |
| 1.0.4 | 175 | 9/22/2025 |
| 1.0.3 | 191 | 9/22/2025 |
| 1.0.2 | 175 | 9/22/2025 |
| 1.0.1 | 200 | 9/22/2025 |
| 1.0.0 | 196 | 9/22/2025 |