Skip to content
Skills Library
Programming · Building & coding

lightning-lnurl

/lightning-lnurl

LNURL: bech32-encoded HTTP URL fetched by wallet to enable payment flows. LUDs (LNURL specs): LUD-01 (encoding), LUD-04 (auth), LUD-06 (pay), LUD-09 (success action), LUD-12 (comment), LUD-16 (lightning address), LUD-21 (verify). USE WHEN: implementing LNURL servers/clients, building Lightning Address resolver, designing pay/withdraw/auth flows.

Licence
MIT
Last repository change
21.10.2026

Assessment and security

95/ 100Class: good
Format20 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
5
Deprecation

No signals detected. Repository changed on 21.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

LNURL: bech32-encoded HTTP URL fetched by wallet to enable payment flows. LUDs (LNURL specs): LUD-01 (encoding), LUD-04 (auth), LUD-06 (pay), LUD-09 (success action), LUD-12 (comment), LUD-16 (lightning address), LUD-21 (verify). USE WHEN: implementing LNURL servers/clients, building Lightning Address resolver, designing pay/withdraw/auth flows.

Original author description

LNURL: bech32-encoded HTTP URL fetched by wallet to enable payment flows. LUDs (LNURL specs): LUD-01 (encoding), LUD-04 (auth), LUD-06 (pay), LUD-09 (success action), LUD-12 (comment), LUD-16 (lightning address), LUD-21 (verify). USE WHEN: implementing LNURL servers/clients, building Lightning Address resolver, designing pay/withdraw/auth flows.

How it works

  1. Encoding (LUD-01)
  2. Common LNURL types
  3. URL hashing for invoice metadata
  4. Flow example: LNURL-pay end to end
  5. Security considerations
  6. Implementation libraries
  7. Common bugs
  8. See also
Original SKILL.md headings · 142 lines, 488 words
SKILL.md preview
---
name: lightning-lnurl
description: |
  LNURL: bech32-encoded HTTP URL fetched by wallet to enable payment
  flows. LUDs (LNURL specs): LUD-01 (encoding), LUD-04 (auth), LUD-06
  (pay), LUD-09 (success action), LUD-12 (comment), LUD-16 (lightning
  address), LUD-21 (verify).
  USE WHEN: implementing LNURL servers/clients, building Lightning
  Address resolver, designing pay/withdraw/auth flows.
allowed-tools: Read, Grep, Glob
---

# LNURL

LNURL is a set of protocols for using Lightning via HTTP-mediated
flows. Wallet scans a bech32-encoded URL, fetches a JSON descriptor,
then follows the workflow indicated.

Specs (LUDs) live at `github.com/lnurl/luds`.

## Encoding (LUD-01)

```
LNURL = bech32(hrp="lnurl", data=URL bytes)
```

Example URL `https://example.com/pay/123` →
`LNURL1DP68GURN8GHJ7MR9VAJKUEPWD3HXY6T5WVHXXMMD9AKXUATJDSKHQCT5`

Wallets scan QR with `LNURL...` prefix or `lightning:LNURL...` URI.

## Common LNURL types

### LUD-04: LNURL-auth

Login via Lightning. Server issues challenge, wallet signs with
derived key per server, server verifies.
- Stateless: server's pubkey derived from `challenge_response`.
- Per-domain key derivation: `derive_lnurl_key(seed, domain)` →
  same wallet's "identity" with same domain across sessions.

Use case: account login / OAuth-like.

### LUD-06: LNURL-pay

Wallet fetches metadata:
```json
{
  "tag": "payRequest",
  "minSendable": 1000,
  "maxSendable": 100000000,
  "metadata": "[[\"text/plain\",\"Coffee\"]]",
  "callback": "https://example.com/lnurl/pay/123/callback",
  "commentAllowed": 200
}
```

User chooses amount, optional comment, then GETs callback:
```
GET /callback?amount=5000&comment=Thanks
→ { "pr": "lnbc50u1...", "successAction": {...} }
```

Wallet pays the BOLT11 invoice. After success, optionally show
`successAction` (URL, message, AES-encrypted message).

### LUD-09: Success Action

