Running NWC on your LND node

This short tutorial will help you set up your own Nostr Wallet Connect (NWC) on your own LND Node that is not using Umbrel.

The Fishcake (nostr.build)

22. Juli 2023July 22, 2023 · 4 Min. Lesezeit4 min read

Intro

This short tutorial will help you set up your own Nostr Wallet Connect (NWC) on your own LND Node that is not using Umbrel. If you are a user of Umbrel, you should use their version of NWC.

Requirements#

You need to have a working installation of LND with established channels and connectivity to the internet. NWC in itself is fairly light and will not consume a lot of resources. You will also want to ensure that you have a working installation of Docker, since we will use a docker image to run NWC.

Installation#

For the purpose of this tutorial, we will assume that you have your lnd/bitcoind running under user bitcoin with home directory /home/bitcoin. We will also assume that you already have a running installation of Docker (or docker.io).

Prepare and verify#

git version - we will need git to get the latest version of NWC. docker version - should execute successfully and show the currently installed version of Docker. docker compose version - same as before, but the version will be different. ss -tupln | grep 10009- should produce the following output: **tcp LISTEN 0 4096 0.0.0.0:10009 0.0.0.0:*** **tcp LISTEN 0 4096 [::]:10009 [::]:***

For things to work correctly, your Docker should be version 20.10.0 or later. If you have an older version, consider installing a new one using instructions here: __https://docs.docker.com/engine/install/__

Create folders & download NWC#

In the home directory of your LND/bitcoind user, create a new folder, e.g., "nwc" mkdir /home/bitcoin/nwc. Change to that directory cd /home/bitcoin/nwc and clone the NWC repository: git clone https://github.com/getAlby/nostr-wallet-connect.git

Creating the Docker image#

In this step, we will create a Docker image that you will use to run NWC.

Creating docker-compose.yml and necessary data directories#

version: "3.8"
services:
  nwc:
    image: nwc:latest
    volumes:
      - ./data:/data
      - ~/.lnd:/lnd:ro
    ports:
      - "4321:8080"
    extra_hosts:
      - "localhost:host-gateway"
    environment:
      NOSTR_PRIVKEY: <use "openssl rand -hex 32" to generate a fresh key and place it inside "">
      LN_BACKEND_TYPE: "LND"
      LND_ADDRESS: localhost:10009
      LND_CERT_FILE: "/lnd/tls.cert"
      LND_MACAROON_FILE: "/lnd/data/chain/bitcoin/mainnet/admin.macaroon"
      DATABASE_URI: "/data/nostr-wallet-connect.db"
      COOKIE_SECRET: <use "openssl rand -hex 32" to generate fresh secret and place it inside "">
      PORT: 8080
    restart: always
    stop_grace_period: 1m

Starting and testing#

Now that you have everything ready, it is time to start the container and test.

That's all, just follow the instructions in the web interface to get started.

Updating#

As with any software, you should expect fixes and updates that you would need to perform periodically. You could automate this, but it falls outside of the scope of this tutorial. Since we already have all of the necessary configuration in place, the update execution is fairly simple.

#docker#lnd#nostr-wallet-connect#nwc#zaps

Written by

Comments

No comments yet. Start the conversation.

Contents

2 sections

  1. Requirements
  2. Installation