Skip to main content

C#

The client library, known as postchain-client, provides functionality for interacting with a blockchain using C#. It allows you to send transactions and retrieve information from a blockchain node running Rell. It can be integrated into your C# projects through the NuGet package or by referencing the DLL files directly. Additionally, if you're working with Unity or Unity WebGL, specific instructions apply. Follow the steps below to properly use the library:

Installation and Setup

Using NuGet

At the NuGet library's page, you'll discover clear instructions that explain different ways to install the library.

Referencing DLL Files

  1. Download the Postchain client library release.
  2. Locate the DLL files corresponding to your project's target platform (e.g., NET Standard 2.1).
  3. In your project, add references to these DLL files.

Integration with Unity

If you're using Unity for your project, you can integrate the Postchain client library as follows:

  1. Download the Postchain client library release.
  2. Unpack the contents from the releases section.

Importing into Unity

  1. In your Unity project, navigate to the Assets menu.
  2. Create a folder named "Plugins" within the Assets folder if it doesn't exist.
  3. Move the unpacked DLL files into the "Plugins" folder.

Unity WebGL Compatibility

When working with Unity WebGL, you might encounter compatibility issues with the default transport library (System.Net). Follow these steps to address this issue:

  1. Download the UnityTransport.cs file or implement your own custom transport as needed.
  2. In your Unity project, locate the scripts folder or create one if needed.
  3. Place the UnityTransport.cs file in the scripts folder.

Injecting Custom Transport

Before creating a ChromiaClient instance, inject the custom transport using the following code snippet:

// Add this code before creating a ChromiaClient instance
ChromiaClient.DefaultTransport = new UnityTransport(); // Replace UnityTransport() with your custom transport if applicable

Usage

For a detailed introduction to the clients functionality, read the projects Readme.