Skip to content
LearnBitcoin

ResearchBitcoin Dev Archive lightning-dev list

Comments on BOLT#11

14 messages, Dec 10 to 18, 2017. Started by Jonathan Underwood.

Jonathan Underwood (7), Rusty Russell (3), ZmnSCPxj, Johan Torås Halseth, Jameson Lopp, Alex Bosworth

Permalink First message in the Wayback Machine

Jonathan Underwood permalink original

Hello all,

Recently I have implemented BOLT11 in node JS. You can find it on github at bitcoinjs/bolt11 (check the wip branch, I am still working on tests and looking at maybe splitting encode up into two functions, encode and sign, if anyone wants to help)

Here are some comments:

1. There should be a tags_length integer before the first tag. This will get rid of the awkward dance of parsing from the front and end at the same time and make it easier to detect poorly encoded data quickly. 2. Why is a description or description commit hash a MUST include tag... it should be SHOULD. 3. Descriptions say they can encode ASCII only. Sorry, but this is nonsense. Full unicode support via UTF8 should be supported. 4. There should be a maximum length (in bytes) for description. (Otherwise why have a commit hash tag at all?) 5. There should be a recommendation for ways for the parsing client to fetch the commited purpose description data. (Maybe encode a URL after the 32 byte commit hash?) 6. Lightning payment requests can get pretty long, but perhaps there should be a limit. Apparently bech32 with the given parameters can only handle one error correction once it is longer than 1023 words.

Now for some things on the BOLT document itself:

1. I made a pull request for adding signature preimage hex data etc. to the examples to help people writing decoders. Some of the language was unclear to me and lead to some goof ups. 2. Would be nice to have a fuller set of test cases on the RFC. I will work on some cases to increase coverage on the bitcoinjs repo. Would be happy for any help.

ZmnSCPxj in reply to Jonathan Underwood permalink original

Good morning Jonathan,

Quoted text (1 line)
>3. Descriptions say they can encode ASCII only. Sorry, but this is nonsense. Full unicode support via UTF8 should be supported.

I generally agree, but caution must be warned here. In particular, we should be precise, which variant of UTF8.

Presumably, a naive implementation, that specially treats 0 bytes (as would happen if the implementation were naively written in C or C++, where by default, strings are terminated by a 0 byte), should work correctly without having to particularly care, if the encoding is UTF8 or plain 7-bit ASCII. This then leads to the use of so-called Modified UTF8 as used by Java in its native interface: embedded null characters are encoded as extralong 3-byte UTF8 sequences, which are normally invalid in UTF8, but which naive treatment by C and C++ leads to (mostly) correct behavior. Should we use Modifed UTF8 or simply disallow null characters? (Use of ASCII does not avoid this, but ASCII has no alternative to null characters and the standard C string terminating byte 0).

In addition, pulling in UTF8 brings in the issue, of Unicode normalization. Multiple different byte-sequences in UTF8 may lead to the same sequence of human-readable glyphs. Specifying ASCII avoids this issue. Should we specify some Unicode normalization, and should GUI at least try to impose this Unicode normalization (even if backends/daemons simply ignore the description and hence any normalization issues)?

Regards, ZmnSCPxj

Jonathan Underwood in reply to ZmnSCPxj permalink original

ZmnSCPxj,

Thanks for the reply.

1. I agree that all naive implementations that do not follow UTF-8 spec should perhaps be mentioned, to help people avoid mojibake corruption. However, this problem is a problem as old as the internet itself (there are still Japanese websites in shift-JIS encoding) and I think the consensus is that UTF-8 is the standard. Allowing it in the description is fine as long as the readers can decode the naive UTF-8 data correctly.

2. Normalization is only an issue when you need to hash something or compare hash data so it is not an issue for the description, where the goal is to relay information to the user. (so maybe it could become an issue for the 256 bit description of purpose of payment (SHA256) but not for the simple description)

