Wodanaz.Tendermint.Api
0.38.6
dotnet add package Wodanaz.Tendermint.Api --version 0.38.6
NuGet\Install-Package Wodanaz.Tendermint.Api -Version 0.38.6
<PackageReference Include="Wodanaz.Tendermint.Api" Version="0.38.6" />
paket add Wodanaz.Tendermint.Api --version 0.38.6
#r "nuget: Wodanaz.Tendermint.Api, 0.38.6"
// Install Wodanaz.Tendermint.Api as a Cake Addin #addin nuget:?package=Wodanaz.Tendermint.Api&version=0.38.6 // Install Wodanaz.Tendermint.Api as a Cake Tool #tool nuget:?package=Wodanaz.Tendermint.Api&version=0.38.6
Tendermint C# GRPC ABCI Assembly
This is a precompiled package of the Tendermint ABCI API. The API is also mostly compatible with the current CosmosBFT 0.38 implementation.
Tendermint Server
Implementing a Tendermint Server is quite easy. Preprare your ASP.NET core Web Application or API Project for gRPC use and implement the abstract ABCIApplication.ABCIApplicationBase class:
public class WodanazApp : ABCIApplication.ABCIApplicationBase, IWodanazApp
{
private IConfiguration _conf;
public WodanazApp(IConfiguration conf)
{
_conf = conf;
}
public override Task<ResponseInfo> Info(RequestInfo request, ServerCallContext context)
{
// Only fake results
return Task.FromResult(new ResponseInfo() { AppVersion = 1, Version = "1.0", Data = "Data" });
}
public override Task<ResponseInitChain> InitChain(RequestInitChain request, ServerCallContext context)
{
// Fake result
return Task.FromResult(new ResponseInitChain() { });
}
public override Task<ResponseEcho> Echo(RequestEcho request, ServerCallContext context)
{
// Some echo info
var echo = new ResponseEcho { Message = $"Validator is Running: {DateTime.Now:dd-MM-yyyy HH:mm}" };
return Task.FromResult(echo);
}
}
Testing the server
If you added the Grpc.Tools package, you can simply use a generic client, e.g grpcui like this
grpcui -insecure 127.0.0.1:5001
Or you can install a local version of Tendermint as described here, initialize the node properly and then start tendermint like this:
tendermint node --abci grpc --proxy_app 127.0.0.1:5001
Note that .NET 6.0 by default publishes the gRPC endpoints on port 5000 (http) and 5001 (https). If you use different ports change the command accordingly. In my tests, Tendermint was not able to do TLS handshakes with a .NET core HTTPS endpoint properly. This means that you have to restrict Kestrel to Http2 only connections. I managed to establish a connection between Tendermint and the C# app using the following Kestrel configuration.
{
"AllowedHosts": "*",
"Kestrel": {
"Endpoints": {
"gRPC": {
"Protocols": "Http2",
"Url": "http://127.0.0.1:5000"
}
}
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net6.0
- Google.Protobuf (>= 3.26.0)
- Grpc.Core.Api (>= 2.61.0)
-
net7.0
- Google.Protobuf (>= 3.26.0)
- Grpc.Core.Api (>= 2.61.0)
-
net8.0
- Google.Protobuf (>= 3.26.0)
- Grpc.Core.Api (>= 2.61.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.