kth-bch
0.23.1
dotnet add package kth-bch --version 0.23.1
NuGet\Install-Package kth-bch -Version 0.23.1
<PackageReference Include="kth-bch" Version="0.23.1" />
paket add kth-bch --version 0.23.1
#r "nuget: kth-bch, 0.23.1"
// Install kth-bch as a Cake Addin #addin nuget:?package=kth-bch&version=0.23.1 // Install kth-bch as a Cake Tool #tool nuget:?package=kth-bch&version=0.23.1
<img width="200px" src="https://github.com/k-nuth/cs-api/raw/master/docs/images/kth-purple.png" />
C# API
Bitcoin Cash full node as a C# library
<a target="_blank" href="https://t.me/knuth_cash"></a> <a target="_blank" href="https://k-nuth.slack.com/"></a>
<p align="center"><img width="800px" src="docs/images/demo.png" /></p>
Knuth C# API is a high performance implementation of the Bitcoin Cash protocol focused on users requiring extra performance and flexibility. It is a Bitcoin Cash node you can use as a library.
Prerequisites
Knuth C# API is a wrapper over our C++ libraries, therefore in order to use the C# library we will need the toolchain to build the C++ libraries. Don't panic, you won't have to manually build our C++ libraries, you just have to provide some prerequisites, our build system will take care of the rest.
To speed up the compilation, we provide some pre-built C++ libraries for some common computer platforms, but case there are no pre-built binaries for your platform, our build system will automatically try to build from source code. In such a scenario, the following requirements must be added to the previous ones:
- C++23 conforming compiler. Could be GCC12, Clang16 or Visual Studio 2022
- CMake building tool, version 3.8 or newer.
Getting started
- Create a new C# console project:
$ mkdir HelloKnuth
$ cd HelloKnuth
$ dotnet new console
- Add a reference to our C# API package:
$ dotnet add package kth-bch
- 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;
}
}
}
- Enjoy Knuth node as a C# library:
$ dotnet run
Issues
Each of our modules has its own Github repository, but in case you want to create an issue, please do so in our main repository.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- Microsoft.CSharp (>= 4.7.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.23.1 | 80 | 12/9/2024 |
0.23.1-pullrequest0016-0004 | 62 | 12/9/2024 |
0.23.1-pullrequest0015-0003 | 66 | 12/9/2024 |
0.23.1-pullrequest0014-0002 | 68 | 12/9/2024 |
0.23.1-feat-re-order-fi0002 | 57 | 12/9/2024 |
0.23.1-feat-improve-rea0002 | 62 | 12/9/2024 |
0.23.1-feat-add-readme0001 | 64 | 12/9/2024 |
0.23.1-ci0003 | 54 | 12/9/2024 |
0.23.1-ci0002 | 62 | 12/9/2024 |
0.23.1-ci0001 | 62 | 12/9/2024 |
0.23.0 | 83 | 12/9/2024 |
0.22.1-pullrequest0013-0005 | 66 | 12/9/2024 |
0.22.1-pullrequest0012-0004 | 65 | 12/8/2024 |
0.22.1-pullrequest0011-0003 | 62 | 12/8/2024 |
0.22.1-feat-payment-add0004 | 69 | 12/9/2024 |
0.22.1-feat-cpp-23-0002 | 71 | 12/8/2024 |
0.22.1-feat-copyright--0003 | 66 | 12/8/2024 |
0.22.1-ci0004 | 69 | 12/9/2024 |
0.22.1-ci0003 | 74 | 12/8/2024 |
0.22.1-ci0002 | 63 | 12/8/2024 |
0.22.0 | 109 | 9/9/2024 |
0.21.1-pullrequest0009-0015 | 87 | 9/9/2024 |
0.21.1-pullrequest0009-0014 | 85 | 9/9/2024 |
0.21.1-feat-bch-upgrad-0014 | 90 | 9/9/2024 |
0.21.1-ci0001 | 81 | 9/9/2024 |
0.21.0 | 495 | 11/4/2022 |
0.20.1-ci0003 | 238 | 11/4/2022 |
0.20.1-ci0002 | 248 | 11/4/2022 |
0.20.1-ci0001 | 226 | 8/13/2022 |
0.20.0 | 484 | 8/13/2022 |
0.19.1-ci0016 | 185 | 8/13/2022 |
0.19.1-ci0015 | 207 | 8/13/2022 |
0.19.1-ci0014 | 218 | 8/12/2022 |
0.19.1-ci0006 | 213 | 8/9/2022 |
0.19.0 | 523 | 3/26/2022 |
0.18.1-pullrequest0007-0015 | 223 | 3/26/2022 |
0.18.1-dotnet6-0015 | 193 | 3/26/2022 |
0.18.1-dotnet6-0014 | 215 | 3/26/2022 |
0.18.1-dotnet6-0011 | 214 | 3/25/2022 |
0.18.1-dotnet6-0010 | 234 | 3/25/2022 |
0.18.1-ci0005 | 207 | 3/26/2022 |
0.18.1-ci0002 | 210 | 3/23/2022 |
0.18.1-ci0001 | 297 | 9/8/2021 |
0.18.0 | 422 | 9/8/2021 |
0.17.1-ci0002 | 289 | 9/8/2021 |
0.17.0 | 435 | 9/8/2021 |
0.16.1-organize170block0001 | 261 | 9/7/2021 |
0.16.1-ci0002 | 314 | 9/8/2021 |
0.16.0 | 411 | 5/14/2021 |
0.15.1-ci0002 | 299 | 5/14/2021 |
0.15.0 | 417 | 4/14/2021 |
0.14.1-ci0001 | 307 | 4/14/2021 |
0.14.0 | 407 | 4/14/2021 |
0.13.2-ci0001 | 298 | 4/14/2021 |
0.13.1 | 450 | 3/11/2021 |
0.13.1-ci0009 | 359 | 3/11/2021 |
0.13.1-ci0008 | 367 | 3/11/2021 |
0.12.0 | 428 | 2/17/2021 |
0.11.1-ci0028 | 315 | 2/17/2021 |
0.11.1-ci0018 | 294 | 2/12/2021 |
0.11.1-ci0016 | 303 | 2/12/2021 |
0.11.1-ci0008 | 310 | 2/12/2021 |
0.11.1-ci0006 | 287 | 2/11/2021 |
0.11.1-ci0005 | 292 | 2/11/2021 |
0.11.1-ci0004 | 306 | 2/11/2021 |
0.11.1-ci0003 | 325 | 2/11/2021 |
0.11.0 | 434 | 2/10/2021 |
0.10.2-ci0017 | 315 | 2/10/2021 |
0.10.2-ci0001 | 294 | 2/8/2021 |
0.10.1 | 422 | 2/7/2021 |
0.10.0 | 389 | 2/5/2021 |
0.9.1-ci0006 | 301 | 2/5/2021 |
0.9.1-ci0003 | 366 | 12/22/2020 |
0.9.0 | 478 | 12/22/2020 |
0.8.0 | 515 | 10/29/2020 |
0.7.1-ci0005 | 376 | 10/28/2020 |
0.7.0 | 551 | 10/20/2020 |
0.6.0 | 566 | 10/19/2020 |
0.5.1-ci0004 | 432 | 10/19/2020 |
0.5.1-ci0002 | 376 | 10/19/2020 |
0.5.1-ci0001 | 374 | 10/17/2020 |
0.5.0 | 515 | 10/13/2020 |
0.4.1-ci0040 | 381 | 10/13/2020 |
0.4.1-ci0039 | 428 | 10/2/2020 |
0.4.0 | 558 | 9/18/2020 |
0.3.0 | 496 | 9/6/2020 |
0.2.1 | 544 | 8/31/2020 |
0.2.0 | 517 | 8/28/2020 |
0.1.0 | 534 | 8/25/2020 |