In regards to the purpose commit hash, seeing as there is no specified way to relay the data for the purpose commit hash, you could just solve it by specifying the data to be fetched from a URL and having the data encoded as a binary-stream with the exact bytes that were hashed and the UTF-8 parser on the receiving app will just display it to the user. (since the goal is to display info to the user, it doesn't matter if the word is using one byte combination or the other, as long as you can verify the commit hash matches the hash of the data and you then can display the data to the user)

Protocols like BIP39 require normalization because when a user inputs data, they could be using any millions of IMEs that might use different unicode codepoints to represent the same data as other IMEs... and we need to ensure that the same human readable phrase ALWAYS is the same hash or else money is lost (or hard to get to)

For description: "OMG I LOST 100 BTC BECAUSE THE DESCRIPTION SAID が instead of が !!!" will never happen.

I would love to hear your thoughts on other aspects as well.

Thanks, Jon

2017-12-11 20:10 GMT+09:00 ZmnSCPxj <ZmnSCPxj at protonmail.com>:

Quoted text (30 lines)
> Good morning Jonathan,
>
> >3. Descriptions say they can encode ASCII only. Sorry, but this is
> nonsense. Full unicode support via UTF8 should be supported.
>
> I generally agree, but caution must be warned here.  In particular, we
> should be precise, which variant of UTF8.
>
> Presumably, a naive implementation, that specially treats 0 bytes (as
> would happen if the implementation were naively written in C or C++, where
> by default, strings are terminated by a 0 byte), should work correctly
> without having to particularly care, if the encoding is UTF8 or plain 7-bit
> ASCII.  This then leads to the use of so-called Modified UTF8 as used by
> Java in its native interface: embedded null characters are encoded as
> extralong 3-byte UTF8 sequences, which are normally invalid in UTF8, but
> which naive treatment by C and C++ leads to (mostly) correct behavior.
> Should we use Modifed UTF8 or simply disallow null characters? (Use of
> ASCII does not avoid this, but ASCII has no alternative to null characters
> and the standard C string terminating byte 0).
>
> In addition, pulling in UTF8 brings in the issue, of Unicode
> normalization.  Multiple different byte-sequences in UTF8 may lead to the
> same sequence of human-readable glyphs. Specifying ASCII avoids this
> issue.  Should we specify some Unicode normalization, and should GUI at
> least try to impose this Unicode normalization (even if backends/daemons
> simply ignore the description and hence any normalization issues)?
>
> Regards,
> ZmnSCPxj
>
Rusty Russell in reply to Jonathan Underwood permalink original

Jonathan Underwood <junderwood at bitcoinbank.co.jp> writes:

Quoted text (6 lines)
> Hello all,
>
> Recently I have implemented BOLT11 in node JS. You can find it on github at
> bitcoinjs/bolt11 (check the wip branch, I am still working on tests and
> looking at maybe splitting encode up into two functions, encode and sign,
> if anyone wants to help)

Hi, this is great!

Quoted text (5 lines)
> Here are some comments:
>
> 1. There should be a tags_length integer before the first tag. This will
> get rid of the awkward dance of parsing from the front and end at the same
> time and make it easier to detect poorly encoded data quickly.

I'm not sure what you're referring to? I've written two decoders, and both pull off the header and fixed fields, then iterate while (data_len > 520 / 5).

Quoted text (2 lines)
> 2. Why is a description or description commit hash a MUST include tag... it
> should be SHOULD.

I disagree. Obviously we can't force people to be descriptive (that's a SHOULD), but not including a description of the purpose of the payment is a mistake.

The invoice and the preimage provides a cryptographic proof of purchase. But that's undermined if the description is missing.

Quoted text (3 lines)
> 3. Descriptions say they can encode ASCII only. Sorry, but this is
> nonsense. Full unicode support via UTF8 should be supported.

>From the ML welcome: "Be excellent to each other please!"

I understand this mistake upset you, but "Sorry, but this is nonsense" makes me want to find spurious justifications for it. I prefer "This seems unfairly limiting", "This is a mistake" or "Woah, time to go 8 bits, granddad!".

The problem is the spec describes the 'd' field like so:

        short description of purpose of payment (ASCII),  e.g. '1 cup of coffee'

There's nothing in the *requirements* section, at all.

So, I think we should:

1.  s/ASCII/UTF-8/
    - It seems everyone handles this fine anyway.
