Skip to content

feat: Lightning Wallet (NWC) — link, send, receive, pay cards, receive-only agents#2635

Closed
marcopesani wants to merge 3 commits into
block:mainfrom
marcopesani:feat/lightning-wallet-nwc
Closed

feat: Lightning Wallet (NWC) — link, send, receive, pay cards, receive-only agents#2635
marcopesani wants to merge 3 commits into
block:mainfrom
marcopesani:feat/lightning-wallet-nwc

Conversation

@marcopesani

Copy link
Copy Markdown

Lightning Wallet (NWC)

Implements docs/lightning-wallet-nwc.md: every user (and, receive-only, every agent) can link an external Lightning wallet over NIP-47 Nostr Wallet Connect. Buzz never holds funds — money moves client-side between the user's wallet service and the wallet's relay.

Scope: Rust domain + buzz-wallet crate, NWC/LNURL adapters, a local mock NWC wallet for e2e, event kinds 40009/40010 + relay ingest + users.lud16, Tauri backend, desktop UI, buzz wallet CLI, receive-only agent provisioning. Mobile (Flutter) is deferred to a follow-up PR; this PR ships the shared conformance vectors (testdata/wallet/) it will consume.

Each unit below lands as its own commit only after an independent verificator run (tests re-run, acceptance scenarios mapped to named tests, fmt/clippy clean). Proof bundles (logs, scenario→test tables, screenshots) are posted as PR comments and linked here as they land.

Unit checklist

Unit Description Status Proof
U0 Branch + draft PR done this description
U1 buzz-core payment domain (Amount, verify, validation, kinds 40009/40010, shared vectors) pending
U2 buzz-wallet ports + WalletError + scriptable fakes + in-memory PaymentStore (claim_paying) pending
U3 link + receive_mode use-cases pending
U4 Two-phase send (prepare_send/confirm/cancel), bolt11 decode + validation pending
U5 Payment lifecycle state machine + reconcile + check_incoming pending
U6 NwcWalletService (nwc 0.44) + HttpLnurlResolver + capturing-HTTP adapter tests pending
U7 buzz-mock-wallet — local NWC wallet (loopback relay + daemon, real bolt11/preimages) pending
U8 SDK builders 40009/40010, build_profile lud16, ingest allowlists, migration users.lud16 pending
U9 Relay E2E — private-channel h-scoping, forged-receipt fan-out, rate-limit NOTICE pending
U10 Tauri backend — wallet commands, nwc:{community_id} secret, durable PaymentStore, community reset, reconcile hook pending
U11 Desktop UI — settings/send/receive, pay card states, receipt aux e-join + Playwright screenshots pending
U12 buzz wallet CLI + BUZZ_NWC_URI / 0600 secret + TESTING.md runbook pending
U13 Agents receive-only — provisioning probe, env chain, reserved key, log scrubbing pending
U14 Final gate — just ci + just test green, doc de-drafted, PR ready pending

Acceptance criteria coverage

The Gherkin features in the doc are the contract; the coverage table (scenario → named test) is filled in per unit as proofs land: Link, Receive, Send to a lightning address, Payment lifecycle, Payment requests in chat, Trust is local, Agents are receive-only, Relay ingest of payment kinds, Preimage vectors.

Hard rules enforced throughout

  • NWC secret only in native secure storage / native backend; never returned to the webview; never logged.
  • Every send requires explicit human confirmation; pay_invoice fires at most once per attempt.
  • The Buzz relay has no payment logic — it stores and fans out two new kinds, h-scoped.
  • Trust is local: settlement truth is each party's own wallet, never a posted receipt.
  • msat everywhere in the domain; sats only at the UI boundary.

marcopesani and others added 3 commits July 23, 2026 21:18
Design for per-user (and receive-only per-agent) Lightning wallets via
NIP-47 Nostr Wallet Connect, with a two-plane architecture (off-Buzz NWC
transport + on-Buzz discovery/UX) and a ports/adapters domain so custodial
or LDK backends slot in as a single WalletService adapter later.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Fold the architectural dry-run findings back into the design: name the
four driver-facing ports the acceptance harness forces (WalletConnector,
PaymentStore, SecretStore, ProfilePublisher), make send two-phase, add
the lightning-invoice dependency, require bolt11 on confirmable requests,
enforce receive-only at agent provisioning, fix the lud16 source and
lookup_invoice mapping, and re-map the acceptance harness accordingly.

Co-authored-by: Cursor <cursoragent@cursor.com>
@marcopesani

Copy link
Copy Markdown
Author

Closing — development continues on the fork until ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant