Skip to content

qubic/Qubic.NET

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Qubic.NET

A modular .NET 8.0 library for interacting with the Qubic network. Provides direct TCP node communication, HTTP RPC, and QubicBob JSON-RPC clients, along with core domain models, binary serialization, and pure C# cryptographic primitives.

image

Packages

Package Version Description
Qubic.Crypto NuGet Pure C# implementation of Qubic cryptographic primitives: K12 (KangarooTwelve) hashing, FourQ elliptic curve, SchnorrQ signatures, and ECDH key exchange. Zero external dependencies.
Qubic.Core NuGet Core domain models, identity handling, transaction building, and signing abstractions.
Qubic.Serialization NuGet Binary serialization for the Qubic network protocol (packet headers, readers, writers).
Qubic.Network NuGet Direct TCP client for communicating with Qubic network nodes.
Qubic.Rpc NuGet HTTP client for the official Qubic RPC API.
Qubic.Bob NuGet JSON-RPC client for the QubicBob API.

Installation

dotnet add package Qubic.Core
dotnet add package Qubic.Network
dotnet add package Qubic.Rpc
dotnet add package Qubic.Bob

Dependency Graph

Qubic.Crypto        (no dependencies)
  └── Qubic.Core
       └── Qubic.Serialization
            └── Qubic.Network
       └── Qubic.Rpc
       └── Qubic.Bob

Usage

Identity

using Qubic.Core.Entities;

// From a 60-character identity string
var identity = QubicIdentity.FromIdentity("BAAAAAAAA...");

// From a 55-character seed
var identity = QubicIdentity.FromSeed("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabc");

// From a 32-byte public key
var identity = QubicIdentity.FromPublicKey(publicKeyBytes);

Build and Sign a Transaction

using Qubic.Core;
using Qubic.Core.Entities;

var builder = new TransactionBuilder();

var tx = builder.CreateTransfer(
    source: QubicIdentity.FromSeed(seed),
    destination: QubicIdentity.FromIdentity("DEST..."),
    amount: 1000,
    tick: currentTick + 5
);

builder.Sign(tx, seed);

Direct TCP Node Communication

using Qubic.Network;

using var client = new QubicNodeClient("164.90.178.16");
await client.ConnectAsync();

var tickInfo = await client.GetCurrentTickInfoAsync();
Console.WriteLine($"Tick: {tickInfo.Tick}, Epoch: {tickInfo.Epoch}");

var balance = await client.GetBalanceAsync(identity);
Console.WriteLine($"Balance: {balance.Amount}");

await client.BroadcastTransactionAsync(signedTx);

HTTP RPC

using Qubic.Rpc;

using var rpc = new QubicRpcClient("https://rpc.qubic.org");

var tick = await rpc.GetLatestTickAsync();
var balance = await rpc.GetBalanceAsync(identity);
var txId = await rpc.BroadcastTransactionAsync(signedTx);

QubicBob JSON-RPC

using Qubic.Bob;

using var bob = new BobClient("http://localhost:40420");

var chainId = await bob.GetChainIdAsync();
var tickNumber = await bob.GetTickNumberAsync();
var balance = await bob.GetBalanceAsync(identity);
var transfers = await bob.GetTransfersAsync(identity, startTick: 1000, endTick: 2000);

Applications

App Repository Description
Qubic.Net Toolkit Qubic.Net.Toolkit Cross-platform desktop app for wallet management, transaction building, contract interaction, and network monitoring.
Qubic.Net Wallet Qubic.Net.Wallet Cross-platform desktop wallet with dashboard, asset management, staking, DEX trading, and multi-sig vaults.

Dev Tools

Tool Description
Qubic.ContractGen Parses C++ smart contract headers from qubic-core and generates C# bindings with correct struct layouts, type mappings, and MSVC /Zp8 alignment.
Qubic.ScTester Blazor Server web UI for browsing and testing all generated smart contract functions against live Qubic nodes via RPC, Bob, or direct TCP.
# Generate C# contract bindings
dotnet run --project tools/Qubic.ContractGen

# Launch the SC Tester web UI
dotnet run --project tools/Qubic.ScTester

Building

dotnet build

Testing

dotnet test

Real-node integration tests require the QUBIC_NODE_IP environment variable:

QUBIC_NODE_IP=164.90.178.16 dotnet test

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages