get-lnbits-key.sh targets deprecated LNbits API (pre-0.12) — wallet creation fails on fresh installs #19

Closed
opened 2026-03-18 22:22:59 +00:00 by replit · 1 comment
Owner

Context

scripts/bitcoin-ln-node/get-lnbits-key.sh attempts to create a Timmy wallet via the LNbits superuser API (POST /api/v1/wallet with X-Api-Key: <superuser-id>). This pattern was removed in LNbits 0.12 (released late 2024). LNbits 0.12+ uses a different account model managed via /admin, and the SQLite superuser-detection fallback reads the wrong schema on 0.12+.

The script silently falls through to manual instructions without telling the user why automation failed.

Requirements

  1. Detect LNbits version at runtime via GET /api/v1/health (returns server_version)
  2. For LNbits >= 0.12: skip the API creation attempt, print clear instructions to visit $LNBITS_LOCAL/admin, create a wallet, and paste the admin key
  3. For LNbits < 0.12 (legacy): keep the existing superuser API flow
  4. Remove the SQLite superuser-detection fallback (wrong schema on 0.12+)
  5. Always print LNBITS_URL and LNBITS_API_KEY template lines at the end regardless of path

Acceptance Criteria

  • Running get-lnbits-key.sh on LNbits 0.12+ prints the admin UI path clearly, not a silent failure
  • Running get-lnbits-key.sh on LNbits < 0.12 still works via the old API
  • LNbits version is printed at the start of the script
  • Script exits with code 0 in both paths
  • LNBITS_API_KEY and LNBITS_URL template lines are always printed

Files

  • scripts/bitcoin-ln-node/get-lnbits-key.sh
  • scripts/bitcoin-ln-node/setup.sh (add version compatibility note)
## Context `scripts/bitcoin-ln-node/get-lnbits-key.sh` attempts to create a Timmy wallet via the LNbits superuser API (`POST /api/v1/wallet` with `X-Api-Key: <superuser-id>`). This pattern was **removed in LNbits 0.12** (released late 2024). LNbits 0.12+ uses a different account model managed via `/admin`, and the SQLite superuser-detection fallback reads the wrong schema on 0.12+. The script silently falls through to manual instructions without telling the user why automation failed. ## Requirements 1. Detect LNbits version at runtime via `GET /api/v1/health` (returns `server_version`) 2. For LNbits >= 0.12: skip the API creation attempt, print clear instructions to visit `$LNBITS_LOCAL/admin`, create a wallet, and paste the admin key 3. For LNbits < 0.12 (legacy): keep the existing superuser API flow 4. Remove the SQLite superuser-detection fallback (wrong schema on 0.12+) 5. Always print `LNBITS_URL` and `LNBITS_API_KEY` template lines at the end regardless of path ## Acceptance Criteria - [ ] Running `get-lnbits-key.sh` on LNbits 0.12+ prints the admin UI path clearly, not a silent failure - [ ] Running `get-lnbits-key.sh` on LNbits < 0.12 still works via the old API - [ ] LNbits version is printed at the start of the script - [ ] Script exits with code 0 in both paths - [ ] `LNBITS_API_KEY` and `LNBITS_URL` template lines are always printed ## Files - `scripts/bitcoin-ln-node/get-lnbits-key.sh` - `scripts/bitcoin-ln-node/setup.sh` (add version compatibility note)
replit added the hermesinfra labels 2026-03-19 19:34:13 +00:00
claude was assigned by Rockachopa 2026-03-22 23:38:27 +00:00
Collaborator

PR #53 created.

The root cause: the script used /api/v1/health for both reachability testing and version detection. Since that endpoint only exists on LNbits 0.12+, pre-0.12 instances were incorrectly reported as "not reachable" instead of falling through to the legacy superuser API path.

Fix separates reachability (GET /) from version detection (/api/v1/health). When the health endpoint is absent, the script now correctly assumes pre-0.12 and tries the superuser wallet creation flow.

PR #53 created. The root cause: the script used `/api/v1/health` for both reachability testing and version detection. Since that endpoint only exists on LNbits 0.12+, pre-0.12 instances were incorrectly reported as "not reachable" instead of falling through to the legacy superuser API path. Fix separates reachability (GET /) from version detection (/api/v1/health). When the health endpoint is absent, the script now correctly assumes pre-0.12 and tries the superuser wallet creation flow.
This repo is archived. You cannot comment on issues.