-
Notifications
You must be signed in to change notification settings - Fork 491
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
Add payment metadata to payment request (feature 48) #912
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -140,6 +140,8 @@ Currently defined tagged fields are: | |
* `p` (1): `data_length` 52. 256-bit SHA256 payment_hash. Preimage of this provides proof of payment. | ||
* `s` (16): `data_length` 52. This 256-bit secret prevents forwarding nodes from probing the payment recipient. | ||
* `d` (13): `data_length` variable. Short description of purpose of payment (UTF-8), e.g. '1 cup of coffee' or 'ナンセンス 1杯' | ||
* `m` (27): `data_length` variable. Additional metadata to attach to the | ||
payment. Note that the size of this field is limited by the maximum hop payload size. Long metadata fields reduce the maximum route length. | ||
* `n` (19): `data_length` 53. 33-byte public key of the payee node | ||
* `h` (23): `data_length` 52. 256-bit description of purpose of payment (SHA256). This is used to commit to an associated description that is over 639 bytes, but the transport mechanism for the description in that case is transport specific and not defined here. | ||
* `x` (6): `data_length` variable. `expiry` time in seconds (big-endian). Default is 3600 (1 hour) if not specified. | ||
|
@@ -216,7 +218,8 @@ A reader: | |
- MUST use that as [`payment_secret`](04-onion-routing.md#tlv_payload-payload-format) | ||
- if the `c` field (`min_final_cltv_expiry`) is not provided: | ||
- MUST use an expiry delta of at least 18 when making the payment | ||
|
||
- if an `m` field is provided: | ||
- MUST use that as [`payment_metadata`](04-onion-routing.md#tlv_payload-payload-format) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens if the payer does not use this as In BOLT 04 we have the onion failure message 1. type: PERM|15 ( https://github.com/joostjager/lightning-rfc/blob/custom-invoice-data/04-onion-routing.md#L953 currently reads:
Maybe we should also include that this error is sent if the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or we can use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am a bit confused right now. Which of the two error codes protects the privacy of the recipient better? I guess if an intermediate malicious node interrupts routing and sends onions to various candidate recipients without including There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I agree. If you make There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated PR to return There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dear @joostjager I am very pleased that you found my review & suggestion useful. Yet I am a bit surprised that you did not accept the patch that I provided 5 days ago with my suggestion and for your convenience directly as a pull request to your branch at joostjager#1. I hope the reason is that you have simply overseen my pull request and patch. As you did not credit my contribution in your recent commit may I ask you kindly to revert the most recent addition and accept the provided patch instead? Thank you very much! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @lightning-developer, No I didn't see your patch on my personal repo. Generally speaking and also in this particular case, lots of people contribute ideas. I think it will get complicated to list all of them as co-authors. They may not all have contributed text literally, but an idea often deserves credit too. |
||
### Rationale | ||
|
||
The type-and-length format allows future extensions to be backward | ||
|
@@ -235,6 +238,9 @@ by which the description is served is as-yet unspecified and will | |
probably be transport dependent. The `h` format could change in the future, | ||
by changing the length, so readers ignore it if it's not 256 bits. | ||
|
||
The `m` field allows metadata to be attached to the payment. This supports | ||
joostjager marked this conversation as resolved.
Show resolved
Hide resolved
|
||
applications where the recipient doesn't keep any context for the payment. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is more a rationale for how this field could be used, but i can see other use cases as well (split PoS and recipient, ...). I'd personally prefer having these separate from the prescriptive text. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But this part is already inside the rationale section, isn't it? So it should be ok? Or do you mean that you don't want something as concrete here, and would rather have a separate doc (a spark?) explain how the |
||
|
||
The `n` field can be used to explicitly specify the destination node ID, | ||
instead of requiring signature recovery. | ||
|
||
|
@@ -704,6 +710,33 @@ Breakdown: | |
* `z599y53s3ujmcfjp5xrdap68qxymkqphwsexhmhr8wdz5usdzkzrse33chw6dlp3jhuhge9ley7j2ayx36kawe7kmgg8sv5ugdyusdcq`: signature | ||
* `zn8z9x`: Bech32 checksum | ||
|
||
> ### Please send 0.01 BTC with payment metadata 0x01fafaf0 | ||
> lnbc10m1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdp9wpshjmt9de6zqmt9w3skgct5vysxjmnnd9jx2mq8q8a04uqsp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygs9q2gqqqqqqsgq7hf8he7ecf7n4ffphs6awl9t6676rrclv9ckg3d3ncn7fct63p6s365duk5wrk202cfy3aj5xnnp5gs3vrdvruverwwq7yzhkf5a3xqpd05wjc | ||
|
||
Breakdown: | ||
|
||
* `lnbc`: prefix, Lightning on Bitcoin mainnet | ||
* `10m`: amount (10 milli-bitcoin) | ||
* `1`: Bech32 separator | ||
* `pvjluez`: timestamp (1496314658) | ||
* `p`: payment hash | ||
* `p5`: `data_length` (`p` = 1, `5` = 20; 1 * 32 + 20 == 52) | ||
* `qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypq`: payment hash 0001020304050607080900010203040506070809000102030405060708090102 | ||
* `d`: short description | ||
* `p9`: `data_length` (`p` = 1, `9` = 5; 1 * 32 + 5 == 37) | ||
* `wpshjmt9de6zqmt9w3skgct5vysxjmnnd9jx2`: 'payment metadata inside' | ||
* `m`: metadata | ||
* `q8`: `data_length` (`q` = 0, `8` = 7; 0 * 32 + 7 == 7) | ||
* `q8a04uq`: 0x01fafaf0 | ||
* `s`: payment secret | ||
* `p5`: `data_length` (`p` = 1, `5` = 20; 1 * 32 + 20 == 52) | ||
* `zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygs`: 0x1111111111111111111111111111111111111111111111111111111111111111 | ||
* `9`: features | ||
* `q2`: `data_length` (`q` = 0, `2` = 10; 0 * 32 + 10 == 10) | ||
* `gqqqqqqsgq`: [b01000000000000000000000000000000000100000100000000] = 8 + 14 + 48 | ||
* `7hf8he7ecf7n4ffphs6awl9t6676rrclv9ckg3d3ncn7fct63p6s365duk5wrk202cfy3aj5xnnp5gs3vrdvruverwwq7yzhkf5a3xqp`: signature | ||
* `d05wjc`: Bech32 checksum | ||
|
||
# Examples of Invalid Invoices | ||
|
||
> # Same, but adding invalid unknown feature 100 | ||
|
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.
nit: please add an empty line between this and
### Rationale