-
Notifications
You must be signed in to change notification settings - Fork 46
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
theDavidCoen
wants to merge
20
commits into
lightning:master
Choose a base branch
from
theDavidCoen:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
38234ea
Create blip-0011.md
theDavidCoen d196cee
Create index.md
theDavidCoen 9a38ca4
Add files via upload
theDavidCoen e220f97
Delete index.md
theDavidCoen 4bcac8e
Add files via upload
theDavidCoen 596583a
Update blip-0011.md
theDavidCoen a6a81ed
Update blip-0011.md
theDavidCoen c6e842d
Update blip-0011.md
theDavidCoen dee1cc2
Update blip-0011.md
theDavidCoen b3d892d
Update blip-0011.md
theDavidCoen 37a4f04
Update blip-0011.md
theDavidCoen 7c32e41
update blip number
theDavidCoen b0ead96
Update blip-0015.md
theDavidCoen 6476217
Update blip-0015.md
theDavidCoen 95fa0b3
Update blip-0015.md
theDavidCoen 5a50c13
Update blip-0015.md
theDavidCoen 253260a
Update and rename blip-0015.md to blip-0016.md
theDavidCoen 0de6427
Update and rename blip-0016.md to blip-0015.md
theDavidCoen a739bff
Update blip-0015.md
theDavidCoen 84b00ea
Update blip-0015.md
theDavidCoen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
``` | ||
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 typically asks the user to enter an amount and under the hood it creates a Lightning invoice | ||
that respect the parameters returned by the server, and sends it to the service provider, which eventually pays that. | ||
From a high level the user-visible flow consists of: | ||
|
||
1. Scan the QR code / paste the LNURL-withdraw link into the wallet | ||
2. Enter the amount to receive | ||
3. Confirm | ||
|
||
This repo schematizes a LNURL-withdraw flow for POS, | ||
which sees the interaction between the user and a POS equipped with a NFC sensor. | ||
|
||
This bLIP documents a reference flow for open source implementations of POS devices able to read LNURL-withdraw links via NFC, | ||
for a better UX in Lightning payments powered by LNURL protocol, compared to the flow explained above. | ||
|
||
## 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. | ||
Since a LNURL-withdraw link is static, it's possible for a malicious actor to save the link and use it in t=n without the owner consensus (multi-spend attack). | ||
It is also possible for a malicious actor to request a higher amount of what the POS screen shows to the user (overcharge attack), since the JSON from the server contains the range the user can request (*minWithdrawable<X<maxWithdrawable*). | ||
While the overcharge attack could be solved by resorting to facilitators, such as the law courts, the multi-spend attack should be prevented by the prepaid card creator and the current solutions are: | ||
|
||
**Disposable links** | ||
**Server-side secrets (PIN/Password/Passphrase)** | ||
**Server-side counters associated with a specific NFC chip (NTAG 424)** | ||
|
||
**Disposable links** | ||
Disposable cards are widely adopted by fiat services. A user can create a card and spend the entire amount, then the app forgets the card details and it can't be used anymore. | ||
This may also exist here: whenever the user spend sats using the LNURL-withdraw link, this could be "destroyed" and a new LNURL-withdraw link could be created, which "contains" the change. | ||
|
||
**Server-side secrets (PIN/Password/Passphrase)** | ||
It would require to add a PIN/Password/Passphrase request to the LNURL-withdraw link, so the user's server asks the POS for a secret and gives an error if no secret/incorrect secret is provided. | ||
Cons: if the secret is static, it could be saved by the malicious POS and used in t=n. | ||
|
||
**Server-side counters associated with a specific NFC chip (NTAG 424)** | ||
This kind of tags offers a great level of interaction and encryption. | ||
This solution would require to implement a checking system server-side so the server can check the LNURL links, add a value to a counter and interact with a private key holded in the card. If the merchant tries to use a link associated to a previous value of the counter, the server gives an error and the merchant can't withdraw the funds. | ||
|
||
However, 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 prevent or resolve this kind of attacks. | ||
<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/) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.