2.  Add another example, here, which is in UTF-8, say "or 'ナンセンスのカップ'" :)
3.  Add a requirement that the writer MUST use valid UTF-8.
4.  Modify one of the examples to use a UTF-8 description.
Quoted text (2 lines)
> 4. There should be a maximum length (in bytes) for description. (Otherwise
> why have a commit hash tag at all?)

There is; no field can be greater than 640 bytes (1023 5-bit values). Also, the transport might have practical limits, so you might need to consider that in total. (Maybe not though, if you're going for QR codes, as they go pretty large).

Quoted text (3 lines)
> 5. There should be a recommendation for ways for the parsing client to
> fetch the commited purpose description data. (Maybe encode a URL after the
> 32 byte commit hash?)

Yes there should, but we left it open for the moment because there's no good solution here, and someone needs to come up with one. This makes description hash fairly useless for now, IMHO.

A URL is the obvious solution, but has the terrible property that it de-anonymizes the wallet :( (even before the person has decided whether they want to pay).

FWIW, there are a range of possible solutions, depending on the scenario:
1. If you have some container format, eg. HTML, include the description as a
   separate tag.
2. Roasbeef wants to implement HORNET over our network, and that could
   be used to retrieve the full description.

Meanwhile, 640 bytes should be enough for anyone!

Quoted text (3 lines)
> 6. Lightning payment requests can get pretty long, but perhaps there should
> be a limit. Apparently bech32 with the given parameters can only handle one
> error correction once it is longer than 1023 words.

Actually I think bech32 loses all guarantees at 1023 words, but it's no worse than a 30-bit checksum. We mainly use it because it's simple and available, and of course any fixed-length code will have some limit.

What actually happens if we decode badly is that we derive the wrong public key for the node (50% chance, other 50% we get a signature failure) and we can't route to it or pay to it. So no funds are actually lost.

Quoted text (5 lines)
> Now for some things on the BOLT document itself:
>
> 1. I made a pull request for adding signature preimage hex data etc. to the
> examples to help people writing decoders. Some of the language was unclear
> to me and lead to some goof ups.

Yes, this was *awesome*; I double-checked the values by hacking my python encoder, and adjusted for the recent r-encoding change. It's merged, thanks!

        https://github.com/lightningnetwork/lightning-rfc/pull/312
Quoted text (3 lines)
> 2. Would be nice to have a fuller set of test cases on the RFC. I will work
> on some cases to increase coverage on the bitcoinjs repo. Would be happy
> for any help.

That would be fantastic! We've talked about changing the test vectors (for all the BOLTs) into a more machine-friendly JSON encoding, so if you're feeling ambitious you could start with BOLT 11 :)

Thanks! Rusty.

Jonathan Underwood in reply to Rusty Russell permalink original

Rusty,

Quoted text (3 lines)
> I'm not sure what you're referring to?  I've written two decoders, and
> both pull off the header and fixed fields, then iterate
> while (data_len > 520 / 5).
What happens if the signature is missing or the signature is improperly
formatted?
It is much easier to detect a case like that at the beginning if we have:
  1. read 7 words for timestamp
  2. read 3 words for tags_total_length
  3. read tags_total_length words for the tags data
  4. read 104 words for signature and recoveryID
Then immediately you can tell "oh, the signature is an invalid length"
rather than
having to decide whether "is the signature malformed or is the last tag
malformed?
if I run out of words while parsing a tag, is it because I just happened
upon a rare
case where I am parsing the signature as tags and the word just happened to
be a valid tag?"

I just think it should be explicit to help prevent problems

Quoted text (6 lines)
> I disagree.  Obviously we can't force people to be descriptive (that's a
> SHOULD), but not including a description of the purpose of the payment
> is a mistake.
>
> The invoice and the preimage provides a cryptographic proof of
> purchase.  But that's undermined if the description is missing.

I disagree, but this is not a huge issue so I withdraw my comment.

