Skip to content

Instantly share code, notes, and snippets.

@bnonni
Last active October 25, 2022 18:30
Show Gist options
  • Save bnonni/29aa4ada2edf3fa1259cd90757e52bd8 to your computer and use it in GitHub Desktop.
Save bnonni/29aa4ada2edf3fa1259cd90757e52bd8 to your computer and use it in GitHub Desktop.
Bitcoin Reading Group: Onion Messages Demystified

Bitcoin Reading Group: Onion Messages Demystified

October 25, 2022

Topic: LDK Onion Messages & bolt12 [link]

  • LDK merges support for onion messages
  • Onion messages are a precursor to bolt12 offers
  • Step towards deprecating support for bolt11 in favor of offers
  • What are Onion Messages?
    • Simple messages sent btwn peers via onion routing (TOR)
    • Can be sent via blinded routes
    • Blinded routes offer more privacy to the recipient
    • Originally purposed for offers
    • OM + PTLC => async LN payments (receiver offline)
    • OM + ? => ?!?!
  • What are Blinded Routes?
    • Recipient (A) constructs “blinded” route to self for use by Sender (B)
    • A selects well-connected node (P) to route through
    • A constructs encrypted blobs for each node on route from A to P leaving the popular node id unencrypted
    • P node effectively becomes bridge between sender/receiver
    • Message destination could be any node within 2 hops of popular node
    • A provides blinded route data to B
    • B finds route to P
    • B constructed encrypted blobs for each node on route to P + blinded route to A (can include invoice)
  • What are bolt12 offers?
    • Allow for static invoices
    • Refund functionality: send invoice offer, receiver wallet sends invoice to vendor, vendor pays(e.g. ATM or refund)
    • Receiver privacy (don’t reveal node ID or UTXOs)
    • Subscriptions via offer extensions
  • What are async LN payments?
    • Mobile wallets need to be open in foreground
    • All mobile wallets likely using LSPs
    • OM allows sender LSP to hold payment until recipient LSP sends OM to sender LSP indicating that recipient is online
    • Only locked liquidity is senders
  • What about spam!?
    • Can rate limit peers
    • E.g. few kilobytes of OMs per second
    • Can restrict fwd’d messages to channel peers only
    • Forces attacker to open channels to all nodes they want to DoS – expensive!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment