I'm not the creator of the phoenixd-lnurl project nor affliated with it, moreover I couldn't find the creator here on Stacker News. I know that the guy can be found on Nostr behind the npubnpub1raftzmju5gq77twqxrumv5gnweew2t0p4v5upv8kku4vsz4j8jzq3tgns2
and here is his website. He has all the credits for this.
Background
A few days ago I was checking my nostr feed and somehow I run into the following project:
that is based on the new-born phoenixd server, the new ACINQ product that basically mimics what the android phoenix wallet does, but it is deployable on a web server and potentially runs 24/7.
The process
Since I have a VPS with some dummy services on it, I decided to try phoenixd and this wrapper, just to understand the potential of such a product.
For simplicity I'll call the phoenixd daemon "node" from now on.
The first thing to do is clearly to have some sort of server/VPS with a static IP and a domain. You'll need the domain to deploy the lnurl webpage that shows the lnurl and your lnaddress.
Once you set up the VPS you can decide to follow two different paths:
- Deploy the node using docker, which is pretty straightforward and all the information is on the README file of the project;
- Deploy the node by installing by hand phoenixd server, the dependencies of phoenixd-lnurl and setting up manually everything.
I decided to go for the second methodology.
Phoenixd server
Installing phoenixd server is very easy, the get started section of the website explains step-by-step the deploy process so take a look at it. Once you're done with the installation of phoenixd server you'll have at hand two scripts, phoenixd and phoenix-cli and if you run phoenixd for the first time it'll generate your new phoenix server node, generating the 12 seed words and setting up everything that is needed. Just rememeber to backup the seed.dat file (containing your 12 words seed), you'll find it in the ~/.phoenix folder.
Last thing I suggest to do is to add to the path the folder containing phoenixd and phoenix-cli.
Phoenixd-lnurl wrapper
Once the server installation is completed and the scripts are on your path, its time to proceed with the installation of the wrapper that will enable you to have a static webpage and an lnaddress directly linked to your new created node.
Go to the project repository and clone the repository in your favourite folder, then
cd
into the newly created repository folder,
At this point, you need to check one thing before going ahead: you need to verify that your system has an installed python version equal or newer than the python3.10. You can check that by writing python --version
.
This is needed because some commands included in the run.sh
script for the wrapper need this specific (or newer) version of python, otherwise the run.sh
script will fail every time with an TypeError
.If your python version respects the requirement explained above, then you can procede with the creation of a new virtual environment, recalling to use the python3.10 version, and install the requirements as explained in the README.
Config file
At this point you should have the phoenixd-lnurl folder and an activated python environment with all the requirements. In the same folder you should create an phoenixd-lnurl.env file and copy the content of the phoenixd-lnurl.env.example. This env file is very important because in it you'll define:
- the
PHOENIXD_URL
, that is an url containing your username, the http password (that you can find in ~/.phoenix/phoenix.conf), the localhost and the port that will be used to communicate with the node instance. The final form of this parameter ishttp://<username>:<http_password>@127.0.0.1:<port>
. You can check the hostname and the port number by reading the content of therun.sh
script in the same folder; - your username (then used for the lnaddress);
- the hostname that will serve the invoices needed by the LNURL, which is also the domain that will serve the webpage showing your LNURL QRcode;
- some other settings about the min and max amounts that the LNURL can receive;
- your nostr pubkey, that will appear in the same webpage.
Nginx settings
As of now, the wrapper should be set up as intended and you can even start it by running
./run.sh
in your terminal; if you run both the phoenixd daemon and the run.sh script your lnaddress will be able to receive sats. in order to run also the LNURL webpage you'll need to tickle a bit with nginx.If you're running already a web server you should be already aware of how to tickle with nginx, anyway I recommend to take a look at this guide that will easily explain to you how to edit the nginx settings. Just remember that the
server
settings that the README file recommends to use must be inserted in the file corresponding to the domain you'll use that is contained in the /etc/nginx/sites-available/
folder. The suggested settings for nginx already include the new landing page for the LNURL QRcode, so you can simply copy-paste everything.Systemd services
The final thing you need to do is to create two systemd services (if you're using systemd), one for the phoenixd server daemon and one for the
run.sh
script. The project comes with a suggested systemd service template that you can easily edit according to where these files are located in your filesystem.Final remarks
Now by navigating to your
https://domain.com/lnurl
you should be able to see a freshy colorful page with your LNURL QRcode in the middle and the lightning address. And this is it!The process is fairly simple and does not require a lot of work to set this up, nonetheless you should pay attention to a few elements:
- Phoenixd server is still a trust-minimized node that relies on ACINQ node for liquidity management and its overall functioning. As for the mobile wallet, channels are opened with ACINQ as a peer but as an additive feature phoenixd comes with the possibility of receiving some sats even without having a channel opened. This can work only for very small amounts, since phoenixd server 'understands' that the sats are not enough to open a channel with a swap and thus trusts momentarily ACINQ for holding these sats on your behalf.
- Phoenixd is a very new product and can have bugs that could lead to loss of funds. Moreover, phoenixd-lnurl is an alpha solution built on top of a beta product...you can easily understand that the level of insecurity of the overall structure requires to be very careful and not going mad by using substantial bitcoin amounts.
- As for an LN full node, phoenixd server is an hot lightning wallet running on a web server, which can possibly have a very low level of security, depending on your ability to secure linux systems.