0. Intro

SN is offering you many ways to be a sovereign bitcoiner and remove your stash from its custodial node. Some options are free, actually FOSS! Just cost you some time to set it up and the energy/connection to keep it running. Consider taking action! My previous post to Easily attach Coinos.io wallet to SEND & RECEIVE sats from SN and HODL was much easier and faster to set up. This one for phoenixd will require you some tech skills and hands on terminal. Are you ready?
The goal of this guide is to help you set up phoenixd as your SN attached wallet for both, sending to and receiving froom sats. In this way, we can help SN reach the 100% non-custodial status that is aiming to achieve, and for us stackers, to be more responsible with our sats and zaps. On top of that, how cool is to see this little p2p tag on the notification page!
One of the premises for deciding to attach this wallet, is that you need a machine that will ideally stay up and running 24/7. You can also do it for just for fun and to learn something new.
I'll start from zero, assuming you never heard of phoenixd, nor even opened a terminal window. It will be a bit geeky, but not that hard as you may think. These below are the three goals we'll achieve:
  1. Installing phoenixd
  2. Make phoenixd publicly accessible
In case you don't want to go through all this trouble and technicalities, you can check @t0m's Nodana - Phoenixd As A Service, or install it on your Start9 node and head straight to the point...
  1. Attach phoenixd to SN

1. Installing phoenixd

You can find more information about phoenixd from the official website //phoenix.acinq.co/server
Download and unzip the latest of phoenixd source code available in the github repository and save it in your computer. It should be available from https://github.com/ACINQ/phoenixd/releases
You will need gpg for signing, you can get the key from the links provided in the release page above. Once downloaded (remove the .txt extension if required) save it in the same phoenixd unzipped folder. cd into the same folder via terminal and run:
gpg --import padioupm.asc
to verify the key you'll also need sha256sum installed in your environment. You can open another terminal window and check if theere with gpg --version and if not there, install it. Then proceed with:
sha256sum -c SHA256SUMS.stripped
Open your terminal and verify the gpg signature. Once done, you are now ready to run the daemon with:
$ ./phoenixd
The terminal will provide some initial explanation on how the backup and continuous liquidity work:
Backup This software is self-custodial, you have full control and responsibility over your funds. Your 12-words seed is located in /Users/xxx/.phoenix, make sure to do a backup or you risk losing your funds. Do not share the same seed with other phoenix instances (mobile or server), it will cause issues and channel force closes. Please confirm by typing [I understand]:
Continuous liquidity Liquidity management is fully automated. When receiving a Lightning payment that doesn't fit in your existing channel: - If the payment amount is large enough to cover mining fees and service fees for automated liquidity, then your channel will be created or enlarged right away. - If the payment is too small, then the full amount is added to your fee credit, and will be used later to pay for future fees. The fee credit is non-refundable. Please confirm by typing [I understand]:
You'll be asked to type I understand multiple times. Type it and press enter If there are no error, you should be seeing phoeninxd running:
Phoenix server is about to start, use phoenix-cli or the http api to interact with the daemon. This message will not be displayed next time. Press any key to continue... datadir: /Users/sintetiko/.phoenix chain: Mainnet autoLiquidity: 2000000 sat nodeid: 0318aa189af0ba0c616647954bea00c0bb6b2c4a8af2891174c21caa72ed6a24c7 offer: lno1zrxq8pjw7qjlm68mtp7e3yvxee4y5xrgjhhyf2fxhlphpckrvevh50u0q250urkyzyzcw3637xeul30j74g94f5jkntx6cewmen62dqmlukzuqszpaj7spt5w0l0a6gdrpdrxg4kmqrqc0hs5xt944ac575v2yy0q93qqvaynn3268guwvegwwnznw4ccnpxs0w4fld2ae43m90xj2zvwx67w5rqfmnkay6rsww0m8yf0mpzzxwxjs0hqgp56fpaq7xgn7xphsn6f20sr2c0lguzwmxug9rzphselw9h5hdukqqsaqqnl0elfqrt4vvd5m02ge9hjq connecting to lightning peer... connected to lightning peer listening on http://127.0.0.1:9740
Perfect! Now open a new terminal window and type to double check:
./phoenix-cli getinfo
the output will be something like:
{ "nodeId": "0318aa189af0ba0c616647954bea00c0bb6b2c4a8af2891174c21caa72ed6a24c7", "channels": [ ], "chain": "mainnet", "blockHeight": 862274, "version": "0.3.4-1a872b4" }
Look's like everything is running! You can play around with the deamons if you like and try to generate a Lightning invoice:
./phoenix-cli createinvoice \ --description "my first invoice" \ --amountSat 12345
Can you see it? Nice! Now we need to...

2. Make phoenixd publicly accessible

