[Infra] Fix LNbits API version compatibility (0.12+ wallet creation) #66

Open
opened 2026-03-21 00:47:25 +00:00 by replit · 0 comments
Owner

What & Why

scripts/bitcoin-ln-node/get-lnbits-key.sh uses the pre-0.12 LNbits superuser API to create a wallet (POST /api/v1/wallet with X-Api-Key: <superuser-id>). This endpoint was removed in LNbits 0.12 (released late 2024). On a fresh install with modern LNbits, the script silently falls through to the manual instructions section without explaining why automation failed, leaving the operator confused.

Done looks like

  • Running the script on LNbits 0.12+ prints a clear message explaining the admin UI path (http://localhost:5000/admin) and what to do there, instead of silently failing
  • Running on LNbits < 0.12 still works via the existing API flow
  • The LNbits version is detected and printed at the start of the script
  • Script exits code 0 in both paths (manual steps needed is not an error)
  • LNBITS_URL and LNBITS_API_KEY export lines are always printed at the end as a template to paste into Replit secrets

Out of scope

  • Full automation of LNbits 0.12+ wallet creation (requires admin UI interaction)
  • Changes to setup.sh beyond adding a version compatibility note

Tasks

  1. Version detection — At script start, call GET /api/v1/health, parse server_version from JSON. Print detected version. If endpoint unreachable, print warning and fall through.
  2. Version-branched flow — If version >= 0.12, skip superuser API call; print step-by-step instructions to visit admin UI, create wallet, copy admin key, paste export lines. If version < 0.12, keep existing API automation path unchanged.
  3. Remove SQLite fallback — Remove superuser-detection logic that reads from SQLite DB file (targets wrong schema on 0.12+).
  4. Always print export template — Ensure both branches end by printing export LNBITS_URL=... and export LNBITS_API_KEY=... template lines.

Relevant files

  • scripts/bitcoin-ln-node/get-lnbits-key.sh
  • scripts/bitcoin-ln-node/setup.sh
## What & Why `scripts/bitcoin-ln-node/get-lnbits-key.sh` uses the pre-0.12 LNbits superuser API to create a wallet (`POST /api/v1/wallet` with `X-Api-Key: <superuser-id>`). This endpoint was removed in LNbits 0.12 (released late 2024). On a fresh install with modern LNbits, the script silently falls through to the manual instructions section without explaining why automation failed, leaving the operator confused. ## Done looks like - Running the script on LNbits 0.12+ prints a clear message explaining the admin UI path (`http://localhost:5000/admin`) and what to do there, instead of silently failing - Running on LNbits < 0.12 still works via the existing API flow - The LNbits version is detected and printed at the start of the script - Script exits code 0 in both paths (manual steps needed is not an error) - `LNBITS_URL` and `LNBITS_API_KEY` export lines are always printed at the end as a template to paste into Replit secrets ## Out of scope - Full automation of LNbits 0.12+ wallet creation (requires admin UI interaction) - Changes to `setup.sh` beyond adding a version compatibility note ## Tasks 1. **Version detection** — At script start, call `GET /api/v1/health`, parse `server_version` from JSON. Print detected version. If endpoint unreachable, print warning and fall through. 2. **Version-branched flow** — If version >= 0.12, skip superuser API call; print step-by-step instructions to visit admin UI, create wallet, copy admin key, paste export lines. If version < 0.12, keep existing API automation path unchanged. 3. **Remove SQLite fallback** — Remove superuser-detection logic that reads from SQLite DB file (targets wrong schema on 0.12+). 4. **Always print export template** — Ensure both branches end by printing `export LNBITS_URL=...` and `export LNBITS_API_KEY=...` template lines. ## Relevant files - `scripts/bitcoin-ln-node/get-lnbits-key.sh` - `scripts/bitcoin-ln-node/setup.sh`
replit added the lightning label 2026-03-21 00:47:25 +00:00
gemini was assigned by Rockachopa 2026-03-22 23:37:09 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: replit/timmy-tower#66