lspd simple server
lspd is a simple deamon that provides LSP services to Breez clients.
This is a simple example of an lspd that works with an lnd node.
Installation
- git clone https://github.com/breez/lspd (or fork)
- Compile lspd using
go build .
- Create a random token (for instance using the command
openssl rand -base64 48
) - Define the environment variables as described in sample.env. If
CERTMAGIC_DOMAIN
is defined, certificate for this domain is automatically obtained and renewed from Let's Encrypt. In this case, the port needs to be 443. IfCERTMAGIC_DOMAIN
is not defined, lspd needs to run behind a reverse proxy like treafik or nginx. - Run lspd
- Share with Breez the TOKEN and the LISTEN_ADDRESS you've defined (send to [email protected])
Implement your own lspd
You can create your own lsdp by implementing the grpc methods described here.
Use a smaller channel reserve
You can apply the PR from lightningnetwork/lnd#2708 to be able to create channels with a channel reserve smaller than 1% of the channel capacity.
Then add the field RemoteChanReserveSat
in the lnrpc.OpenChannelRequest
struct when opening a channel.
In order to be able to let clients have a zero channel reserve, you can apply the commit from https://github.com/breez/lnd/commit/03a7a0b6b4c8fa92ad94e9f449135e0738702643
Flow for creating channels
When Alice wants Bob to pay her an amount and Alice doesn't have a channel with sufficient capacity, she calls the lspd function RegisterPayment() and sending the paymentHash, paymentSecret (for mpp payments), destination (Alice pubkey), and two amounts. The first amount (incoming from the lsp point of view) is the amount BOB will pay. The second amount (outgoing from the lsp point of view) is the amount Alice will receive. The difference between these two amounts is the fees for the lsp. In order to open the channel on the fly, the lsp is connecting to lnd using the interceptor api.
Probing support
The lsp supports probing non-mpp payments if the payment hash for probing is sha256('probing-01:' || payment_hash) when payment_hash is the hash of the real payment.