NIP-47はNostr Wallet Connectを定義し、Nostr appがwalletの主要credentialを各clientへ渡さずに、remote Lightning wallet serviceと通信できるようにします。

仕組み

wallet serviceは、対応するmethodとencryption modeを記述したreplaceableなkind 13194 info eventを公開します。clientは、wallet service pubkey、1つ以上のrelay、接続専用secretを含むnostr+walletconnect:// URIで接続します。requestはkind 23194 eventとして送られ、responseはkind 23195 eventで返ります。

CommandsとNotifications

よく使われるmethodにはpay_invoicepay_keysendmake_invoicelookup_invoicelist_transactionsget_balanceget_infoがあります。wallet serviceはpayment_receivedpayment_senthold_invoice_acceptedのようなnotificationもpushできます。

仕様には以前、いくつかのoptional methodが増えていましたが、最近の整理でmulti_ payment methodは削除されました。実運用では、walletのinfo eventでadvertiseされたcommandだけを使うほうが相互運用しやすく、広いmethod setを前提にしないほうが安全です。

ユースケース

  • Zapping - 投稿、profile、creatorにsatsを送る
  • Payments - どのNostr appからでもLightning invoiceを支払う
  • Wallet UX separation - 1つのwallet serviceを複数のNostr clientで使う

セキュリティと相互運用メモ

接続URIには、clientが署名と暗号化に使う専用secretが含まれます。これによりappごとに別のwallet identityを持てるため、revokeしやすく、privacy面でも有利です。walletはspending上限を設けたり、methodを無効化したり、ある1つのconnectionだけを取り消したりできます。

現在はNIP-44が推奨encryption modeです。ただし仕様には旧実装向けのNIP-04 fallbackも残っているため、clientはwalletのencryption tagを見て判断する必要があります。すべてのwalletが移行済みだと決め打ちするべきではありません。


主要ソース:

言及箇所:

関連項目: