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イベントとして送られ、responseはkind 23195イベントで返ります。

Commands and 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にclientが従うほうが、広い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を持てるため、revocationとprivacyの両方で有利です。walletはspending上限を設定したり、methodを無効化したり、他へ影響を与えずに1つのconnectionだけを取り消したりできます。

現在はNIP-44が推奨encryption modeです。仕様には旧実装向けのNIP-04 fallbackも残っているため、clientはすべてのwalletが移行済みだと仮定するのではなく、walletがadvertiseするencryptionタグを確認する必要があります。


Primary sources:

Mentioned in:

See also: