Skip to content

taylanbtc/blink-nwc

Repository files navigation

Blink NWC Bridge

A browser-based Nostr Wallet Connect (NWC) bridge for Blink wallet users. Generate a nostr+walletconnect:// connection string and use your Blink wallet in any NWC-compatible app -- Damus, Amethyst, Primal, and more.

What This Does

Blink does not natively expose NWC connection strings. This app bridges that gap:

  1. You enter your Blink API key
  2. The app generates a valid NWC connection string (with QR code)
  3. You paste/scan it in your favorite Nostr client
  4. The app keeps running in your browser, proxying NWC requests to the Blink API

The app acts as a wallet service per the NIP-47 specification. It listens on a Nostr relay for encrypted requests from your NWC client, translates them into Blink GraphQL API calls, and sends encrypted responses back.

Supported NWC Methods

Method Description
get_info Returns wallet alias and supported methods
get_balance Returns BTC wallet balance (in millisats)
pay_invoice Pays a BOLT11 lightning invoice
make_invoice Creates a new lightning invoice
list_transactions Lists recent transactions
lookup_invoice Looks up a specific invoice by payment hash

Setup

Prerequisites

  • Node.js 18+
  • A Blink account with an API key (get one here)

Install and Run

cd blink-nwc

# Install dependencies
npm install

# Start development server
npm run dev

The app will be available at http://localhost:5173.

Production Build

npm run build
npm run preview

The built files are in dist/ and can be deployed to any static hosting (Vercel, Netlify, GitHub Pages, etc).

Usage

  1. Open the app in your browser
  2. Paste your Blink API key (from dashboard.blink.sv)
  3. The app validates your key and generates an NWC connection string
  4. Copy the string or scan the QR code in your Nostr app:
    • Damus: Settings > Wallet > Nostr Wallet Connect > paste the string
    • Amethyst: Settings > Wallet > NWC > paste the string
    • Primal: Settings > Wallet > NWC > paste the string
  5. Keep the browser tab open -- it must stay running to relay NWC requests

Architecture

Damus/Amethyst/Primal (NWC client)
  |
  | kind 23194 (encrypted request)
  v
Nostr Relay (wss://relay.getalby.com/v1)
  |
  | WebSocket subscription
  v
Blink NWC Bridge (this app, running in your browser)
  |
  | GraphQL API call
  v
Blink API (https://api.blink.sv/graphql)
  |
  | response
  v
Blink NWC Bridge
  |
  | kind 23195 (encrypted response)
  v
Nostr Relay -> Damus/Amethyst/Primal

Security

  • Your Blink API key is stored only in browser memory (never localStorage, never sent to third parties)
  • All NWC communication is NIP-04 encrypted end-to-end
  • The NWC keypairs are generated fresh each session
  • Closing the tab destroys all keys and state
  • The app makes no server-side calls -- everything runs client-side

Tech Stack

  • React + TypeScript + Vite
  • Tailwind CSS v4
  • nostr-tools (Nostr protocol, NIP-04 encryption)
  • qrcode.react (QR code display)
  • Blink GraphQL API

Configuration

Variable Description Default
Relay URL Nostr relay for NWC wss://relay.getalby.com/v1

The relay URL is hardcoded to Alby's NWC-optimized relay. This can be changed in src/services/nwcService.ts.

Limitations

  • The browser tab must remain open for the bridge to work
  • NWC keypairs are regenerated each session (you need a new connection string each time)
  • Only BTC wallet is supported (not USD)
  • Pay_invoice does not return the preimage (Blink API limitation)
  • NIP-04 encryption only (NIP-44 not yet implemented)

License

MIT

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages