Skip to content

lnbits/spark_sidecar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spark L2 sidecar

This sidecar exposes a small HTTP API for LNbits to talk to the Spark L2 SDK.

Install

cd lnbits/wallets/sidecars/spark
npm install

Run

SPARK_MNEMONIC="bottom bottom bottom bottom bottom bottom bottom bottom bottom bottom bottom bottom" \
SPARK_NETWORK=MAINNET \
SPARK_SIDECAR_PORT=8765 \
SPARK_PAY_WAIT_MS=20000 \
node server.mjs

Optional auth:

SPARK_SIDECAR_API_KEY="mykey"

Set the same key in LNbits as SPARK_L2_API_KEY.

Endpoints

  • POST /v1/balance
  • POST /v1/invoices
  • POST /v1/payments
  • GET /v1/invoices/stream (SSE stream of paid Lightning receive requests)
  • GET /v1/invoices/{id}
  • GET /v1/payments/{id}

Invoice Stream

The stream endpoint emits Server-Sent Events when a Lightning invoice is paid.

Example:

curl -N http://127.0.0.1:8765/v1/invoices/stream

Each event payload is a JSON object:

{"checking_id":"<receive_request_id>","payment_hash":"<hash>","status":"LIGHTNING_PAYMENT_RECEIVED"}

Optional tuning:

  • SPARK_STREAM_KEEPALIVE_MS (default 15000)
  • SPARK_STREAM_HEARTBEAT_MS (default 30000)
  • SPARK_TRANSFER_LOOKUP_CONCURRENCY (default 20)
  • SPARK_TRANSFER_QUEUE_MAX (default 5000)
  • SPARK_INVOICE_POLL_MS (default 2000)
  • SPARK_INVOICE_POLL_LIMIT (default 100)
  • SPARK_INVOICE_CACHE_TTL_MS (default 3600000)

About

Simple sidecar for Spark L2

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published