Getting started with Lightning on the web

LNURL, WebLN & more

LNURL

  • spec for lightning actions via an encoded URL

  • actions can be i.e.

    • payment

    • auth, …

  • encoded server-URL can be decoded by i.e. a "wallet"

  • client can talk to related server to get detailed info

  • helps interacting with the lightning-node

LNURL (bech-32 encoded)

lnurl1dp68gurn8ghj7um5v93kketj9ehx2amn9ashq6f0d3hxzat5dqlhgct884kx7emfdcnxkvfavvurxdtyxy6xzcfjvvexywpsxsmn2vejxyen2erxvvmkxcmxx4jnsefnxucrvcfhvc6rwvrpvfsk2wpsx3nxvdf3xgckvdphvgcrgcgs3mh8z
lightning:LNURL1DP68GURN8GHJ7MRWW4EXCTNXD9SHG6NPVCHXXMMD9AKXUATJDSKHQCTE8AEK2UMND9HKU0F5XQCXYVTYX33K2WFK8QEKGD3CXPNRQDPHXUEXZWR9VVCNQCT98QENJDM9XPNXZCEJXGCRQETYV5URZVPHVCCNYVRPVSUN2CEJXVEN28TEXSD

LNURL (decoded)

https://stacker.news/api/lnauth?tag=login&k1=c835d14aa2c2b8047532135dfc7ccf5e8e3706a7f470abae804ff5121f47b04a
https://lnurl.fiatjaf.com/lnurl-pay?session=400b1d4ce9683d680f04772a8ec10ae8397e0fac2200ede8107f120ad95c2335

LNURL Types (Actions)

LNURL Response

JSON with details specific to the action

{
    "callback": string, // The URL from LN SERVICE which will accept the pay request parameters
    "maxSendable": number, // Max millisatoshi amount LN SERVICE is willing to receive
    "minSendable": number, // Min millisatoshi amount LN SERVICE is willing to receive
    "metadata": string, // Metadata json which must be presented as raw string here
    "tag": "payRequest" // Type of LNURL
}

For LNURLpay. I.e.:

GET request with "amount" to the callback to pay

LNURL

  • spec for lightning actions via an encoded URL

  • actions can be i.e.

    • payment

    • auth, …

  • encoded server-URL can be decoded by i.e. a "wallet"

  • client can talk to related server to get detailed info

  • helps interacting with the lightning-node

  • Also paste a LNURL here for detailed info:
    https://www.bolt11.org

Lightning Address

Lightning Address

Lightning Address

Lightning Address

Lightning Links

<a href="lightning:bumi@getalby.com">Send sats to bumi</a>
<a href="lightning:LNURL1DP68GURN8GHJ7MRWW4E...NYVRPVSUN2CEJXVEN28TEXSD">
   This is a lightning link
</a>

WebLN

  • WebLN extends websites with events which help to interact with the lightning-network

  • Short: lightning-actions can be triggered from a webpage and a wallet can pick this up

  • No QR codes or copy/paste needed

WebLN

Example:

  • Open devtools on a supported page

  • Type: “window.webln”

  • Result: “WebLNProvider {enabled: false, isEnabled: false, executing: false}”

  • Type: “await window.webln.enable()”

  • Type: “await window.webln.lnurl('LNURL...')”

LSAT

Lightning Service Authentication Token

Makes HTTP code "402 Payment Required" work

LSAT

  1. GET request to a unpaid file resolves in 402
    ...including an invoice

  2. Invoice will be paid

    ...resolves in success including the “preimage”

  3. GET request to a paid file resolves in 200

    ...including the “preimage”

What now?

  • Ask questions
  • Build things
  • Support WebLN in existing projects
  • Contribute

Getting started with Lightning on the web

By hannes

Getting started with Lightning on the web

  • 318