-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatic withdrawals #14
Comments
Note that I'm willing to help with implementation of this spec in BLW, server-side, and possibly other wallets. I have practically zero experience with mobile apps, but I'm willing to learn. |
I think the "automatic" part of this protocol is too convoluted to be included in the lnurl spec -- it should rather be tried first on a wallet and service and then have its own "super spec" that uses lnurl-withdraw and lnurl-channel at its base. However I've recently realized that the part about doing withdrawals either through normal lightning transactions or turbo-channels is doable with the current lnurl spec and works on BLW today: the service can just have an lnurl for each user/event and decide at the time the wallet scans the QR if it will return a "channel" or a "withdraw" response. |
Fair, as I said, I'm willing to code it. Very busy right now, maybe during the Christmas. @btcontract would you be willing to assist me in making appropriate changes to BLW? In case you don't feel like coding it, just point me at what you consider the best resource for learning enough Scala and whatever libs/frameworks you use to be able to do it myself. Regarding what's possible today, how exactly would a server know beforehand whether there exists a route to the wallet? It doesn't send forwarding hints in the first request. |
Why was this closed, please? |
I just thought this had been long forgotten by everybody and was cleaning up some things in the repo. |
It was not forgotten by me but perhaps other developers didn't find the use cases convincing even when backed by actual experience of hundreds of people. As I said, I would be willing to help with it if anyone is interested. |
Summary
I propose to specify a new protocol for automated user-friendly withdrawals. It's a smarter way to implement invoice-less sending.
Motivation
It often occurs that some kind of automated system of the payer can determine the obligation to pay. Examples include: ATMs (based on user inserting money), exchanges (based on automatic buys facilitating DCA), payroll software...
Currently the process is as follows:
This process has several serious drawbacks:
As a solution I propose a new sub protocol to LNURL.
All this is based on real-life experience with various LN services, first-hand experience with customers and baristas in Paralelna Polis and discussion with Karel Kyovsky, CEO of General Bytes - Bitcoin ATM manufacturer.
Design goals
Disclaimer
I've read the documentation of Firebase and don't have a personal experience with it. It may happen that this specification is lacking something to actually allow push notifications.
Specification
The response message from the server is:
The wallet proceeds by subscribing to websocket or fcm providing
?k1=SECRET
. In case of fcm, it provides full json that should be sent to the server in the body usingPOST
method. The application may re-subscribe byPOST
ing again, which causes the json to be replaced by a new version. The server treats it as opaque data and just re-sends it when the user should be notified. The wallet can unsubscribe usingDELETE
method.Websocket notifies the application by sending the same message that would be a reply of callback with
action=poll
(see bellow)The callback has required parameters
k1=SECRET&action=ACTION
Action may be:
reject
- the wallet identified that the capabilities aren't appropriate and signals this to the serverpoll
- this should only be called after receiving a notification from FCM, not periodically, the server responds with message described bellowinvoice
with additionalpr=INVOICE
parameter - requests withdraw, server responds with{ "status": "OK" }
or{ "status": "ERROR", "reason": "..." }
just like in case oflnurl-withdraw
channel
- withremoteid=<local LN ID>&private=<1 or 0>
parameters - request channel open like in case oflnurl-channel
, the server replies with{ "status": "OK" }
or{"status" : "ERROR", "reason": "..." }
Response to poll:
The flow
singleUse
istrue
, the wallet discardsk1
and other metadata after successful withdrawal. In case it's false, it keeps it stored and continues listening for notificationsHow does this solve the situation above
allowPartial
to false avoids refunding/accounting hell (as explained by Karel; big turbo channel is more practical anyway; splicing might be added in the future to avoid multiple channels)The text was updated successfully, but these errors were encountered: