Skip to content

[RFC] offers: add bLIP 42 (Bolt 12 Contacts) PoC#8994

Draft
vincenzopalazzo wants to merge 3 commits intoElementsProject:masterfrom
vincenzopalazzo:claude/happy-poitras
Draft

[RFC] offers: add bLIP 42 (Bolt 12 Contacts) PoC#8994
vincenzopalazzo wants to merge 3 commits intoElementsProject:masterfrom
vincenzopalazzo:claude/happy-poitras

Conversation

@vincenzopalazzo
Copy link
Copy Markdown
Collaborator

Summary

PoC implementation of bLIP 42 (Bolt 12 Contacts) for Core Lightning, following the LDK reference implementation.

  • Add invreq_contact_secret (type 2000001729) and invreq_payer_offer (type 2000001731) TLV fields to invoice_request and invoice
  • Add bolt12_contact_secret() derivation matching the spec: EC point multiplication + SHA256 tagged hash
  • Payer side: fetchinvoice gains optional contact_secret and contact_offer parameters
  • Recipient side: offers_invreq_hook logs incoming contact fields
  • Unit test with both test vectors from the LDK reference implementation

What this PoC does NOT implement yet

  • invreq_payer_bip_353_name / invreq_payer_bip_353_signature fields
  • Automatic contact secret derivation via HSM (currently passed as a parameter)
  • Contact storage / database persistence
  • Automatic contact matching on the recipient side
  • xpay integration

Test plan

  • Unit test run-bolt12_contact passes both bLIP 42 test vectors
  • Integration test with two CLN nodes exchanging contact-enriched payments
  • Interop test with LDK reference implementation

Add support for the bLIP 42 contact protocol which allows payers to
optionally reveal their identity and offer when paying a contact.

Wire format:
- invreq_contact_secret (type 2000001729): 32-byte contact identifier
  derived via ECDH between the two offers' node keys
- invreq_payer_offer (type 2000001731): TLV-encoded payer offer for
  pay-back capability

Both fields are added to invoice_request and invoice TLV definitions.

Payer side (fetchinvoice):
- New optional `contact_secret` and `contact_offer` params
- When provided, includes bLIP 42 fields in the invoice_request

Recipient side (offers_invreq_hook):
- Logs incoming contact fields at LOG_INFORM level

Contact secret derivation (common/bolt12_contact.c):
- EC point multiplication + SHA256 tagged hash matching the spec
- Unit test with both bLIP 42 test vectors from the LDK reference

Changelog-Added: offers: PoC implementation of bLIP 42 (Bolt 12 Contacts)
The header is already included via bolt12_contact.h, so the .c file
doesn't need to include it again. Fixes check-includes CI failure.
Remove wire/onion_wiregen.o dependency and provide stubs for
blinded_path and sciddir_or_pubkey wire functions instead. This
avoids pulling in transitive deps that cause linker failures
on macOS (missing siphash_seed).
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.

1 participant