2

I working on "value for value" payments for podcasts using bitcoin lightning payments. There is a standard for adding metadata to this payments, which is defined here: https://github.com/satoshisstream/satoshis.stream/blob/main/TLV_registry.md#field-7629169 (Key 7629169).

Now, I'd like to estimate how much space is left for the extension section of the lightning message (as defined in BOLT #1), given that the maximum size of the total message is 2^16 bytes (65536).

Is there a reasonable way of doing this estimation?

1 Answer 1

1

I once suggested a pull request to add a table with the length of all messages in the Lightning Network but this was never merged.

I guess the table is somewhat outdated by now but for easier reference you can find it here.

https://github.com/renepickhardt/lightning-rfc/blob/master/appendix-a-list_of_messanges.mediawiki

I think taking those values und substract from the 2^16 bytes is currently the best you can do to estimate (Also think of the framing of the Lighting messages as there is a small header and the table only shows the length of the payload).

However you will not know what other TLV streams might be added. Yet if you are implementing this anyway you should be in full control over your data? I mean you set the length of the TLV stream yourself that you append to the message.

1
  • Thank you Rene, the table you shared is a good reference. I do have full control over the TLV streams on the extension, so I'll know how much to subtract. One thing I could not sort out yet, which messages are sent when I pay an invoice (or in my case, send a keysend or spontaneous amp payment) - if you have a reference for that (preferably "for dummies"), I'd be grateful. Commented Dec 13, 2021 at 8:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.