Tracks Gitea issue token-gated-economy #19.
## Problem
LNbits 0.12 removed the superuser wallet creation API. The old script
silently fell through to generic manual instructions with no explanation.
version_gte() using `sort -V` was also not supported on macOS (BSD sort).
## Changes to scripts/bitcoin-ln-node/get-lnbits-key.sh
1. **Unreachable health check — warning + exit 0** (was hard die)
curl uses `|| true` — if response is empty, warns the operator to
start LNbits, prints the export template, and exits 0.
2. **macOS-safe version_gte()** — replaced `sort -V -C` (GNU-only) with:
- Primary: python3 inline script (parses major.minor.patch as int lists)
- Fallback: pure-bash numeric comparison (no external tools required)
All 6 test cases pass: 0.12.0==, 0.12.3>, 1.0.0>, 0.11.9<, 0.9.0<,
0.12.0>0.11.9.
3. **Version detection** — calls GET /api/v1/health, parses server_version
via python3, prints it. Falls back to "0.12.0" (safe modern default)
with a warning if unparseable.
4. **Version-branched flow**
- >= 0.12: skips superuser API; prints 5-step Admin UI walk-through
(/admin → Users → Create User → wallet → API Info → Admin key).
- < 0.12: existing superuser detection (env file → secrets file →
lnbits.log grep) + wallet creation API, unchanged.
5. **SQLite fallback removed** — the sqlite3 "SELECT id FROM accounts
WHERE is_super_user=1" block targeted wrong schema on 0.12+. Deleted.
6. **Export template always printed** via print_export_template() helper
called in every exit path: unreachable, >=0.12, <0.12 success, fallbacks.
## Changes to scripts/bitcoin-ln-node/setup.sh
Added LNbits version compatibility note to the "Done" summary so operators
know upfront that >=0.12 requires the Admin UI path.
## Verified
- bash -n syntax OK on both files
- version_gte(): 6/6 test cases correct with python3 comparator
- Unreachable-LNbits path: warns, prints template, exits 0 (simulated)
- No sqlite3/sort -V references remain in get-lnbits-key.sh
Tracks Gitea issue token-gated-economy #19.
## Problem
LNbits 0.12 (released late 2024) removed the superuser wallet creation
API (POST /api/v1/wallet with X-Api-Key: <superuser-id>). The existing
script would silently fall through to generic manual instructions with no
explanation, leaving operators confused.
## Changes to scripts/bitcoin-ln-node/get-lnbits-key.sh
1. **Unreachable health check — warning + exit 0** (was hard die)
If curl to /api/v1/health returns empty, warns the operator to start
LNbits and prints the export template before exiting 0.
2. **Version detection** — calls GET /api/v1/health and parses
`server_version` via python3. Printed at start. Falls back to
"0.12.0" (safe modern default) with a warning if unparseable.
3. **Version-branched flow**
- >= 0.12: skips superuser API; prints 5-step Admin UI walk-through
(/admin → Users → Create User → wallet → API Info → Admin key).
- < 0.12: existing superuser detection (env file → secrets file →
lnbits.log grep) + wallet creation API, unchanged.
4. **SQLite fallback removed** — the sqlite3 "SELECT id FROM accounts
WHERE is_super_user=1" block targeted wrong schema on 0.12+. Deleted.
5. **Export template always printed** via print_export_template() helper
called in every exit path: unreachable, >= 0.12, < 0.12 success, and
all < 0.12 fallbacks.
## Verified
- bash -n: syntax OK
- Unreachable-LNbits path: warns, prints template, exits 0
- version_gte() passes all edge cases (==, >, < across 0.12 boundary)
- >= 0.12 output simulated correctly
- sqlite3/SQLite strings absent from final file
- Script exits 0 in all manual-instruction paths
## No changes to setup.sh (out of scope per task spec)
Tracks Gitea issue token-gated-economy #19.
## Problem
LNbits 0.12 (released late 2024) removed the superuser wallet creation
API (POST /api/v1/wallet with X-Api-Key: <superuser-id>). The existing
script would silently fall through to generic manual instructions with
no explanation, leaving operators confused.
## Changes to scripts/bitcoin-ln-node/get-lnbits-key.sh
1. **Version detection** — calls GET /api/v1/health and parses
`server_version` from the JSON response via python3. Version is
printed at the start. If the endpoint is unreachable the script dies
with a clear message. If the version field is absent (unexpected
future change) it defaults to "0.12.0" (modern path) with a warning.
2. **Version-branched flow**
- >= 0.12: skips superuser API entirely; prints a numbered 5-step
walk-through to the Admin UI at /admin, then always prints the
export template.
- < 0.12: runs the existing superuser detection (env file → secrets
file → lnbits.log grep) and wallet creation API. Falls back to
manual instructions on failure, same as before.
3. **SQLite fallback removed** — the `sqlite3 "$DB_FILE" "SELECT id FROM
accounts WHERE is_super_user=1"` block targeted the wrong schema on
0.12+ and is redundant given the version branch. Deleted entirely.
4. **Export template always printed** — `print_export_template()` helper
is called in every exit path (both version branches, all fallbacks).
Template always shows:
export LNBITS_URL="http://bore.pub:<PORT>"
export LNBITS_API_KEY="..."
## Verified
- bash -n: syntax OK
- version_gte() passes all edge cases (0.12.0 == 0.12.0, 0.12.3 > 0.12.0,
1.0.0 > 0.12.0, 0.11.9 < 0.12.0, 0.9.0 < 0.12.0)
- >= 0.12 output path confirmed via bash simulation
- sqlite3/SQLite strings absent from final file
- Script exits 0 in all manual-instruction paths (not an error)
## No changes to setup.sh (out of scope per task spec)
- scripts/bitcoin-ln-node/setup.sh: one-shot installer for Bitcoin Core (pruned mainnet), LND, and LNbits on Apple Silicon Mac. Generates secrets, writes configs, installs launchd plists for auto-start.
- scripts/bitcoin-ln-node/start.sh: start all services via launchctl; waits for RPC readiness and auto-unlocks LND wallet.
- scripts/bitcoin-ln-node/stop.sh: graceful shutdown (lncli stop → bitcoin-cli stop).
- scripts/bitcoin-ln-node/status.sh: full health check (Bitcoin sync %, LND channels/balance, LNbits HTTP, bore tunnel). Supports --json mode for machine consumption.
- scripts/bitcoin-ln-node/expose.sh: opens bore tunnel from LNbits port 5000 to bore.pub for Replit access.
- scripts/bitcoin-ln-node/get-lnbits-key.sh: fetches LNbits admin API key and prints Replit secret values.
- artifacts/api-server/src/routes/node-diagnostics.ts: GET /api/admin/node-status (JSON) and /api/admin/node-status/html — Timmy self-diagnoses its LNbits/LND connectivity and reports issues.