Join 48,465 users and earn money for participation

Announcing Knuth C#/.NET API v0.1.0

1 207 exc boost
Avatar for kth
Written by   62
5 months ago

Release announcement: Knuth C#/.NET API v0.1.0.

The Knuth team is pleased to announce the release of its C#/.NET API version 0.1.0.

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. So here is the first release of the library that is based on the Knuth C-API version 0.4.3.

Using the Knuth C#/.NET API you can use our node as a library.

So the C#/.NET library has just joined our family of libraries: C++17 and C. But this does not end here, in the coming months we will be releasing the Knuth libraries for other programming languages: Python, Javascript, Java, Go, Eiffel, Rust.

The Knuth family

> "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;

            using (var node = new Knuth.Node("mainnet.cfg")) {
                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.


If you are interested in knowing more about the Knuth C#/.NET library, we will be presenting it at the Bitcoin Cash DevCon III on the 4th of September 2020.


About funding and Flipstarter campaign

We want to thank all the donors to our new Flipstarter campaign created for the purpose of launching and maintaining this new piece of software.

It is worth clarifying that this new campaign is not entirely aligned with our main campaign funded in May 2020. The funds raised in the May campaign are being used to make general improvements to the node and guarantee its proper functioning as a mining node.

As we have other goals in addition to making Knuth a reliable mining node, such as making it easy to on-board new developers who can build new ideas and applications for the end user that boost the adoption of Bitcoin Cash. We have decided to create this campaign and it is likely that we launch more campaigns in the future.

Here is the link to our ongoing campaign: https://campaigns.kth.cash/?id=10


Thanks to the Bitcoin Cash ecosystem for your support!

Sincerely,
The Knuth team.

9
$ 2.72
$ 1.00 from @im_uname
$ 1.00 from @ZakMcRofl
$ 0.50 from @ErdoganTalk
+ 3
Sponsors of kth
empty
empty
empty
Avatar for kth
Written by   62
5 months ago
Enjoyed this article?  Earn Bitcoin Cash by sharing it! Explain
...and you will also help the author collect more tips.

Comments

Fine dear

$ 0.00
5 months ago