Crates.io | lndk |
lib.rs | lndk |
version | 0.0.1 |
source | src |
created_at | 2024-04-19 16:12:24.987624 |
updated_at | 2024-04-19 16:12:24.987624 |
description | A standalone daemon that aims to externally implement BOLT 12 functionality for LND using LDK |
homepage | |
repository | https://github.com/lndk-org/lndk |
max_upload_size | |
id | 1213872 |
size | 728,643 |
LNDK is a standalone daemon that connects to LND (via its grpc API) that aims to implement bolt 12 functionality externally to LND. LNDK leverages the lightning development kit to provide functionality, acting as a thin "shim" between LND's APIs and LDK's lightning library.
Project Milestones:
Please note that this project is still experimental.
To run LNDK
, LND
is assumed to be running. You'll need to make some adjustments when compiling and running LND
to make it compatible with LNDK
.
First, you'll need to run a particular branch of LND
to allow the advertising of onion_message feature bits. To do so, follow these steps:
git clone https://github.com/lightningnetwork/lnd
cd lnd
git checkout v0.16.2-patch-customfeatures
While on this branch, compile LND
. Make sure that the peersrpc and signerrpc services and dev tag are enabled, like this:
make install --tags="peersrpc signerrpc dev"
Note that this guide assumes some familiarity with setting up LND
. If you're looking to get up to speed, try this guide.
Once you're ready to run LND
, the binary must be run with --protocol.custom-message=513
to allow it to report onion messages to LNDK
as well as --protocol.custom-nodeann=39
--protocol.custom-init=39
for advertising the onion message feature bits.
There are two ways you can do this:
LND
when running it:lnd --protocol.custom-message=513 --protocol.custom-nodeann=39 --protocol.custom-init=39
lnd.conf
:[protocol]
protocol.custom-message=513
protocol.custom-nodeann=39
protocol.custom-init=39
Now we need to set up LNDK. To start:
git clone https://github.com/lndk-org/lndk
cd lndk
In order for LNDK
successfully connect to LND
, we need to pass in the grpc address and authentication credentials. There are two ways to do this:
LNDK
program, like this:cargo run -- --address=<ADDRESS> --cert=<TLSPATH> --macaroon=<MACAROONPATH>
Or in a more concrete example:
cargo run -- --address=https://localhost:10009 --cert=/home/<USERNAME>/.lnd/tls.cert --macaroon=/home/<USERNAME>/.lnd/data/chain/bitcoin/regtest/admin.macaroon
Remember that the grpc address must start with https:// for the program to work.
lndk.conf
.address="<ADDRESS"
cert="<TLSPATH>"
macaroon="<MACAROONPATH>"
cargo run -- --conf lndk.conf
Rather than use the admin.macaroon with unrestricted permission to an LND
node, we can bake a macaroon using lncli with much more specific permissions for better security. With this command, generate a macaroon which will give LNDK
only the specific grpc endpoints it's designed to hit:
lncli --save_to=<FILEPATH>/lndk.macaroon uri:/lnrpc.Lightning/GetInfo uri:/lnrpc.Lightning/ListPeers uri:/lnrpc.Lightning/SubscribePeerEvents uri:/lnrpc.Lightning/SendCustomMessage uri:/lnrpc.Lightning/SubscribeCustomMessages uri:/peersrpc.Peers/UpdateNodeAnnouncement uri:/signrpc.Signer/DeriveSharedKey
NOTE: It is recommended to always use cargo-crev to verify the trustworthiness of each of your dependencies, including this one.