The Knuth project is pleased to announce the release of its C#-API version 0.19.0.
This release includes the following features and fixes:
Support for the May 15, 2022 Network Upgrade. This release implements the following two consensus CHIPs:
CHIP-2021-03: Bigger Script Integers increased precision for arithmetic operations.
CHIP-2021-02: Native Introspection Opcodes enabling smart contracts to inspect the current transaction.
Support for .NET Core 6.
Support for Visual Studio 2022 on Windows.
Based on the Knuth C-API version 0.24.0.
Several external dependencies were updated.
Using the Knuth C#-API you can use the node as a library.
For the full release notes, please visit:
https://github.com/k-nuth/cs-api/releases/tag/v0.19.0
For information about how to install Knuth, please visit our website at https://kth.cash/#download.
> "Hello, Knuth"
Using this library is very simple, since Knuth provides a NuGet package.
1. Create a new C# console project:
$ mkdir HelloKnuth
$ cd HelloKnuth
$ dotnet new console
2. Add a reference to our C# API package:
$ dotnet add package kth-bch
3. Edit Program.cs
and write some code:
using System;
using System.Threading.Tasks;
using Knuth;
namespace HelloKnuth {
public class Program {
private static bool running_;
static async Task Main(string[] args) {
Console.CancelKeyPress += OnSigInterrupt;
var config = Knuth.Config.Settings.GetDefault(NetworkType.Mainnet);
using (var node = new Knuth.Node(config)) {
await node.LaunchAsync();
Console.WriteLine("Knuth node has been launched.");
var height = await node.Chain.GetLastHeightAsync();
Console.WriteLine($"Current height in local copy: {height.Result}");
if (await ComeBackAfterTheBCHHardFork(node)) {
Console.WriteLine("Bitcoin Cash has been created!");
}
}
Console.WriteLine("Good bye!");
}
private static async Task<bool> ComeBackAfterTheBCHHardFork(Node node) {
UInt64 hfHeight = 478559;
while (running_) {
var res = await node.Chain.GetLastHeightAsync();
if (res.Result >= hfHeight) return true;
await Task.Delay(10000);
}
return false;
}
private static void OnSigInterrupt(object sender, ConsoleCancelEventArgs args) {
Console.WriteLine("Stop signal detected.");
args.Cancel = true;
running_ = false;
}
}
}
4. Enjoy Knuth node as a C# library:
$ dotnet run
You can see the prerequisites here.
Thank you!
Knuth is open source software that needs community support to continue its development. Therefore we would like to thank the generosity of our supporters and that of the entire Bitcoin Cash ecosystem. You are the ones that allow us to move forward with our goal, which is everyone's goal at Bitcoin Cash, which is to be the Peer-to-Peer Electronic Cash System for the entire world.
Donation address:
bitcoincash:qrlgfg2qkj3na2x9k7frvcmv06ljx5xlnuuwx95zfn
I have been waiting for the release of the new version of the. Node but I forget now I would go and try it out