Remote control of Core Lightning Nodes in 2023

LIVE #16October 26, 2023

In this live we present the existing methods to remotly control CLN nodes and we showcase some applications/libraries built on top of Core Lightning and the methods they use to remotly control CLN nodes.

Remote control of CLN nodes in 1 table

| library/plugin/service | how           | RPC methods   | authentication / authorization | notes            |
|------------------------+---------------+---------------+--------------------------------+------------------|
| commando               | commando msg  | all           | Rune + node id                 | need BOLT #8     |
|------------------------+---------------+---------------+--------------------------------+------------------|
| lnsocket               | commando msg  | all           | Rune + node id                 | need BOLT #8     |
|                        |               |               |                                | + maybe proxy or |
|                        |               |               |                                | TLS certificate  |
|                        |               |               |                                | for websocket    |
|------------------------+---------------+---------------+--------------------------------+------------------|
| lnmessage              | commando msg  | all           | Rune + node id                 | need BOLT #8     |
|                        |               |               |                                | + maybe proxy or |
|                        |               |               |                                | TLS certificate  |
|                        |               |               |                                | for websocket    |
|------------------------+---------------+---------------+--------------------------------+------------------|
| clnrest                | HTTP requests | all           | Rune                           |                  |
|------------------------+---------------+---------------+--------------------------------+------------------|
| c-lightning-REST       | HTTP requests | all           | macaroon                       |                  |
|------------------------+---------------+---------------+--------------------------------+------------------|
| sparko                 | HTTP requests | all           | ??                             |                  |
|------------------------+---------------+---------------+--------------------------------+------------------|
| cln-grpc               | gRPC          | only those    | mTLS certificates              | not in browsers  |
|                        |               | in node.proto |                                |                  |
|                        |               | file          |                                |                  |
|------------------------+---------------+---------------+--------------------------------+------------------|
| Greenlight             | ??            | only those    | mTLS certificates              | LaaS + VLS       |
|                        |               | in node.proto |                                |                  |
|                        |               | file          |                                |                  |

Commando plugin

commando: Commando is a direct-to-node plugin that ships natively with Core Lightning. It lets you set runes to create fine-grained access controls to a CLN node's RPC, and provides access to those same RPCs via Lightning-native network connections.

CLN nodes

CLN nodes can receive and send commando messages.

lnsocket

jb55/lnsocket: A minimal C & js library for sending messages to lightning nodes.

websocket proxy

Apps using lnsocket

lnmessage

websocket proxy

  • clams-tech/ln-ws-proxy: A simple WebSocket server to proxy lnsocket frames to Core Lightning nodes over the Lightning Network

Apps using lnmessage

HTTP requests

clnrest

clnrest: CLNRest is a lightweight Python-based core lightning plugin that transforms RPC calls into a REST service.

c-lightning-REST

Ride-The-Lightning/c-lightning-REST: REST APIs for Core Lightning written with node.js.

Apps using c-lightning-REST:

sparko

fiatjaf/sparko: c-lightning RPC over HTTP with fine-grained permissions, SSE and spark-wallet support

Apps using sparko:

  • shesek/spark-wallet: A minimalistic wallet GUI for c-lightning, accessible over the web or through mobile and desktop apps.

  • ZeusLN/zeus: A mobile Bitcoin wallet fit for the gods.

remoteRPC

rsbondi/clightning-go-plugin: remoteRPC is plugin that allows you to access all RPC commands using HTTP instead of the default of unix socket

App using remoteRPC:

others

CLN notifications

| library/plugin     | how                     | authentication / authorization |
|--------------------+-------------------------+--------------------------------|
| clnrest            | websocket               | Rune                           |
|--------------------+-------------------------+--------------------------------|
| c-lightning-events | websocket               | ??                             |
|--------------------+-------------------------+--------------------------------|
| sparko             | Server-Sent Event (SSE) | ??                             |
|--------------------+-------------------------+--------------------------------|
| lightningd-webhook | webhook                 | ??                             |
  • clnrest: CLNRest is a lightweight Python-based core lightning plugin that transforms RPC calls into a REST service.

  • rbndg/c-lightning-events: Subscribe to C-Lightning events with websocket.

  • fiatjaf/sparko: c-lightning RPC over HTTP with fine-grained permissions, SSE and spark-wallet support.

  • fiatjaf/lightningd-webhook: A lightningd plugin that emits webhooks for each notification events.

