lnbits icon indicating copy to clipboard operation
lnbits copied to clipboard

Extension proposal: connect wallet via lndconnect

Open enorrmann opened this issue 5 years ago • 16 comments

Would it be possible to create an extension for connecting via https://github.com/LN-Zap/lndconnect/blob/master/lnd_connect_uri.md urls ? The purpose of this would be to have "instawallets" connecting from wallets like Zap.

enorrmann avatar Sep 14 '20 11:09 enorrmann

LNbits can connect to a number of funding sources, one of them being LND already https://github.com/lnbits/lnbits/blob/1e2dd412c7b7536fb845478f7907d4ce4af74e87/.env.example#L28

arcbtc avatar Sep 14 '20 18:09 arcbtc

I understand that, but I want to connect zap wallet (or grpc clients) to lnbits, does that make sense ?

enorrmann avatar Sep 14 '20 18:09 enorrmann

One of my fav development environments is connecting to the neutrino LND behind Zap in fact. Tom liked that idea so much he made a guide https://docs.zaphq.io/docs-desktop-neutrino-connect Just put the details in env.example

arcbtc avatar Sep 14 '20 18:09 arcbtc

again.. I don't want to connect lnbits to a running instance of LND or zap .. I want to make an instant custodial wallet accessible via zap Think of it as "multiplexing" lnd to serve several Zap clients

enorrmann avatar Sep 14 '20 18:09 enorrmann

Ah, so like fiatjafs lndhub extension? https://github.com/lnbits/lnbits/pull/78 but for Zap

arcbtc avatar Sep 14 '20 18:09 arcbtc

kind of, yeah .. but via gRpc, that is the protocol Zap uses to communicate I was thinking this would be possible by implementing https://github.com/lightningnetwork/lnd/blob/master/lnrpc/rpc.proto and adding the "several wallets" functionality to it, so several grpc clients could connect to a single node. The other way to achieve this would be to implement "accounts" into LND code itself, but I think this way is easier. I think this opens for new interesting cases, like connecting grpc only clients (like Zap), to several kinds of "backends" .. like opennode etc etc ... What do you think ?

enorrmann avatar Sep 14 '20 18:09 enorrmann

Sounds cool. LNbits is a middle-man, so makes sense, and I do like the idea of accessing my lntxbot account via Zap I wont be able to take a look at it for a while, but hopefully someone will pick it up. I'm sure the lndhub version will be very popular You should make it, are you on our telegram? https://t.me/lnbits

arcbtc avatar Sep 14 '20 18:09 arcbtc

great ! I will try to start this .. somewhere ! see you in tgram

enorrmann avatar Sep 14 '20 19:09 enorrmann

https://github.com/LN-Zap/zap-android/issues/157 Related

enorrmann avatar Sep 15 '20 12:09 enorrmann

So, I started working on a gRpc implementation of LND's api here https://github.com/enorrmann/lnd_grpc the main code is in server.py, and if I start it I can connect via Zap or even lncli getinfo ! but ! I'm having trouble moving this to a lnbits extension, mainly because I have no experience with python modules, and I can't get it working right. Also, the project runs as a gRpc server on port 10009 (default for zap and lncli)... I'm not sure if I can start another server along lnbits main process to attend this requests. Any help will be appreciated !

enorrmann avatar Sep 16 '20 15:09 enorrmann

so, I have a grpc server running inside lnbits, but I need to access the wallet and other info from the context https://github.com/enorrmann/lnbits/tree/master/lnbits/extensions/zap I need to "inject" them in LNBitsLightningServicer.py is that possible ?

enorrmann avatar Sep 17 '20 19:09 enorrmann

My guess is that you need to do everything inside a request_context. I'm not sure how to do it on Flask, but here are the docs for Quart (which is soon to be merged): https://pgjones.gitlab.io/quart/reference/source/quart.html#quart.Quart.request_context

fiatjaf avatar Sep 18 '20 01:09 fiatjaf

I don't think I'll be able to access that context from my grpc server because ... well it is another server running inside flask, so, the requests are not the same. In addition flask / Quart are serving REST, while I'm serving grpc.. so the only way I can think of making this work would be to make a new request (to localhost) via the lndhub extension. And the zap extension (grpc extension in fact) would act as a translator from grpc to Lndhub protocol ... it seems cumbersome and hatd to explain but .. once I have a minimum viable extension we will see !

enorrmann avatar Sep 18 '20 17:09 enorrmann

it's working ! lots of improvements to do but I'm happy to inform that a viable extension is almost done ! https://github.com/enorrmann/lnbits/tree/master/lnbits/extensions/zap for now, it requires tls cert and key files in the root folder of lnbits (example files provided) and it runs by default on port 10009 (lnd grpc default), so you can't use it with grpc backend (for now) also, If you installed lnd-grpc dependency, it will conflict with my code and won't compile lot's of improvements to do ! but it works

enorrmann avatar Sep 23 '20 19:09 enorrmann

@enorrmann Any updates on it or alternatives?

bezysoftware avatar Oct 05 '21 13:10 bezysoftware

@enorrmann Any updates on it or alternatives?

abandoned this because of the lack of interest :( edit: but if you have a use case I can gladly revive it !

enorrmann avatar Oct 28 '21 16:10 enorrmann

@enorrmann closing this as it's abandoned!

talvasconcelos avatar Oct 28 '22 10:10 talvasconcelos