Quoted text (21 lines)
> From the ML welcome: "Be excellent to each other please!"
>
> I understand this mistake upset you, but "Sorry, but this is nonsense"
> makes me want to find spurious justifications for it.  I prefer "This
> seems unfairly limiting", "This is a mistake" or "Woah, time to go 8
> bits, granddad!".
>
> The problem is the spec describes the 'd' field like so:
>
>         short description of purpose of payment (ASCII),  e.g. '1 cup of
coffee'
>
> There's nothing in the *requirements* section, at all.
>
> So, I think we should:
>
> 1.  s/ASCII/UTF-8/
>     - It seems everyone handles this fine anyway.
> 2.  Add another example, here, which is in UTF-8, say "or 'ナンセンスのカップ'" :)
> 3.  Add a requirement that the writer MUST use valid UTF-8.
> 4.  Modify one of the examples to use a UTF-8 description.

Sorry I didn't mean to be offensive. I think I have been in Japan for too long, my English senses are dulling.

I agree with 1-4. "ナンセンス 1杯" is now a lightning meme. I am honored. ;)

Quoted text (4 lines)
> There is; no field can be greater than 640 bytes (1023 5-bit values).
> Also, the transport might have practical limits, so you might need to
> consider that in total.  (Maybe not though, if you're going for QR
> codes, as they go pretty large).

640 bytes is rather long... but this is not really a huge issue for me. So I withdraw my comment.

Quoted text (16 lines)
> Yes there should, but we left it open for the moment because there's no
> good solution here, and someone needs to come up with one.  This makes
> description hash fairly useless for now, IMHO.
>
> A URL is the obvious solution, but has the terrible property that it
> de-anonymizes the wallet :( (even before the person has decided whether
> they want to pay).
>
> FWIW, there are a range of possible solutions, depending on the scenario:
> 1. If you have some container format, eg. HTML, include the description
as a
>    separate tag.
> 2. Roasbeef wants to implement HORNET over our network, and that could
>    be used to retrieve the full description.
>
> Meanwhile, 640 bytes should be enough for anyone!

HORNET sounds nice. Under this description, it seems like the plain description will be the primary method of communication for the forseeable future.

Quoted text (8 lines)
> Actually I think bech32 loses all guarantees at 1023 words, but it's no
> worse than a 30-bit checksum.  We mainly use it because it's simple and
> available, and of course any fixed-length code will have some limit.
>
> What actually happens if we decode badly is that we derive the wrong
> public key for the node (50% chance, other 50% we get a signature
> failure) and we can't route to it or pay to it.  So no funds are
> actually lost.

Unless the incorrect pubkey just happened to be someone elses!!! (/s) Yeah I guess if we don't care about error correction, a 30 bit checksum is still pretty good.

Quoted text (5 lines)
> Yes, this was *awesome*; I double-checked the values by hacking my
> python encoder, and adjusted for the recent r-encoding change.  It's
> merged, thanks!
>
>         https://github.com/lightningnetwork/lightning-rfc/pull/312

Glad I could be of help. :)

Quoted text (3 lines)
> That would be fantastic!  We've talked about changing the test vectors
> (for all the BOLTs) into a more machine-friendly JSON encoding, so if
> you're feeling ambitious you could start with BOLT 11 :)

I'll have to work on that later this week. Currently trying to iron out our Lightning deposit / withdrawal UI with our front end engineer.

Quoted text (1 line)
> Thanks!

You're welcome!

Additional comment: we should make a requirement to hide text in the description under certain conditions.

ie. "A reader MUST hide information surrounded by curly brackets {} including the brackets themselves from the UI, and only make the information avaiable internally."

I think a lot of people will want to include extra data in their payment requests' description.

