Nostr Wallet Connect Protocol Overview

This article is machine translated
Show original

Author: NWC Docs

Source: https://docs.nwc.dev/introduction/introduction-to-nwc

"Nostr Wallet Connect (NWC)" protocol provides a way for a client app to remotely access a Bitcoin Lightning wallet software through a standardized protocol. Wallet software and apps are willing to do this to enable users to smoothly access their wallet accounts and make simple payments within the app. NWC: A Free and Open Protocol NWC is a free and open protocol. This is crucial because it brings several advantages: 1. Anyone can use NWC. 2. Payments based on NWC will not be locked into a vendor. 3. NWC is more flexible, with more integration options in existing and new apps. Apps adopting NWC can enhance their usability and creativity. Most importantly, this ensures that your app is interoperable with the entire ecosystem, thereby benefiting from network effects. NWC is Built on Bitcoin's Lightning Network Bitcoin is a decentralized electronic currency that supports peer-to-peer payments without relying on banks and intermediaries. The Lightning Network is a second-layer protocol on top of Bitcoin that supports instant, low-fee payments by forwarding transactions on a secondary network while inheriting Bitcoin's security guarantees. Together, they provide a powerful foundation for a global open financial system. They are a perfect match, and thus the preferred payment protocol for NWC. Note that NWC only determines how payments are transmitted between apps and wallet software. NWC can support any payment network. In fact, it can support on-chain Bitcoin transactions and payments in multiple currencies. Why is it Called "Nostr Wallet Connect"? As mentioned at the beginning of the article, NWC provides a method for apps to connect to wallet software, which is the origin of its name. "Nostr" is one of the supporting technologies of NWC. Nostr itself is a simple, open protocol that enables censorship-resistant, decentralized message streams based on public key cryptography and message relay servers. It does not depend on a centralized server or gateway. NWC uses Nostr protocol's relay technology and public key cryptography to protect communications between apps and wallet software. As an end-user of an NWC-enabled wallet software, you don't need to know anything about the underlying relay technology, or even hold your own Nostr keys. Just like email service providers don't display SMTP protocol in the user interface, your wallet software and the connected app will handle information interactions. Workflow (Overview) After establishing a session through a Nostr message relay server as a bridge, the app and wallet software can interact. The relay provides a reliable and efficient way to connect Lightning nodes without using onion routing or exposing nodes to the public network (clearnet). If a user wants to perform an operation (such as paying a Lightning invoice `pay_invoice`), the transaction will be prepared, serialized, and encrypted by the app's frontend, then sent to the relay. The relay will forward it to the wallet application. After reading the message from the relay, the wallet application decrypts the transaction and displays it to the wallet user or automatically executes the operation. Throughout the process, the relay only assists in communication, but all requests are encrypted and unreadable by the relay. Workflow (Step-by-Step) [Image description] 1. The user uses their **client application** to scan a QR code generated by the **wallet server**, entering a `nostr+walletconnect:` deep link, or manually configure the connection information. This connection establishment step happens only once. 2. The **client application** receives invoices from various sources (such as NWC itself or LNURL). 3. The **client application** sends an event to the **wallet server** through a relay. The event content is a `pay_invoice` request. The private key used comes from the previously mentioned connection string. 4. The relay forwards the `pay_invoice` request to the **wallet server**. 5. The **wallet server** verifies the event's author public key, then decrypts the message and sends the payment. 6. The **wallet server** replies to the client application with a specific event, containing either an error message or the preimage obtained from paying the invoice. Benefits for App Developers - **Easy and Quick Implementation** Use a clear, well-documented API to integrate NWC in minutes. Focus on developing features, not infrastructure. - **Free and Open** NWC is open-source and free to use - no licensing fees, vendor lock-in, or hidden costs. - **Non-Custodial** Eliminate the need to custody user funds. Let wallet software handle money matters, and your application just coordinates secure operations. - **Flexible** With NWC, you can get a complete wallet experience or use only some features (like sending and receiving payments). It's designed to be modular. - **Interoperability** Connect to any Bitcoin wallet software that supports NWC. One protocol, multiple wallet software - no custom integrations needed. - **Platform Independent** Works across environments: mobile apps, web backends, command-line tools, desktop applications - NWC is not picky. - **Persistent Connection** Once connected, your app can connect to the wallet software as long as the user's wallet is online, without further user configuration. Benefits for Users - **Convenient In-App Payments** Complete payments in one go - no QR code scanning, no app switching, no manual confirmation. - **Faster Onboarding** As long as the wallet software supports NWC, users can connect instantly - no login, KYC, or startup steps. If the wallet has money, it's ready to pay.

  • Single Wallet for Easy Management

    Users can use the same wallet across multiple applications - without needing to "recharge" for each individual app.

  • NWC Functions

    • Send Payments

      Initiate single payments, batch transactions, and even automatic periodic payments.

    • Receive Payments

      Display payment requests and receiving requests in real-time. Suitable for tipping, in-app payments, and donations.

    • Wallet Balance

      Check and display the real-time balance of the connected wallet within your application.

    • Payment History

      List incoming and outgoing payments.

    • Payment Verification

      Automatically check the status of payments - pending, completed, or failed.

    Source
    Disclaimer: The content above is only the author's opinion which does not represent any position of Followin, and is not intended as, and shall not be understood or construed as, investment advice from Followin.
    Like
    Add to Favorites
    Comments