- Python 52.6%
- HTML 36.5%
- JavaScript 10%
- Makefile 0.9%
Adds an optional `extra` (JSON) field to a withdraw link. When the link
is claimed, that `extra` is merged onto the payout payment's `extra`, so
a caller can tag the resulting payment with metadata an external listener
keys on — the link is the only place to attach it (the customer-facing
LNURL-withdraw payout otherwise carries just `{tag, withdrawal_link_id}`).
Motivating use: bitSpire cash-in settlements. The operator's spirekeeper
listener fires a `cash_in` settlement (fee split to the platform) only on
an outbound payment stamped `source=bitspire`; before this there was no
way to stamp an LNURL-withdraw payout, so cash-ins never settled. bitSpire
now creates the cash-in link for the NET amount with
`extra={source, type:cash_in, principal_sats, fee_sats, ...}` and the
settlement fires on claim.
- models: `extra: dict | None` on CreateWithdrawData + WithdrawLink.
LNbits' db layer (de)serializes dict columns to/from JSON natively
(same as Payment.extra) — no per-field validator needed.
- migrations_fork.py: `withdraw_link.extra TEXT` under `withdraw_fork`,
keeping the upstream-tracked migrations.py byte-identical for clean
rebases (aiolabs/lnbits#8 pattern).
- views_lnurl: `extra={**(link.extra or {}), "tag": ..., "withdrawal_link_id": ...}`
— the withdraw extension's own keys are written last so a caller cannot
clobber them.
Verified end-to-end on the dev stack: a stamped link's payout carries the
merged extra and drives a spirekeeper cash_in settlement + super-fee payout.
|
||
|---|---|---|
| .github/workflows | ||
| static | ||
| templates/withdraw | ||
| tests | ||
| .gitignore | ||
| .pre-commit-config.yaml | ||
| .prettierrc | ||
| __init__.py | ||
| config.json | ||
| crud.py | ||
| description.md | ||
| helpers.py | ||
| LICENSE | ||
| Makefile | ||
| manifest.json | ||
| migrations.py | ||
| migrations_fork.py | ||
| models.py | ||
| package-lock.json | ||
| package.json | ||
| pyproject.toml | ||
| README.md | ||
| toc.md | ||
| transport_rpcs.py | ||
| uv.lock | ||
| views.py | ||
| views_api.py | ||
| views_lnurl.py | ||
LNURLw - LNbits extension
For more about LNBits extension check this tutorial
Create a static QR code people can use to withdraw funds from a Lightning Network wallet
LNURL is a range of lightning-network standards that allow us to use lightning-network differently. An LNURL withdraw is the permission for someone to pull a certain amount of funds from a lightning wallet.
The most common use case for an LNURL withdraw is a faucet, although it is a very powerful technology, with much further reaching implications. For example, an LNURL withdraw could be minted to pay for a subscription service. Or you can have a LNURLw as an offline Lightning wallet (a pre paid "card"), you use to pay for something without having to even reach your smartphone.
LNURL withdraw is a very powerful tool and should not have his use limited to just faucet applications. With LNURL withdraw, you have the ability to give someone the right to spend a range, once or multiple times. This functionality has not existed in money before.
Usage
Quick Vouchers
LNbits Quick Vouchers allows you to easily create a batch of LNURLw's QR codes that you can print and distribute as rewards, onboarding people into Lightning Network, gifts, etc...
- Create Quick Vouchers
- select wallet
- set the amount each voucher will allow someone to withdraw
- set the amount of vouchers you want to create - have in mind you need to have a balance on the wallet that supports the amount * number of vouchers
- You can now print, share, display your LNURLw links or QR codes
- Bonus: you can use an LNbits themed voucher, or use a custom one. There's a template.svg file in
static/imagesfolder if you want to create your own.

Advanced
- Create the Advanced LNURLw
- set the wallet
- set a title for the LNURLw (it will show up in users wallet)
- define the minimum and maximum a user can withdraw, if you want a fixed amount set them both to an equal value
- set how many times can the LNURLw be scanned, if it's a one time use or it can be scanned 100 times
- LNbits has the "Time between withdraws" setting, you can define how long the LNURLw will be unavailable between scans
- you can set the time in seconds, minutes or hours
- the "Use unique withdraw QR..." reduces the chance of your LNURL withdraw being exploited and depleted by one person, by generating a new QR code every time it's scanned
- Print, share or display your LNURLw link or it's QR code

LNbits bonus: If a user doesn't have a Lightning Network wallet and scans the LNURLw QR code with their smartphone camera, or a QR scanner app, they can follow the link provided to claim their satoshis and get an instant LNbits wallet!