I think HTLC.ME uses it and maybe bitrefill? (correct me if I'm wrong.)

Perhaps adding an "extra data" tag?

... hmmm...

Thanks, Jon

Jonathan Underwood in reply to Jonathan Underwood permalink original

I made a payment request using UTF-8 description here: lntb1pdz7e9epp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdpquwpc4curk03c9wlrswe78q4eyqc7d8d0e5l2jffz6amujxz82mtagde82dv8jku2jac79k0yxnjmr0l3f4y5x0jxt46vmcrc0ukzh7l99vdmkezsettfwr4gqnhs2ndx8wdqgfsp82rnvp

using this code: (I just separated encode from sign)

ln.sign(ln.encode({
  tags:[
    {
      tagName:'payment_hash',
data:'0001020304050607080900010203040506070809000102030405060708090102'
    },
    {
      tagName:'description',
      data:'ナンセンス 1杯'
    }
  ]
}, false),
Buffer.from('e126f68f7eafcc8b74f54d269fe206be715000f94dac067d1c04a8ca3b2db734',
'hex')).paymentRequest

Full results:

{
  "coinType": "testnet",
  "payeeNodeKey":
"03e7156ae33b0a208d0744199163177e909e80176e55d97a2f221ede0f934dd9ad",
  "paymentRequest":
"lntb1pdz7e9epp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdpquwpc4curk03c9wlrswe78q4eyqc7d8d0e5l2jffz6amujxz82mtagde82dv8jku2jac79k0yxnjmr0l3f4y5x0jxt46vmcrc0ukzh7l99vdmkezsettfwr4gqnhs2ndx8wdqgfsp82rnvp",
  "recoveryFlag": 1,
  "satoshis": null,
  "signature":
"cd3ea92522d777c9184756d7d437275358795b8a9771e2d9e434e5b1bff14d49433e465d74cde0787f2c2bfbe52b1bbb6450cad6970ea804ef054da63b9a0426",
  "tags": [
    {
      "tagName": "payment_hash",
      "data":
"0001020304050607080900010203040506070809000102030405060708090102"
    },
    {
      "tagName": "description",
      "data": "ナンセンス 1杯"
    }
  ],
  "timestamp": 1513055417,
  "timestampString": "2017-12-12T05:10:17.000Z"
}
Johan Torås Halseth in reply to Jonathan Underwood permalink original

Just a few quick comments, as any improvements to BOLT#11 are very much appreciated :)

* I think we should set a reasonable max length for invoices, that MUST be met. This would simplify internal database logic (since you don’t have to plan for invoices infinitely big), and could make sure the error detection is fair for all supported lengths. Not sure if 1023 is enough, considering possibly multiple `r` tags and a juicy description. * Agree with UTF-8 support, and up to 640 bytes length ( this can be made explicit in the Bolt, as now it is limited by the 5 bit length field) :) * Why must the description hash URL be part of the invoice? I always imagined this would be used between clients that already had agreed on payment for some kind of data, and that this hash would just ensure you were paying the correct one. - Johan (please explain the Japanese lightning meme plz) On Tue, Dec 12, 2017 at 6:15, Jonathan Underwood <junderwood at bitcoinbank.co.jp> wrote: I made a payment request using UTF-8 description here: lntb1pdz7e9epp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdpquwpc4curk03c9wlrswe78q4eyqc7d8d0e5l2jffz6amujxz82mtagde82dv8jku2jac79k0yxnjmr0l3f4y5x0jxt46vmcrc0ukzh7l99vdmkezsettfwr4gqnhs2ndx8wdqgfsp82rnvp

using this code: (I just separated encode from sign) ln.sign(ln.encode({ tags:[ { tagName:'payment_hash', data:'0001020304050607080900010203040506070809000102030405060708090102' }, { tagName:'description', data:'ナンセンス 1杯' } ] }, false), Buffer.from('e126f68f7eafcc8b74f54d269fe206be715000f94dac067d1c04a8ca3b2db734', 'hex')).paymentRequest

Full results: { "coinType": "testnet", "payeeNodeKey": "03e7156ae33b0a208d0744199163177e909e80176e55d97a2f221ede0f934dd9ad", "paymentRequest": "lntb1pdz7e9epp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdpquwpc4curk03c9wlrswe78q4eyqc7d8d0e5l2jffz6amujxz82mtagde82dv8jku2jac79k0yxnjmr0l3f4y5x0jxt46vmcrc0ukzh7l99vdmkezsettfwr4gqnhs2ndx8wdqgfsp82rnvp", "recoveryFlag": 1, "satoshis": null, "signature": "cd3ea92522d777c9184756d7d437275358795b8a9771e2d9e434e5b1bff14d49433e465d74cde0787f2c2bfbe52b1bbb6450cad6970ea804ef054da63b9a0426", "tags": [ { "tagName": "payment_hash", "data": "0001020304050607080900010203040506070809000102030405060708090102" }, { "tagName": "description", "data": "ナンセンス 1杯" } ], "timestamp": 1513055417, "timestampString": "2017-12-12T05:10:17.000Z" }

