Skip to content
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

LNURL-withdrawPOS flow #16

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions blip-0015.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
```
bLIP: 15
Title: LNURL-witdhrawPOS flow
Status: Active
Author: David Coen <[email protected]>
Created: 2022-05-23
License: CC0
```

## Abstract

LNURL-withdraw is a bech32-encoded HTTPS query string or sub-protocol of LNURL
which gives the users the ability to receive funds via Lightning Network without the need of manually create an invoice.
Users scan a QRcode or paste the LNURL-withdraw link into their wallet,
this queries a server and gets a JSON with some info,
such as the max amount the user can receive, the min amount the user can request, etc.
Then the wallet tipically asks the user to enter an amount and under the hood it creates a Lightning invoice and sends it to the service provider,
theDavidCoen marked this conversation as resolved.
Show resolved Hide resolved
which eventually pays that.
So the only things the users have to do are:
theDavidCoen marked this conversation as resolved.
Show resolved Hide resolved

1. Scan the QR code / paste the LNURL-withdraw link into the wallet
2. Enter the amount to receive
3. Confirm

In this repo I schematize a LNURL-withdraw flow for POS,
theDavidCoen marked this conversation as resolved.
Show resolved Hide resolved
which sees the interaction between the user and a POS equipped with a NFC sensor.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NFC in this case seems more like an example transport rather than an explicit limitation.


This bLIP serves to document what could be a reference flow for open source implementations of POS devices able to read LNURL-withdraw links via NFC,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This bLIP serves to document what could be a reference flow for open source implementations of POS devices able to read LNURL-withdraw links via NFC,
This bLIP serves to documents the flow for open source implementations of POS devices able to read LNURL-withdraw links via NFC,

Again, NFC seems more like a detail here, artificially limiting the applicability (links, QR codes, etc are just as valid as transports).

for a better UX in Lightning payments powered by LNURL protocol.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better as compared to what?


## Copyright

This bLIP is licensed under the CC0 license.

## Specification

This flowchart shows the entire flow which combines the already well-known LNURL-withdraw sub-protocol with NFC-enabled POS.

![LNURL-withdraw POS flowchart](https://raw.githubusercontent.com/theDavidCoen/blips/master/blip-0015/lnurl-withdrawPOS%20flowchart.jpg)

The main actor of the flow here is the merchant/payee, not the payer:
the merchant/payee has to simply enter an amount on the POS and this will active the NFC sensor,
waiting to receive the LNURL-withdraw link. The payer has to transmit the LNURL-withdrawPOS link via NFC
and doesn't need to confirm the payment on the wallet.

## Motivation

Payees that support this open flow help improving the UX of Lightning payments:
a user can just pay with a NFC tag in which a LNURL-withdraw link has been stored, instead of asking the payee to create an Invoice and scanning the QRcode.

With this flow the users can also make "offline" payments and this completely change the UX of a Lightning payment:
they could reserve a part of their funds on a LN wallet for "offline" payments in a LNURL-withdraw string,
so they can use it offline, for example when they are abroad and don't have a stable connection or have roaming issues.
They could also define sub-balances in their wallet, so once the reserved funds are ended, no other funds in their wallet is touched.

![LNURL-withdraw POS offline payments](https://raw.githubusercontent.com/theDavidCoen/blips/master/blip-0015/offline%20payments%20LNURL-withdrawPOS.png)

## Rationale

There are security concerns in regards to LNURL-withdraw links used as prepaid Lightning cards, which are expressed [here](https://github.com/theDavidCoen/LNURL-withdrawPOS#security-concerns-in-regards-to-lnurl-withdraw-links), but this bLIP aims just to clarify how the receiving part of the flow works and to represent a guide for an open standard, so it's not its goal to highlight them.
theDavidCoen marked this conversation as resolved.
Show resolved Hide resolved
<br>With an open standard we can have interoperability between many different apps and services that use LNURL protocol and the client-server interaction, in a custodial or completely non-custodial way.
<br>This way we can share a common UX, very similar to what we have with fiat prepaid/debit/credit cards.

## Differencies between BOLT11 invoice, LNURL-withdraw, LNURL-pay and LNURL-withdrawPOS flows

**Normal BOLT11 invoice:**
- Payer must be online to pay
- Payee/Merchant must be online to receive
- Payee/Merchant doesn't need (but can) to specify an amount to receive.
- Payee/Merchant tipically shows a QR code or sends a textual Lightning invoice.

**LNURL-pay:**
- Payer must be online to decode the LNURL-pay link and pay
- Payee/Merchant must be online to ask the server to create the LNURL-pay link and receive
- Payee/Merchant doesn't need (but can) to specify an amount to receive.
- Payee/Merchant tipically shows a QR code or sends a textual LNURL.

**LNURL-withdraw:**
- Payer must be online to ask the server to create the LNURL link
- Payee/Merchant must be online to decode the LNURL-withdraw link and receive
- Payee/Merchant must specify the amount to receive (withdraw) **in the aftermath**, selecting from a range (minWithdrawable/maxWithdrawable)
- Payee/Merchant tipically scans a QR code or requests a textual LNURL.

**LNURL-withdrawPOS:**
- Payer can be offline, its server is always online
- Payee/Merchant must be online to decode the LNURL-withdraw link and receive
- Payee/Merchant must specify the amount to receive (withdraw) **in advance**
- Payer/Merchant doesn't need to scan the QR code or request a textual LNURL, but just waits for the payer to send the LNURL-withdraw link via NFC


## Reference Implementations

* [BTCpay's LNURL NFC Support plugin by Andrew Camilleri](https://github.com/btcpayserver/btcpayserver-plugins)
* [Coincorner's checkout system](https://www.coincorner.com/Checkout)
* [IBEX Mercado's Point of Sale](https://www.ibexmercado.com/)
* [Fast Bitcoins's Point of Sale](https://fastbitcoins.com/)
Binary file added blip-0015/lnurl-withdrawPOS flowchart.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added blip-0015/offline payments LNURL-withdrawPOS.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.