-
Notifications
You must be signed in to change notification settings - Fork 51
Keysend bLIP #5
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
Merged
Merged
Keysend bLIP #5
Changes from all commits
Commits
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 hidden or 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
This file contains hidden or 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
This file contains hidden or 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,91 @@ | ||
``` | ||
bLIP: 3 | ||
Title: Keysend | ||
Status: Active | ||
Author: Valentine Wallace <[email protected]> | ||
Created: 2021-12-08 | ||
License: CC0 | ||
``` | ||
|
||
# Abstract | ||
|
||
Keysend is a type of lightning payment that does not require the payee to | ||
provide an invoice. Instead, the payer includes their payer-selected payment | ||
preimage in the TLV onion. | ||
|
||
This bLIP serves to document what is already well-supported in the wild (see | ||
[Reference Implementations](#reference-implementations)), for posterity and so | ||
that new implementations don't have to reverse-engineer keysend from existing | ||
implementations. | ||
|
||
# Copyright | ||
|
||
This bLIP is licensed under the CC0 license. | ||
|
||
# Specification | ||
|
||
Sender: | ||
* MUST include a TLV record keyed by type `5482373484` with a TLV value of a | ||
valentinewallace marked this conversation as resolved.
Show resolved
Hide resolved
|
||
randomly generated and cryptographically-secure 32-byte value that serves as | ||
the HTLC payment preimage | ||
valentinewallace marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* MUST NOT reuse a previously used preimage | ||
* MUST NOT reuse a preimage from a previously paid invoice | ||
* MUST set the `payment_hash` field in the `update_add_htlc` message to match | ||
the SHA256 hash of the payment preimage | ||
* SHOULD only send payments to nodes advertising the `keysend` feature bit | ||
|
||
Receiver: | ||
* if failing the payment due to not wanting to accept keysend payments or if | ||
the preimage does not match the payment hash, SHOULD error with | ||
`PERM|15 incorrect_or_unknown_payment_details`. | ||
|
||
# Motivation | ||
|
||
A convenience of layer 1 bitcoin is being able to spontaneously send to a | ||
bitcoin address with no advance work required on the part of the payee. Keysend | ||
brings the convenience of sponaneous payments to layer 2 (with a few caveats, | ||
see the [Drawbacks](#keysend-drawbacks) section). | ||
|
||
As previously mentioned, keysend also has the advantage of already being | ||
supported by major implementations. So regardless of whether it is the best | ||
solution to spontaneous payments, it's a good idea to have some form of | ||
official documentation for it. | ||
|
||
# Rationale | ||
|
||
Design decisions for keysend were largely made by the original lnd keysend | ||
implementation (e.g. the choice of `5482373484` for the TLV type). | ||
|
||
* The TLV type `5482373484` was chosen at random | ||
* The rationale behind having a feature bit is that it's nicer to opt-in to | ||
receiving keysend payments: without a feature bit, the only way for senders to | ||
explicitly know that receivers support keysend is by attempting a keysend | ||
payment and seeing whether or not it fails. | ||
|
||
# Keysend Drawbacks | ||
|
||
* Inability for the payee to specify their preferred `min_final_cltv_expiry`. | ||
This is an issue because payer and payee may have differing security | ||
requirements, which could lead to payment failures if the payee considers the | ||
payer's choice of `min_final_cltv_expiry` too high or too low. | ||
* Loss of being able to use the preimage and invoice signature as | ||
proof-of-payment. With regular lightning payments, payers are able to use (1) | ||
the payment preimage and (2) the invoice signature in a situation where they | ||
need to prove that they made a payment (the invoice signature is necessary to | ||
prove that the payer was not an intermediary hop). This proof cannot be | ||
provided for keysend payments because the preimage is provided by the payer to | ||
begin with and no invoice is being paid. | ||
* Keysend is expected to be deprecated in favor of a more well-developed | ||
spontaneous payment solution like | ||
[Offers](https://github.com/lightningnetwork/lightning-rfc/pull/798) or | ||
[AMP](https://github.com/lightningnetwork/lightning-rfc/pull/658) | ||
|
||
# Reference Implementations | ||
|
||
LDK: https://github.com/rust-bitcoin/rust-lightning/pull/967 | ||
|
||
C-Lightning: https://github.com/ElementsProject/lightning/blob/master/plugins/keysend.c | ||
|
||
lnd original keysend PR: https://github.com/lightningnetwork/lnd/pull/3795 | ||
|
||
Eclair: https://github.com/ACINQ/eclair/pull/1485 |
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.
Is this the right location for this table row? I think it should be part of the
payment_onion_payload
section.What is this exactly? The
update_add_htlc
message can be extended with custom tlv fields, but that isn't the onion payload.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.
Good catch, that does need to be fixed!
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.
Thanks @joostjager, corrected in #15