powered by rust-lightning
NOTE: this is still work in progress alpha-version, I'm planning to release the first beta when I get sure that on/off-chain recovery works fine and test coverage is good enough. Until then, I do not asssure anything about security.
- Security focused
- No dependencies besides Microsoft OSS (e.g. AspNetCore) and Nicolas Dorier's work (e.g. NBitcoin)
- Extensive tests, including integration tests against other LN node implementation.
- encrypt node master secret by user-provided password (pin) before storing it to the disk.
- Static channel backup
- whenever node shuts down, it saves current state under data directory (which is configurable with
--datadir
option) And reads the data of all channels and comes back to original state. It may or may not close the channel depending on what happened on-chain after shutting down.
- whenever node shuts down, it saves current state under data directory (which is configurable with
- Fully configurable
- You can configure every settings for rust-lightning configuration as an CLI option or Environment variable.
- For other configuration options, please can check the help message.
- Loosely coupled architecture.
- You can install part of the package if you want to build your own LN wallet
Basically all you need to compile the server is
- Latest Version of DotNet SDK
- nightly version of the Cargo
check out the Dockerfile for the detail
from low level to high level...
src/NRustLightning
- library to interoperate with rust-lightning through abi.
src/NRustLightning.Net
- library to connect above package to the transport layer. primarily through TCP socket.
- Probably this is the one you want to use if you are considering to build your own wallet.
src/NRustLightning.Infrastructure
- library which contains logic for both server and client.
src/NRustLightning.Server
- standalone LN daemon built with asp.net core server.
src/NRustLightning.Client
- C# client library for the server.
src/NRustLightning.CLI
- command-line application to work with the server. Which wraps the client.
- This is still pretty much WIP
NRustLightning.Server
takes configuration options by either
- cli argument (e.g.
--https.port=443
) - Environment variable (e.g.
NRUSTLIGHTNING_HTTPS_PORT=443
) - configuration ini file (WIP)
You can check all configuration options by running the following command.
git clone --recursive <this repository url>
dotnet run --project src/NRustLightning.Server -- --help
NRustLightning depends on nbxplorer.
You must make sure to connect to your nbxplorer instance. You can use options
starts from nbx
.
Your nbxplorer instance must set EXPOSERPC
option to true. usually this can be done by setting environment variable NBXPLORER_EXPOSERPC
to 1
.
Be aware that this option is not allowed in an old version of nbxplorer, it will return 404 error and crashes.
If you don't have any, you can try with regtest in docker-compose. See below.
NRustLightning runs only in https by default. So you must prepare certificate before you start and pass with
--https.cert
, --https.certpass
options.
If you don't want to bother preparing your own certificate, then pass --nohttps
option. This will
make NRustLighting run only in http
See here for the swagger documentation for the server API
You can check the document in local if you are running in debug build. If you want to check it out quickly, first run regtest server by
source tests/NRustLightning.Server.Tests/env.sh
docker-compose -f tests/NRustLightning.Server.Tests/docker-compose.yml up
and access to http://localhost:10320/swagger/
NRustLightning.CLI
and NRustLightning.Server
supports single file executable.
Run
dotnet publish -c Release -r <your RID>
for which RID to use, see microsoft official
For command line parsing, it uses System.CommandLine.
If you think parsing is not working as expected, Directives in System.CommandLine
might be useful. for ecample invoking with '[parse]' directive will be like...
cd src/NRustLightning.Server
dotnet run -- '[parse]' --regtest <whatever-options-you-want-to-pass>
From low level to high level ...
NRustLightning.Tests.Common
- Common classes which used in more than two test packages.
NRustLightning.Tests
- basic tests for ABI.
NRustLightning.Net.Tests
- Tests which simulates P2P Network in memory. This cannot test the behavior with other lightning implementation.
NRustLightning.Server.Tests
- integration tests for the server and the client. See its own README.md for the detail.
source tests/NRustLightning.Server.Tests/env.sh
docker-compose -f tests/NRustLightning.Server.Tests/docker-compose.yml up
./tests/NRustLightning.Server.Tests/docker-lnd-cli.sh