_______________________________________________ Lightning-dev mailing list Lightning-dev at lists.linuxfoundation.org https://www.learnbitcoin.com/archive/lists/lightning-dev

Jonathan Underwood in reply to Johan Torås Halseth permalink original

Haha, Rusty sent me a google translate of “cup of nonsense” (joining my nonsense comment with the cup of coffee meme, since “cup of nonsense” seems like a reasonable way to call something nonsense)

I fixed it to a more “looks like it would be on a receipt” format instead of the direct translation which sounds more like the cup is made out of nonsense instead of being filled with it.

Heh

Also, I don’t disagree with your assessment of the purpose commit hash, but If the user is shown a description on a website and it says “please paste this description into your wallet to verify the description with the payment request”... I am pretty sure most users won’t bother, or will copy paste incorrectly and get a big red error message.

I like to think of my mom trying to use it... and my mom accidentally ordered a vacuum cleaner on Amazon once. (?????)

So yeah, I think if the wallet could somehow fetch it that would be best.

But for now, a simple description is fine imo.

Thanks, Jon

2017年12月12日(火) 22:46 Johan Torås Halseth <johanth at gmail.com>:

Quoted text (74 lines)
> Just a few quick comments, as any improvements to BOLT#11 are very much
> appreciated :)
>
> * I think we should set a reasonable max length for invoices, that MUST be
> met. This would simplify internal database logic (since you don’t have to
> plan for invoices infinitely big), and could make sure the error detection
> is fair for all supported lengths. Not sure if 1023 is enough, considering
> possibly multiple `r` tags and a juicy description.
> * Agree with UTF-8 support, and up to 640 bytes length ( this can be made
> explicit in the Bolt, as now it is limited by the 5 bit length field) :)
> * Why must the description hash URL be part of the invoice? I always imagined
> this would be used between clients that already had agreed on payment for
> some kind of data, and that this hash would just ensure you were paying the
> correct one.
>
> - Johan
> (please explain the Japanese lightning meme plz)
> On Tue, Dec 12, 2017 at 6:15, Jonathan Underwood <
> junderwood at bitcoinbank.co.jp> wrote:
>
> I made a payment request using UTF-8 description here:
>
> lntb1pdz7e9epp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdpquwpc4curk03c9wlrswe78q4eyqc7d8d0e5l2jffz6amujxz82mtagde82dv8jku2jac79k0yxnjmr0l3f4y5x0jxt46vmcrc0ukzh7l99vdmkezsettfwr4gqnhs2ndx8wdqgfsp82rnvp
>
> using this code: (I just separated encode from sign)
>
> ln.sign(ln.encode({
> tags:[
> {
> tagName:'payment_hash',
> data:'0001020304050607080900010203040506070809000102030405060708090102'
> },
> {
> tagName:'description',
> data:'ナンセンス 1杯'
> }
> ]
> }, false),
> Buffer.from('e126f68f7eafcc8b74f54d269fe206be715000f94dac067d1c04a8ca3b2db734',
> 'hex')).paymentRequest
>
>
> Full results:
>
> {
> "coinType": "testnet",
> "payeeNodeKey":
> "03e7156ae33b0a208d0744199163177e909e80176e55d97a2f221ede0f934dd9ad",
> "paymentRequest":
> "lntb1pdz7e9epp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdpquwpc4curk03c9wlrswe78q4eyqc7d8d0e5l2jffz6amujxz82mtagde82dv8jku2jac79k0yxnjmr0l3f4y5x0jxt46vmcrc0ukzh7l99vdmkezsettfwr4gqnhs2ndx8wdqgfsp82rnvp",
> "recoveryFlag": 1,
> "satoshis": null,
> "signature":
> "cd3ea92522d777c9184756d7d437275358795b8a9771e2d9e434e5b1bff14d49433e465d74cde0787f2c2bfbe52b1bbb6450cad6970ea804ef054da63b9a0426",
> "tags": [
> {
> "tagName": "payment_hash",
> "data": "0001020304050607080900010203040506070809000102030405060708090102"
> },
> {
> "tagName": "description",
> "data": "ナンセンス 1杯"
> }
> ],
> "timestamp": 1513055417,
> "timestampString": "2017-12-12T05:10:17.000Z"
> }
>
>
> _______________________________________________ Lightning-dev mailing list
> Lightning-dev at lists.linuxfoundation.org
> https://www.learnbitcoin.com/archive/lists/lightning-dev
>
> --