After payment success:
- `message`: text to show user.
- `url`: redirect (e.g., download link).
- `aes`: encrypted blob decrypted by preimage.

### LUD-12: Comment

If `commentAllowed > 0`, payer can attach a free-form text comment
to the payment.

### LUD-16: Lightning Address

`user@domain.com` — see [lightning-address/SKILL.md](../lightning-address/SKILL.md).
Resolves to `https://domain.com/.well-known/lnurlp/user`, returns
LNURL-pay metadata.

### LUD-21: Verify

Allow client to verify payment status post-pay:
```
GET /callback/verify/<payment_hash>
→ { "settled": true, "preimage": "..." }
```

### LUD-XX: LNURL-withdraw

Server pre-funds a withdrawal. User scans, wallet calls callback,
server pays the wallet's invoice. Used for faucets, refunds, voucher
redemption.

## URL hashing for invoice metadata

LNURL-pay binds the metadata to the invoice via:
```
description_hash = SHA256(metadata_json_string)
```

The BOLT11 invoice has tag `h` (description_hash) instead of `d`
(description). Wallet verifies that the displayed metadata matches.

## Flow example: LNURL-pay end to end

```
1. User scans QR → wallet decodes → URL = https://merchant.com/pay/abc
2. GET https://merchant.com/pay/abc
   → { tag: "payRequest", minSendable, maxSendable, metadata, callback, ... }
3. Wallet shows description (from metadata), user picks amount.
4. GET <callback>?amount=<msat>
   → { pr: "lnbc...", successAction }
5. Wallet decodes pr, verifies description_hash == SHA256(metadata_json).
6. Wallet pays the invoice.
7. After success, wallet shows successAction.
```

## Security considerations

- Always verify `description_hash`. Otherwise server could swap
  metadata mid-flow.
- `successAction.url` should be on the same domain as the callback
  (mitigate phishing).
- LNURL-auth: per-domain derivation prevents replay across services.

## Implementation libraries

- **LNURL.js** — Node/browser.
- **lnurl-rust** — Rust.
- **pylnurl** — Python.
- **BTCPay Server**, **LNbits**, **Phoenix**, **Mutiny** — built-in
  client/server.

## Common bugs

- Skipping description_hash verification → MITM swaps invoice
  description silently.
- Comment too long (>commentAllowed) → server rejects, payment fails.
- Treating LNURL as a wallet address — it's a URL, not a pubkey.
- Fetching callback with HTTP (not HTTPS) on production → MITM risk.

## See also

- [lightning-address/SKILL.md](../lightning-address/SKILL.md)
- [bolt12/SKILL.md](../bolt12/SKILL.md)
- [webln/SKILL.md](../webln/SKILL.md)
- [nwc/SKILL.md](../nwc/SKILL.md)

Versions

The database has no other skills named lightning-lnurl.

Database snapshot: 13.11.2026 · package version 7b51414a29cf (SHA-256 digest of the entire package)

Downloads in the last 30 days: 3 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100lightning-address
    Lightning Address (LUD-16): email-style identifier resolving to LNURL-pay endpoint. user@domain.com → /.well-known/lnurlp/user. Also covers BIP 353 DNS payment instructions (₿user@domain, DNSSEC TXT record) and bLIP-32 onion-message DNS resolution. USE WHEN: building/registering…
  • 100navigate-nostr
    Navigate the Nostr protocol ecosystem and find the right specifications, repositories, and resources. Use to look up NIPs, discover event kinds, find LNURL and Lightning specs, locate Blossom media docs, understand eCash/Cashu on Nostr, and identify which nostr-core modules…
  • 95bitcoin-libraries-bolt11
    bolt11 decoder libraries: parse / encode BOLT11 Lightning invoices in JS, Python, Rust, Go. USE WHEN: parsing LN invoices in app code, building Lightning payment flows.
  • 100wosbot
    Read the balance and history of a Wallet of Satoshi wallet, create Lightning invoices that pay it, and ask its owner to make Lightning payments, each of which they approve in their app. Use when the user gives you a WosBot connection string (an address ending in /mcp/wosbot_...…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.