rgb-cln/cln-grpc
Christian Decker 00ffb39ed6 rs: Guard the cln-rpc dependency behind "server" feature in cln-grpc
The `cln-grpc` crate really has a dual purpose: server and
client. Having the server feature be included by default means that we
are pulling in `cln-rpc` which is a Unix only crate, because of the
use of UDS to talk to CLN. We want to use `cln-grpc` on clients too,
and those might not be Unix variants, hence they'd fail when compiling
`cln-rpc`. This PR guards the Unix-related parts behind the `server`
feature flag.
2023-06-01 13:41:21 +09:30
..
proto common: add new internal type for websockets. 2023-06-01 09:28:39 +09:30
src rs: Guard the cln-rpc dependency behind "server" feature in cln-grpc 2023-06-01 13:41:21 +09:30
Cargo.toml rs: Guard the cln-rpc dependency behind "server" feature in cln-grpc 2023-06-01 13:41:21 +09:30
Makefile cln-grpc: Generate server dispatcher 2022-02-28 23:25:37 +00:00
README.md Update README.md 2022-07-03 12:41:07 +02:00
build.rs grpc: Add the experimental optional flag to protoc 2022-11-18 15:10:32 +01:00

README.md

cln-grpc - Secure Networked RPC Interface

This plugin provides a standardized API that apps, plugins, and other tools could use to interact with Core Lightning. We always had a JSON-RPC, with a very exhaustive API, but it was exposed only locally over a Unix-domain socket. Some plugins chose to re-expose the API over a variety of protocols, ranging from REST to gRPC, but it was additional work to install them.

So with v0.11.0, we released a new interface: cln-grpc, a Rust-based plugin that exposes the existing interface over the network in a secure manner. The gRPC API is automatically generated from our existing JSON-RPC API, so it has the same low-level and high-level access that app devs are accustomed to but uses a more efficient binary encoding where possible and is secured via mutual TLS authentication.

To use it, just add the --grpc-port option, and itll automatically start alongside Core Lightning and generate the appropriate mTLS certificates. To use the gRPC interface, copy the client key and certificate, generate your client bindings from the protobuf definition and connect to the port you specified earlier.

While all previous built-in plugins were written in C, the cln-grpc plugin is written in Rust, a language that will be much more prominent in the project going forward. In order to kick off the use of Rust, we also built a number of crates:

  • cln-rpc: native bindings to the JSON-RPC interface, used for things running on the same system as CLN.
  • cln-plugin: a library that facilitates the creation of plugins in Rust, with async/await support, for low-footprint plugins.
  • cln-grpc: of course, the library used to create the gRPC plugin can also be used directly as a client library.

All of these crates are published on crates.io and will be maintained as part of the project moving forward.