gRPC

CLN gRPC APIs: 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.

Apps using CLN gRPC APIs or bindings:

Greenlight / LaaS

Greenlight is a Blockstream service offering hosted, non-custodial, Lightning Network nodes to developers and end-users. We take care of the infrastructure, while you are in control of the keys.

  • Greenlight: Your personal Core Lightning node, without the technical fuss.

  • Greenlight Documentation: Greenlight is a Blockstream service offering hosted, non-custodial, Lightning Network nodes to developers and end-users. We take care of the infrastructure, while you are in control of the keys.

  • Blockstream/greenlight: This repository contains everything to get you started with Blockstream Greenlight, your self-sovereign Lightning node in the cloud.

  • breez/breez-sdk: The Breez SDK enables mobile developers to integrate Lightning and bitcoin payments into their apps with a very shallow learning curve. [...] Crucially, this SDK is an end-to-end, non-custodial, drop-in solution powered by Greenlight, a built-in LSP, on-chain interoperability, third-party fiat on-ramps, and other services users and operators need.

  • Validating Lightning Signer (VLS): Improve your Lightning node security by protecting your keys separately.

graphql

Articles / Links

Videos / Podcasts

lnsocket

lnmessage

  • Diving Into The World Of clams.tech: Clams is a browser UI for your Core Lightning node. Walk through how to connect a regtest node, see some of the current features, and learn what's on the roadmap, and get an explanation of how a secure connection is made to a node with lnmessage.

  • Running a CLN Node on Umbrel

  • First Look: The CLN Umbrel App!: Get a first look at the upcoming Core Lightning Umbrel app 🔥 Follow along as Blockstream Frontend Engineer Shahana Farooqi and Head of Design Basak Haznedaroglu go through the Umbrel OS, project architecture, UX/UI, security features, application features, lnmessage, commando & runes!

gRPC

c-lightning-REST

Greenlight

LNROOM

  • Introduction to commando and commando-rune: In this live we see how to create runes (restrictions tokens) with commando-rune command and how to use them with commando command in order to run authorized (by the rune) methods on a directly-connected peer. Then we write a nodejs cli app which runs the getinfo method on a directly-connected peer using lnmessage library. Finally, we write a nodejs cli app which creates invoices by running the invoice method on a directly-connected peer using lnmessage library. This gives use the opportunity to see how to add restrictions to runes.

  • Simple CLN bookkeeper web app powered by lnsocket & Golang - part 1: In this live we build a simple CLN bookkeeper web app which exposes the data we get from the commands bkpr-listbalances and bkpr-listincome. We write it in Go using lnsocket library. All of this is made possible thanks to commando and bookkeeper plugins. We finish building this app in the episode #20 of LNROOM.

  • Overview of lnmessage implementation: In this live we look at the implementation of lnmessage JS library that let us send commando messages to a CLN node. Specifically, we look at LnMessage.commando and NoiseState.encryptMessage methods. This give us the opportunity to talk about BOLT #8 and BOLT #1.

  • Create invoices with a Node.JS cli using lnmessage and commando: In this video we write a Node.JS cli application that generates invoices by sending commando messages to a CLN node using lnmessage library.

  • Getting started with CLNRest plugin: In this live we see how to start and use the new builtin plugin CLNRest that transforms RPC calls into a REST service. We learn how to use the Swagger interface to generate/send http requests. Then we connect to the websocket offered by CLNRest that sends lightningd notification. Finally, we take a look at CLNRest implementation to show how plugin developers can take advantage of the new JSON RPC method checkrune.

  • Learn how to test libraries/apps that interact with CLN nodes: In this live we see how how to test lnsocket/go library using pyln-testing library.

  • Get started with cln-grpc plugin: In this live we continue our tour about Core Lightning remote control with the builtin plugin cln-grpc. We write a Python application which generates invoices on our CLN node using the gRPC protocol.