If we refer to the output above, we could see phoenixd is listening to an internal IP 127.0.0.1 at the post :9740. This obviously will not work as it's not accessible from the internet.
There's no need these days to be a network engineer to have locally running applications publicly available. Luckily, technology evolved exponentially, and today we have multiple ways and many tools available to fix this issue, DYOR! For this guide, ngrok is probably the go-to solution: technically isn’t free, more like freemium, but the free tier costs zero dollars and is sufficient for most development purposes, like this.
First thing first, install it on your machine:
brew install ngrok/ngrok/ngrok
Run the following command to add your authorization token to the default ngrok.yml configuration file.
ngrok config add-authtoken 3mPlIq6APs8jVPPdXEgj6Oubln4_5kxeqidDwwy437T3o4GMQ
Now let's put phoenixd online at an ephemeral domain, forwarding to your upstream service:
ngrok http http://127.0.0.1:9740
Once running, your endpoints will be listed on the ngrok endpoints page.
If you are planning to keep phoenixd running 24/7 it's worth to protect it by securing ingress, defining some parameters that are easy and free to use. Some options to have it done are OAuth, webhook verification and OpenID connect.
What's important now is that we finally got our url to access phoenixd publicly and securely!
https://44f4-146-70-194-38.ngrok-free.app/
Can you see it? Nice... Let start now setting up the connection with SN.

3. Attach phoenixd to SN

From your SN user menu in the top right of your desktop screen, let's go to SN > wallet > attach wallet > phoenixd or just click on this link https://stacker.news/settings/wallets/phoenixd
The first url input is the IP or domain your phoenixd is accessible from. That one that we just set in the previous section:
Go back to a new terminal window and type1:
sudo nano .phoenix/phoenix.conf
𝐍𝐨𝐭𝐞: π‘‡β„Žπ‘’ πš™πš‘πš˜πšŽπš—πš’πš‘.πšŒπš˜πš—πš 𝑓𝑖𝑙𝑒 π‘ β„Žπ‘œπ‘’π‘™π‘‘ 𝑏𝑒 π‘Žπ‘π‘π‘’π‘ π‘ π‘–π‘π‘™π‘’ π‘“π‘Ÿπ‘œπ‘š π‘¦π‘œπ‘’π‘Ÿ 𝒓𝒐𝒐𝒕 π‘’π‘ π‘’π‘Ÿ π‘“π‘œπ‘™π‘‘π‘’π‘Ÿ, π‘¦π‘œπ‘’ π‘π‘Žπ‘› π‘œπ‘π‘’π‘› 𝑖𝑑 π‘€π‘–π‘‘β„Ž π‘¦π‘œπ‘’π‘Ÿ π‘π‘Ÿπ‘’π‘“π‘’π‘Ÿπ‘Ÿπ‘’π‘‘ 𝑑𝑒π‘₯𝑑 π‘’π‘‘π‘–π‘‘π‘œπ‘Ÿ.
In this file, you'll find:
  • the primary password for sending as http-password, together with
  • the secondary password for receiving as http-password-limited-access.
Now, finally, copy and paste this values in the respective input fields.
We are nearly there... set:
  • desired balance = 0,
  • max fee to a min of 1% and...
  • . ... click on the yellow [ attach ] button.

4.0 That's it!

You just did your first step into bitcoin sovereignty!

In case you are serious with your phoenixd node and want to keep it and use it, there's a supercool Ui you can self-host or set up from pwallet.app. Or as the master @Darthcoin teach us, If I want to use phoenixd node, run it as a backend to LNbits or Alby HUb. I have waaaaay more options to manage and use it... And with that you can get NWC and multiple accounts too, with the same server.2

Footnotes

  1. You can find more info and documentation on https://phoenix.acinq.co/server/api#security ↩
  2. quote from #695909 ↩
@ek, I know you have some experience in networking stuff, how you'd face the port forwarding issue on step 2.0 to make the locally installed phoenixd publicly available on the internet?
reply
63 sats \ 3 replies \ @ek 23 Sep
Few options:
  1. use (free) dynamic DNS services like https://www.duckdns.org/ to get a domain that always points to your router even if your IP address changes and then use port forwarding on router
  2. use VPN tunnel to a server you own
  3. or just deploy phoenixd on that server
  4. wrap phoenixd with NWC and use NWC instead (not sure if this exists yet)
