In this workshop we will discuss the evolution of the Lightning Network (LN) development ecosystem - from the recent reckless past to the (hopefully) more secure and stable future. We will demonstrate how to achieve a development environment that is reproducible, testable, portable, and reliable.
As a practical example, we have decided to create a simple Lightning Service Provider implementation, loosely following the LSP Specification. As a proof-of-concept, we start with the LSPS1 channel opening request. Additional services to be implemented could include LSPS2 JIT (Just-In-Time) channel openings (a.k.a. turbo channels), and submarine swap-in/out as implemented by the Boltz exchange.
The LSP server implementation is written in nodejs and acts as a JSON-RPC over HTTP API. The mocha automated test framework is used to define our tests. The scaling-lightning CLI tool is used to create and destroy local Bitcoin and LN nodes as well as perform a few administrative commands. Mocks can be quick and easy for unit testing but in this workshop we wanted to demonstrate how to test software with actual LN nodes.
To achieve professional development efficiently and effectively, several key objectives need to be met:
The following diagram illustrates the architecture of the scaling-lightning project - see its documentation for more details:
Be sure that you have all requirements before continuing.
Install project dependencies locally:
npm ci
Start your local Kubernetes cluster with minikube:
minikube start
Check that the file ~/.kube/config
exists and that your current user has permissions to read it:
cat ~/.kube/config > /dev/null
Check that kubectl is able to communicate with the Kubernetes cluster:
kubectl -n simple-network get pods
Run the minikube tunnel so that traefik can connect to the load balancer services:
minikube tunnel
More information can be found here and here.
Be sure the scaling-lightning binary is available on your current user's PATH:
scaling-lightning --version
Create a local lightning network:
scaling-lightning create -f ./test/fixtures/helmfiles/simple-network.yaml
Use --debug
argument to output log messages for any scaling-lightning commands.
To run the automated test suite:
npm test
Run with debug output:
DEBUG=workshop:* npm test
To run the tests without the network setup/teardown:
WORKSHOP_TEST_SKIP_NETWORK_SETUP=1 npm test
With debug output:
DEBUG=workshop:* WORKSHOP_TEST_SKIP_NETWORK_SETUP=1 npm test