Skip to content
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

bolt12: allow to inject payer_metadata #7786

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

vincenzopalazzo
Copy link
Collaborator

Payer metadata is a field that controls the payer ID
provided during the fetchinvoice process.

There are use cases where this is highly useful, such as
proving that the payer has paid for the correct item.

Imagine visiting a merchant's website to pay for multiple offers, where
one of these offers is a default offer (with no description and no set amount).

In this scenario, the merchant could claim not to have received
payment for a specific item. Since the same offer may be used to
fetch invoices for different products, there needs to be a way to
identify which product the invoice corresponds to.

With this commit, it will be possible to inject payer metadata,
which helps solve the issue described above.

For example, possible payer metadata could be to_hex(b"{payer_node_id}.{product_id}.{created_at}").

See 8b457bc for a code example

Opening a PR to give a run to the tests, There is probably something else needs to be hammered but opening as a draft just to take the lock for the upcoming release.


  • The changelog has been updated in the relevant commit(s) according to the guidelines.
  • Tests have been added or modified to reflect the changes.
  • Documentation has been reviewed and updated as needed.
  • Related issues have been listed and linked, including any that this PR closes.

@vincenzopalazzo
Copy link
Collaborator Author

@rustyrussell why CLN is rate limiting the onion message? This is a case that is happening in CI https://github.com/ElementsProject/lightning/actions/runs/11644467250/job/32426697525?pr=7786


===End Flaky Test Report===
=========================== short test summary info ============================
ERROR tests/test_pay.py::test_fetchinvoice_with_payer_metadata - ValueError: 
Node errors:
 - lightningd-2: had warning messages
Global errors:

@rustyrussell
Copy link
Contributor

You want to use invreq_payer_note for this I think?

If metadata is predictable, then someone can grind to reveal all the values in proof of payment, if you publish one.

Payer metadata is a field that controls the payer ID
provided during the fetchinvoice process.

There are use cases where this is highly useful, such as
proving that the payer has paid for the correct item.

Imagine visiting a merchant's website to pay for multiple offers, where
one of these offers is a default offer (with no description and no set amount).

In this scenario, the merchant could claim not to have received
payment for a specific item. Since the same offer may be used to
fetch invoices for different products, there needs to be a way to
identify which product the invoice corresponds to.

With this commit, it will be possible to inject payer metadata,
which helps solve the issue described above.

For example, possible payer metadata could be `to_hex(b"{payer_node_id}.{product_id}.{created_at}")`.

Changelog-Added: bolt12: allow to inject payer_metadata at fetchinvoice time
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
@rustyrussell rustyrussell added this to the v24.11 milestone Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants