read.cash Log in
@kth more from that month

Announcing Knuth C#/.NET API v0.7.0 Release announcement: Knuth C#/.NET API v0.7.0.

The Knuth team is pleased to announce the release of its **C#/.NET API version 0.7.0.** https://github.com/k-nuth/cs-api This release includes the following features and fixes: Based on the **Knuth C-API version 0.5.3.** https://github.com/k-nuth/c-api Workaround to fix an error in the crawlers **cashnodes.bitcoinunlimited.info** and **cash.coin.dance/nodes**. Now Knuth nodes are counted by this tool. https://cashnodes.bitcoinunlimited.info/nodes https://cash.coin.dance/nodes Our goal is to provide a set of libraries in various programming languages that simplifies application development, ease on-boarding of new developers and let them build their new ideas and really boost the Bitcoin Cash ecosystem. Using the Knuth C#/.NET API you can use our node as a library.

> "Hello, Knuth" https://read.cash/@kth/announcing-knuth-cnet-api-v021-0886f059#gt-quothello-knuthquot Using this library is very simple, since **Knuth provides a NuGet package.** https://www.nuget.org/packages/kth-bch 1. Create a new C# console project: https://read.cash/@kth/announcing-knuth-cnet-api-v021-0886f059#1-create-a-new-c-console-project $ mkdir HelloKnuth $ cd HelloKnuth $ dotnet new console 2. Add a reference to our C# API package: https://read.cash/@kth/announcing-knuth-cnet-api-v021-0886f059#2-add-a-reference-to-our-c-api-package $ dotnet add package kth-bch 3. Edit `Program.cs` and write some code: https://read.cash/@kth/announcing-knuth-cnet-api-v021-0886f059#3-edit-programcs-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: https://read.cash/@kth/announcing-knuth-cnet-api-v021-0886f059#4-enjoy-knuth-node-as-a-c-library $ dotnet run **You can see the prerequisites here**. https://github.com/k-nuth/cs-api#prerequisites Thanks to the Bitcoin Cash ecosystem for your support! Sincerely, The Knuth team.

1 comment

Log in to join in Reading is open to everyone. Replying needs an account.