Skip to content

Conversation

@vincenzopalazzo
Copy link
Contributor

Add support for BLIP-42 contact management in BOLT12 payments. This allows
payers to optionally include contact information when paying an offer,
enabling recipients to identify the sender and establish bidirectional
payment relationships.

The invoice request can now carry two optional fields:

  • contact_secret: a 32-byte secret for mutual authentication
  • payer_offer: a compact offer allowing the recipient to pay back

Introduce three new methods to Bolt12Payment:

  • send_with_contact(): send payment with contact information
  • send_using_amount_with_contact(): same for zero-amount offers
  • create_contact_offer(): build minimal offers suitable for embedding

Extend PaymentReceived event to expose contact_secret and payer_offer
when present in incoming BOLT12 payments.

Add ContactSecrets wrapper type for UniFFI bindings compatibility.

Depends on rust-lightning BLIP-42 support (vincenzopalazzo/rust-lightning
branch macros/blip02-prep-v2).

This adds support for BLIP-42, enabling bidirectional contact
establishment between payers and payees in BOLT12 payments.

Sender side:
- Add `send_with_contact` and `send_using_amount_with_contact` methods
  to `Bolt12Payment` that accept optional `ContactSecrets` and a payer
  offer to include in the invoice request.

Receiver side:
- Extend `Event::PaymentReceived` with `contact_secret` and `payer_offer`
  fields, which are extracted from incoming BOLT12 payments when present.

The implementation is stateless - ldk-node surfaces the BLIP-42 data
to the application layer without managing contact state internally.

See BLIP-42: https://github.com/lightning/blips/blob/master/blip-0042.md

Signed-off-by: Vincenzo Palazzo <[email protected]>
Adds `create_contact_offer` method to `Bolt12Payment` that creates
compact offers suitable for BLIP-42's `payer_offer` field. These
offers have either no blinded paths or single-hop paths, making them
small enough to embed in invoice requests.

Also adds integration test for the complete BLIP-42 flow:
- Creating compact contact offers
- Sending payments with contact info
- Receiving payments with BLIP-42 fields

Signed-off-by: Vincenzo Palazzo <[email protected]>
@ldk-reviews-bot
Copy link

👋 Hi! I see this is a draft PR.
I'll wait to assign reviewers until you mark it as ready for review.
Just convert it out of draft status when you're ready for review!

@vincenzopalazzo vincenzopalazzo changed the title bolt12: add BLIP-42 contact support [RFC] bolt12: add BLIP-42 contact support Dec 29, 2025
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