NWC is pretty handy for the situations where I want a lightning wallet to interact with other apps (eg Stacker News, nostr, Fountain).
Megalithic just dropped this NWC client in Ruby:
Accept and track Bitcoin Lightning payments in your Rails app without running any Lightning infrastructure yourself. Generate Lightning invoices for your users to pay, then get notified the instant each one settles — all by talking to a Nostr Wallet Connect (NWC) service that someone else operates. The gem works with any NWC-compatible backend (Rizful, Alby Hub, Alby Cloud, CoinOs, any NIP-47 wallet service), so you're not locked into a single provider and can swap vendors by changing one environment variable.
FeaturesFeatures
- Full NIP-47 coverage —
pay_invoice,multi_pay_invoice,pay_keysend,multi_pay_keysend,make_invoice,lookup_invoice,list_transactions,get_balance,get_info,sign_message.- Notifications —
payment_receivedandpayment_sentvia kinds 23196 (NIP-04) and 23197 (NIP-44 v2), deduplicated bypayment_hash.- Both encryption schemes — NIP-44 v2 when the wallet advertises it (validated against paulmillr's test vectors), NIP-04 fallback for wallets that haven't migrated.
- Bulletproof long-running transport — 15 s ping keepalive, 5-min forced recycle, capped exponential backoff, clean SIGTERM handling. Built on async-websocket (no dead EventMachine dependency).
- Two diagnostic methods —
NwcRuby.test(info, read tests, write test if applicable) andNwcRuby.test_notifications(listen forever in a separate process). Each tells you whether your NWC code works, exercises the methods the service advertises, and flags non-conforming responses with actionable errors. Callable from IRB, a Rails console, a spec, or a rake task.