RgbLib 0.3.0-beta.32

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

rgb-lib-c-sharp

C# bindings for rgb-lib - RGB smart contracts library for Bitcoin.

Installation

dotnet add package RgbLib

Or add to your .csproj:

<PackageReference Include="RgbLib" Version="0.3.0-beta.5" />

Supported Platforms

  • Linux x64 (linux-x64)
  • macOS ARM64 (osx-arm64)
  • Windows x64 (win-x64)

Usage

using RgbLib;

// Generate new keys
var keysJson = RgbLibWallet.GenerateKeys("testnet");
Console.WriteLine($"Keys: {keysJson}");

// Create wallet configuration
var walletData = @"{
    ""data_dir"": ""/tmp/rgb-wallet"",
    ""bitcoin_network"": ""testnet"",
    ""database_type"": ""sqlite"",
    ""max_allocations_per_utxo"": 5,
    ""pubkey"": ""your_pubkey_here"",
    ""mnemonic"": ""your mnemonic words here""
}";

// Create and use wallet
using (var wallet = new RgbLibWallet(walletData))
{
    // Go online
    wallet.GoOnline("ssl://electrum.blockstream.info:60002");
    
    // Get address
    var address = wallet.GetAddress();
    Console.WriteLine($"Address: {address}");
    
    // Get BTC balance
    var balance = wallet.GetBtcBalance();
    Console.WriteLine($"Balance: {balance}");
    
    // List assets
    var assets = wallet.ListAssets();
    Console.WriteLine($"Assets: {assets}");
}

Low-Level API

For more control, use the NativeMethods class directly:

using RgbLib;

// Direct P/Invoke calls
var result = NativeMethods.rgblib_generate_keys("testnet");
if (result.IsSuccess)
{
    Console.WriteLine(result.GetResult());
}
else
{
    Console.WriteLine($"Error: {result.GetError()}");
}

Building from Source

Prerequisites

  • .NET 8.0 SDK
  • Native rgb-lib library (librgblibcffi.so, librgblibcffi.dylib, or rgblibcffi.dll)

Build

# Clone repository
git clone https://github.com/UTEXO-Protocol/rgb-lib-c-sharp.git
cd rgb-lib-c-sharp

# Build
dotnet build

# Run tests
dotnet test

Automatic Releases

This repository is automatically updated when a new version of rgb-lib is released. The CI/CD pipeline:

  1. Detects new rgb-lib release
  2. Downloads pre-compiled native libraries
  3. Builds C# bindings
  4. Creates NuGet package
  5. Publishes release

License

MIT License

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.
  • net8.0

    • No dependencies.

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
0.3.0-beta.32 40 7/31/2026
0.3.0-beta.31 34 7/28/2026
0.3.0-beta.30 83 7/15/2026
0.3.0-beta.29 52 7/10/2026
0.3.0-beta.28 55 7/7/2026
0.3.0-beta.27 55 6/29/2026
0.3.0-beta.26 56 6/25/2026
0.3.0-beta.25 63 6/19/2026
0.3.0-beta.24 69 6/17/2026
0.3.0-beta.23 68 6/15/2026
0.3.0-beta.22 59 6/3/2026
0.3.0-beta.21.1 87 5/27/2026
0.3.0-beta.21 63 5/27/2026