I am using the third option right now.
reply
That's great to know you are using phoenixd, and thanks for sharing all these options. I think this step of port-forwarding/tunneling is a major blocker for people aiming to run a node. I know for example that Start9 is working on it, finding a way to automate the process somehow. I did not have checked lately, maybe someone else can confirm.
reply
0 sats \ 1 reply \ @ek 23 Sep
NWC is the solution imo
Or I might look into if I want to maintain a service like ngrok for stackers only
reply
That's sound exiting! running ngrok on a private SN instance?
reply
Thanks for the tutorial. This is your 2nd if I'm right. I'm learning about which one works better. This one looks a bit more technical. Do you suggest it to noobs?
reply
Noobs maybe not really, if they are willing to try here above there's a step-by-step walkthrough. It's definitely more technical than the previous one.
The coinos one is cool because allow you to "cashout" your sats to an onchain address, fully anonymously, KYC-free!
Next one gonna be even easier, stay tuned!
reply
Good guide!
reply
No comparison with yours!
reply
Superb! Thanks for the guide. Where are SN bounties for the guides SN? @k00b @ek
reply
for now there are any! Maybe in the future? Not sure...
If you wish to contribute, just pick something that from your perspective need to be documented and start typing. No bounty guarantee, V4V apply and if stackers find it useful you'll get rewards! A lot of comments to respond to ;)
reply
10 sats \ 1 reply \ @k00b 22 Sep
We haven’t put up the bounties yet
reply
Ahh! I remember you mentioned about them. Alright, they're just not put up. Sorry for the wrong question.
When do you plan to put up? I think this is correct now.
reply
There is another way to make phoenixd publicly accessible without ngrok: Alby Hub. If you download/install Alby Hub and connect that to phoenixd, Alby Hub will give you a nostr wallet connect string, and you can then connect that to stacker news. I think this is neat because it eliminates the need to create an ngrok account, and it gets you lots of cool Alby Hub features, like a self custodial lightning address. (Though stacker news sort of becomes that anyway even if you connect it to your wallet via ngrok.)
reply
Yes, but why connect to SN via NWC via AH when you can connect to SN directly the phoenixd instance? I agree the NWC is useful for other apps too... or is Alby Hub resolving the port forwarding too?
reply
because you can't connect SN directly to phoenixd without running a web server to expose it publicly. Connecting it via ngrok isn't a direct connection, it relies on a middleman (ngrok) who you need an account with, who may change their terms of service, cut you off, or go bankrupt. And if that happens, there aren't many ngrok replacements to jump to. Doing it via NWC (included in Alby Hub) still involves a middleman (the nostr relay), but you don't need an account with them and there are so many of them, they are easy to replace whenever necessary.
or is Alby Hub resolving the port forwarding too?
Yes, NWC (nostr wallet connect) resolves the need to do port forwarding and it is included in Alby Hub
reply
there aren't many ngrok replacements to jump to.
Anyway, make sense and I agree about ngrok playing as middleman, but we are talking about different things here.
There's no doubt NWC is much easier, but is another type of attached wallet that isn't nearly connected with phoenixd. I'll talk about NCW and AlbyHub in another tutorial.
The issue ngrok solve is the port forwarding and providing a publicly accessible url for a Lightning node installed locally. There are probably few options to do it without third parties involved. But for newbies that just want to connect phoenixd to SN, I'll probably skip that technical mess and reach the goal.
reply
I’m not sure how ngrok behaves for long persistent connections. I think it’s meant for development so it might be the case they close the tunnel if you don’t use it for a while or pay.
reply
Great topic! This will be valuable. You are also an excellent teacher. Working in the terminal can be intimidating to many of us. You have included just the right amount of handholding.
reply
Thank you for the feedback! Working with terminal it can definitely be intimidating! I tried to keep it short and get the reader to the goal... attach a non-custodial wallet to SN!
reply
Excellent work and thanks for the mention
reply
Another awesome guide.
SN should be offering small bounties for these. @k00b @ek
In there interim, I am zapping you 10k sats for each one.
reply
Thanks much appreciated! I'll be curious to see if the number of attached wallet increase with it.
reply
Hey @supratic. Thanks for the mention. If anyone does happen to go for the Nodana Phoenixd option then more than happy to help you get set up. I use a phoenixd node myself for payments on Nodana (and it’s hosted on Nodana - sounds a bit like Inception).
reply
I bet you have a Nodana instance 🀣 It's nice to know you are using phoenixd, did you try to attach it to your SN account?
The fact that you are willing to provide help for the setup is great! Do you think you can offer a discount for stackers (I mean SN users)?
reply
21 sats \ 1 reply \ @t0m 22 Sep
No, it’s a dedicated node for Nodana but would be easy to hook one up to SN too.
Yeah I’m happy to give a discount to anyone that would like to run a node.
reply
give a discount to anyone that would like to run a node
I should add... and connect it to SN!
reply
Bookmarked. Awesome guide . Definitely going to try it
reply
Is a good exercise to keep cli skills update!
reply
Someone just showed an example of how this app works. I like how it is not so flashy.
reply
yes, noticed and linked in the footnotes!
reply
Cool.
reply
Good stuff. I never heard of ngrok and just tried it. How will API calls bypass the screen "You are about to visit:..." where one needs to press the button?
reply
the last reply from ngrok suggests that adding header "ngrok-skip-browser-warning" can no longer be done with the tunnel:
reply