|
| 1 | +``` |
| 2 | +bLIP: 42 |
| 3 | +Title: Bolt 12 Contacts |
| 4 | +Status: Active |
| 5 | +Author: Bastien Teinturier <[email protected]> |
| 6 | +Created: 2024-07-19 |
| 7 | +License: CC0 |
| 8 | +``` |
| 9 | + |
| 10 | +## Abstract |
| 11 | + |
| 12 | +Bolt 12 introduces offers, which are static lightning "addresses". An offer can |
| 13 | +be stored and reused to pay the same node many times. It then becomes natural to |
| 14 | +associate Bolt 12 offers to your friends and contacts. |
| 15 | + |
| 16 | +When sending payments to contacts, you may want them to know that the payment |
| 17 | +came from you. We propose a scheme to deterministically derive the `payer_key` |
| 18 | +used in the `invoice_request` based on the payer and payee's offers. Nodes |
| 19 | +receiving payments can match the `payer_id` with their contact list to see if |
| 20 | +the payment came from one of their contacts. |
| 21 | + |
| 22 | +## Copyright |
| 23 | + |
| 24 | +This bLIP is licensed under the CC0 license. |
| 25 | + |
| 26 | +## Motivation |
| 27 | + |
| 28 | +This feature provides a better UX for lightning wallets, by making payments |
| 29 | +between trusted contacts look very similar to fiat payment applications. |
| 30 | + |
| 31 | +## Specification |
| 32 | + |
| 33 | +Payers derive a deterministic `payer_key` based on one of their offers, that |
| 34 | +they expect the recipient to have in their contacts list, and the offer that |
| 35 | +they are paying. |
| 36 | + |
| 37 | +### Requirements |
| 38 | + |
| 39 | +A node sending `invoice_request` for a given `offer`: |
| 40 | + |
| 41 | +- If it wants to use a deterministic `payer_key`: |
| 42 | + - MUST compute the following tweak: |
| 43 | + - `tweak = SHA256("blip42_bolt12_contacts" || offer.offer_id)`. |
| 44 | + - MUST choose one of its own offers that the recipient may know: |
| 45 | + - MUST multiply the private key used to sign invoices for this offer with `tweak`. |
| 46 | + - MUST use the resulting private key as `payer_key` to sign the `invoice_request`. |
| 47 | +- Otherwise: |
| 48 | + - SHOULD use a random `payer_key`. |
| 49 | + |
| 50 | +A node receiving `invoice_request`: |
| 51 | + |
| 52 | +- For each `offer` from its trusted contacts: |
| 53 | + - SHOULD compute the deterministic `payer_id` associated with that `offer`: |
| 54 | + - `tweak = SHA256("blip42_bolt12_contacts" || invoice_request.offer)`. |
| 55 | + - `payer_id = tweak * offer.node_id`. |
| 56 | + - SHOULD compare that `payer_id` with the `invoice_request`'s `payer_id`. |
| 57 | + - If they match: |
| 58 | + - SHOULD mark the payment as coming from this contact. |
| 59 | + - SHOULD display the `payer_note` contained in the `invoice_request`. |
| 60 | + |
| 61 | +### Rationale |
| 62 | + |
| 63 | +Nodes may compute their contacts' `payer_id`s once and store it along with that |
| 64 | +contact instead of recomputing them on-the-fly whenever a payment is received. |
| 65 | + |
| 66 | +When a payment comes from a trust contact, it is safe to display the payment's |
| 67 | +`payer_note`: otherwise it may contain spam or phishing. |
| 68 | + |
| 69 | +## Reference Implementations |
| 70 | + |
| 71 | +- lightning-kmp: <https://github.com/ACINQ/lightning-kmp/pull/690> |
0 commit comments