-
![](https://i.nostr.build/cALeYz8R8f7mWLkZ.webp)
@ The Fishcake🐶🐾
2023-07-22 09:39:48
# 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.
- Working installation of LND (and all of its required components)
- Docker (with Docker compose)
## 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](http://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.
* Change directory to `nostr-wallet-connect`: `cd nostr-wallet-connect`
* Run command to build Docker image: `docker build -t nwc:$(date +'%Y%m%d%H%M') -t nwc:latest .` (there is a dot at the end)
* The last line of the output (after a few minutes) should look like ` => => naming to docker.io/library/nwc:latest`
* `nwc:latest` is the name of the Docker image with a tag which you should note for use later.
### Creating docker-compose.yml and necessary data directories
* Let's create a directory that will hold your non-volatile data (DB): `mkdir data`
* In`docker-compose.yml`file, there are fields that you want to replace (<> comments) and port “4321” that you want to make sure is open (check with `ss -tupln | grep 4321`which should return nothing).
* Create `docker-compose.yml`file with the following content, and make sure to update fields that have <> comment:
```
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.
* While you are in the `nwc`directory (important), execute the following command and check the log output, `docker compose up`
* You should see container logs while it is starting, and it should not exit if everything went well.
* At this point, you should be able to go to `http://<ip of the host where nwc is running>:4321` and get to the interface of NWC
* To stop the test run of NWC, simply press `Ctrl-C` , and it will shut the container down.
* To start NWC permanently, you should execute `docker compose up -d` , “-d” tells Docker to detach from the session.
* To check currently running NWC logs, execute `docker compose logs` to run it in tail mode add `-f` to the end.
* To stop the container, execute `docker compose down`
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.
* Change directory to the clone of the git repository, `cd /home/bitcoin/nwc/nostr-wallet-connect`
* Run command to build Docker image: `docker build -t nwc:$(date +'%Y%m%d%H%M') -t nwc:latest .` (there is a dot at the end)
* Change directory back one level `cd ..`
* Restart (stop and start) the docker compose config `docker compose down && docker compose up -d`
* Done! Optionally you may want to check the logs: `docker compose logs`