pull down to refresh
0 sats \ 4 replies \ @thebullishbitcoiner OP 19 Oct \ parent \ on: Lightning Welder helps legacy lightning wallets pay BOLT12 offers lightning
Thanks Super! Do you have any documentation on how to get the server up and running?
There is a seven step procedure to run the backend and connect it to the frontend, so I will go over them here
First step
The first step is something I have to say after the second step
Second step
The second step is to install LNDK according to the instructions on this page: https://github.com/lndk-org/lndk
But notice that the page tells you that first you "need a LND node running at least LND v0.18.0...with the peersrpc, signerrpc, and walletrpc sub-servers enabled"
First step again
So that's the real first step: compile LND with those sub-servers enabled by following the guide they link to
Note on the first two steps
Don't run LND and LNDK as two different linux users like a "good" programmer would do. To control LNDK I opted not to use its api, because I was running out of time, so instead I use the
exec
command to spin up a terminal inside nodejs and interact with it via stdin and stdout. And for one specific LND command ("trackpayment") the LND API wouldn't work for me (I was probably using it wrong) so I use exec
for that too. Which means you must run the server, LND, and LNDK all on the same linux user -- if you separate them, the terminal won't have the lndk-cli
and lncli
commands available, so the program will fail.Third step
To run the server, first clone the github and run
npm init -y
.Fourth step
Then install the dependencies:
npm i crypto noble-secp256k1 ws browserify-cipher request
Also, modify the first few lines of the server.js file so that they contain your LND node's invoice macaroon, admin macaroon (both in hexadecimal format), your LND Rest api endpoint (this is usually https://127.0.0.1:8080), and you can ignore the other four fields -- I intended to use them to let users modify their fee settings and a few other things, but I don't actually use them anywhere in the code, the fees are just hard coded to 10 sats.
Fifth step
Then run
node server.js
It should spit out a nostr public key and then wait for incoming messages
We opted to use nostr for communication between the frontend and the backend so that anyone can run this without needing to expose ports
We intended to make it so that people running the backend would announce themselves on nostr, as well as a fee structure (e.g. do they charge a flat fee for forwarding bolt11 payments to a bolt12? A percentage fee? How much?) and the frontend would listen for those announcements and display them to the user. But we ran out of time so we hard coded the nostr pubkey of my backend into the frontend, which is why it stopped working when I turned off my laptop.
Sixth step
To make sure your service is working, edit the index.html file in my github repo and find the line `welder = "<nostr_pubkey>" and change it to yours. Then open up the index.html file, open up its browser console, enter a bolt12 invoice into the form, and hit enter. You should see a message pop up in your nodejs terminal and you should see the frontend and backend interact. Watch the browser console -- eventually you should see a bolt11 invoice in there. (I don't "pop it up" on the page, it only appears in the console.)
Note about the sixth step
As @justin_shocknet has always warned, I have found that the onion messaging aspect of bolt12 is very unreliable. About 2/3 of the time, the server will use the lightning network's onion messaging transport layer to reach out to whatever node issued the bolt12 and something goes wrong: the message does not reach the destination or the reply does not reach my node.
Consequently, most of the time, the service does not work. I find that if, after hitting the "Submit" button on the form, you don't see a bolt11 in your browser console after about 10 seconds, try hitting submit again; and occasionally try restarting all four services: LND, LNDK, and the nodejs file, and the web browser (after entering in your "new" nostr pubkey -- the nodejs service doesn't save it so a new pubkey is created every time you restart the nodejs service).
Eventually it should work and you should see a bolt11 invoice in your browser console.
Seventh step
Pay the bolt11 invoice and you should see a corresponding payment show up in your bolt12-supporting wallet.
Note about the seventh step
I've only tested this with phoenix wallet so it might not work with other wallets. Also, my frontend hard-codes an invoice of 15 sats, and since the server charges a 10 sat flat fee, the bolt11 will be for 25 sats. So don't be surprised when your phoenixd only receives 15 sats even though you paid 25.
reply
the onion messaging aspect of bolt12 is very unreliable
And be it known that whenever I vociferously FUD stuff I always present a solution: #679977
reply