----------------- Jonathan Underwood ビットバンク社 チーフビットコインオフィサー -----------------

暗号化したメッセージをお送りの方は下記の公開鍵をご利用下さい。

指紋: 0xCE5EA9476DE7D3E45EBC3FDAD998682F3590FEA3

Rusty Russell in reply to Jonathan Underwood permalink original

Jonathan Underwood <junderwood at bitcoinbank.co.jp> writes:

Quoted text (12 lines)
> Additional comment: we should make a requirement to hide text in the
> description under certain conditions.
>
> ie. "A reader MUST hide information surrounded by curly brackets {}
> including
> the brackets themselves from the UI, and only make the information avaiable
> internally."
>
> I think a lot of people will want to include extra data in their payment
> requests' description.
>
> I think HTLC.ME uses it and maybe bitrefill? (correct me if I'm wrong.)

OK, HTLC.ME (cool site!) uses a description of:

        {"generic_id":"ada00363-50b6-4281-82dd-d274393439f1"}

Which I really don't understand. This field is literally only to display to the user, for them to validate it's what they wanted. The recipient never gets it back.

If I knew who ran HTLC.ME, I'd ask them to fix it: they should have a description entry field in their "Request Payment" form. It could default to "Test payment ada00363-50b6-4281-82dd-d274393439f1", but they're in spec violation at the moment.

Quoted text (1 line)
> Perhaps adding an "extra data" tag?

Easy to do, if I knew why they wanted it.

Thanks! Rusty.

Jonathan Underwood in reply to Rusty Russell permalink original

iirc they are using the description as a way to join the user data and the payment hash on their end.

htlc me is one node but separates its balance into user accounts that exist outside lightning. I think the identifier is used so when their backend checks the payment request status, the user info is right there in their local lnd RPC response rather than having to store their own database separately.

2017年12月16日(土) 8:31 Rusty Russell <rusty at rustcorp.com.au>:

Quoted text (35 lines)
> Jonathan Underwood <junderwood at bitcoinbank.co.jp> writes:
> > Additional comment: we should make a requirement to hide text in the
> > description under certain conditions.
> >
> > ie. "A reader MUST hide information surrounded by curly brackets {}
> > including
> > the brackets themselves from the UI, and only make the information
> avaiable
> > internally."
> >
> > I think a lot of people will want to include extra data in their payment
> > requests' description.
> >
> > I think HTLC.ME uses it and maybe bitrefill? (correct me if I'm wrong.)
>
> OK, HTLC.ME (cool site!) uses a description of:
>
>         {"generic_id":"ada00363-50b6-4281-82dd-d274393439f1"}
>
> Which I really don't understand.  This field is literally only to
> display to the user, for them to validate it's what they wanted.  The
> recipient never gets it back.
>
> If I knew who ran HTLC.ME, I'd ask them to fix it: they should have a
> description entry field in their "Request Payment" form.  It could
> default to "Test payment ada00363-50b6-4281-82dd-d274393439f1", but
> they're in spec violation at the moment.
>
> > Perhaps adding an "extra data" tag?
>
> Easy to do, if I knew why they wanted it.
>
> Thanks!
> Rusty.
>
Jameson Lopp in reply to Jonathan Underwood permalink original

HTLC.me is run by Alex Bosworth; I'll ping him.

On Fri, Dec 15, 2017 at 6:44 PM, Jonathan Underwood < junderwood at bitcoinbank.co.jp> wrote:

Quoted text (62 lines)
> iirc they are using the description as a way to join the user data and the
> payment hash on their end.
>
> htlc me is one node but separates its balance into user accounts that
> exist outside lightning. I think the identifier is used so when their
> backend checks the payment request status, the user info is right there in
> their local lnd RPC response rather than having to store their own database
> separately.
>
> 2017年12月16日(土) 8:31 Rusty Russell <rusty at rustcorp.com.au>:
>
>> Jonathan Underwood <junderwood at bitcoinbank.co.jp> writes:
>> > Additional comment: we should make a requirement to hide text in the
>> > description under certain conditions.
>> >
>> > ie. "A reader MUST hide information surrounded by curly brackets {}
>> > including
>> > the brackets themselves from the UI, and only make the information
>> avaiable
>> > internally."
>> >
>> > I think a lot of people will want to include extra data in their payment
>> > requests' description.
>> >
>> > I think HTLC.ME uses it and maybe bitrefill? (correct me if I'm wrong.)
>>
>> OK, HTLC.ME (cool site!) uses a description of:
>>
>>         {"generic_id":"ada00363-50b6-4281-82dd-d274393439f1"}
>>
>> Which I really don't understand.  This field is literally only to
>> display to the user, for them to validate it's what they wanted.  The
>> recipient never gets it back.
>>
>> If I knew who ran HTLC.ME, I'd ask them to fix it: they should have a
>> description entry field in their "Request Payment" form.  It could
>> default to "Test payment ada00363-50b6-4281-82dd-d274393439f1", but
>> they're in spec violation at the moment.
>>
>> > Perhaps adding an "extra data" tag?
>>
>> Easy to do, if I knew why they wanted it.
>>
>> Thanks!
>> Rusty.
>>
> --
> -----------------
> Jonathan Underwood
> ビットバンク社 チーフビットコインオフィサー
> -----------------
>
> 暗号化したメッセージをお送りの方は下記の公開鍵をご利用下さい。
>
> 指紋: 0xCE5EA9476DE7D3E45EBC3FDAD998682F3590FEA3
>
> _______________________________________________
> Lightning-dev mailing list
> Lightning-dev at lists.linuxfoundation.org
> https://www.learnbitcoin.com/archive/lists/lightning-dev
>
>
Rusty Russell in reply to Jonathan Underwood permalink original

Jonathan Underwood <junderwood at bitcoinbank.co.jp> writes:

Quoted text (2 lines)
> iirc they are using the description as a way to join the user data and the
> payment hash on their end.

But the description isn't used when I send a payment. All they get is the payment_hash.

Quoted text (5 lines)
> htlc me is one node but separates its balance into user accounts that exist
> outside lightning. I think the identifier is used so when their backend
> checks the payment request status, the user info is right there in their
> local lnd RPC response rather than having to store their own database
> separately.

Ah, that's understandable, but it seems like a wrong API.

c-lightning doesn't store the description in the database at all: each invoice uses a label which the invoice creator specifies. Unlike a description, this must be unique. It's not exposed to customers at all.

Cheers, Rusty.

Jonathan Underwood in reply to Jameson Lopp permalink original

Just to let everyone know. I currently have full coverage and a few test cases all ready to go.

All I really need is some edge cases. Any ideas are welcome.

bitcoinjs/bolt11

Thanks, Jon

Alex Bosworth in reply to Rusty Russell permalink original

htlc.me storing data in the description is just an artifact of the original lnd API which didn't include that data in the payment request

On Sat, Dec 16, 2017 at 10:51 AM, Rusty Russell <rusty at rustcorp.com.au> wrote:

Quoted text (25 lines)
> Jonathan Underwood <junderwood at bitcoinbank.co.jp> writes:
>> iirc they are using the description as a way to join the user data and the
>> payment hash on their end.
>
> But the description isn't used when I send a payment.  All they get is
> the payment_hash.
>
>> htlc me is one node but separates its balance into user accounts that exist
>> outside lightning. I think the identifier is used so when their backend
>> checks the payment request status, the user info is right there in their
>> local lnd RPC response rather than having to store their own database
>> separately.
>
> Ah, that's understandable, but it seems like a wrong API.
>
> c-lightning doesn't store the description in the database at all: each
> invoice uses a label which the invoice creator specifies.  Unlike a
> description, this must be unique.  It's not exposed to customers at all.
>
> Cheers,
> Rusty.
> _______________________________________________
> Lightning-dev mailing list
> Lightning-dev at lists.linuxfoundation.org
> https://www.learnbitcoin.com/archive/lists/lightning-dev