This guide walks through setting up a self-hosted Bitcoin Lightning payment stack on a Linux server. No third parties, no KYC, no middleman.

Stack: BlueWallet (mobile) ↔ LNbits (accounts layer) ↔ Phoenixd (Lightning daemon) ↔ Lightning Network

Read the complete guide with images in the blog post →


Quick Summary

StepWhat You DoTime
1Install Docker + Docker Compose5 min
2Install Phoenixd (Lightning daemon)5 min
3Deploy LNbits with Docker Compose5 min
4Create your admin account2 min
5Install extensions3 min
6Configure HTTPS5 min
7Connect BlueWallet3 min

1. Install Docker

curl -fsSL https://get.docker.com | sudo bash
sudo usermod -aG docker $USER
newgrp docker  # or log out and back in

2. Install Phoenixd

mkdir -p ~/phoenixd && cd ~/phoenixd
V=$(curl -s https://api.github.com/repos/ACINQ/phoenixd/releases/latest | grep tag_name | cut -d'"' -f4 | sed 's/^v//')
wget "https://github.com/ACINQ/phoenixd/releases/download/v$V/phoenixd-$V-linux-x86_64.zip"
sudo apt install -y unzip && unzip "phoenixd-$V-linux-x86_64.zip"
sudo mv phoenixd /usr/local/bin/
mkdir -p ~/.phoenix
 
# Create systemd service
sudo tee /etc/systemd/system/phoenixd.service > /dev/null << 'EOF'
[Unit]
Description=Phoenixd Lightning Daemon
After=network.target
[Service]
Type=simple
User=$(whoami)
ExecStart=/usr/local/bin/phoenixd
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target
EOF
 
sudo systemctl daemon-reload && sudo systemctl enable --now phoenixd

3. Get Your Phoenixd Password

grep phoenixd.api-password ~/.phoenix/phoenix.conf

4. Deploy LNbits

mkdir -p ~/lnbits && cd ~/lnbits

Create ~/lnbits/docker-compose.yml:

version: '3.8'
services:
  lnbits:
    image: lnbits/lnbits:latest
    restart: unless-stopped
    ports:
      - "0.0.0.0:5000:5000"
    extra_hosts:
      - "host.docker.internal:host-gateway"
    environment:
      - LNBITS_DATA_FOLDER=/data
      - LNBITS_BACKEND_WALLET_CLASS=PhoenixdWallet
      - PHOENIXD_API_ENDPOINT=http://host.docker.internal:9740
      - PHOENIXD_API_PASSWORD=YOUR_P...RE
      - LNBITS_SITE_TITLE=My Lightning Server
      - LNBITS_SITE_TAGLINE=Bitcoin and Freedom Tech
      - LNBITS_ADMIN_EXTENSIONS=true
      - LNBITS_DEFAULT_WALLET_NAME=Main Wallet
    volumes:
      - lnbits_data:/data
    depends_on:
      postgres:
        condition: service_healthy
  postgres:
    image: postgres:16-alpine
    restart: unless-stopped
    environment:
      - POSTGRES_USER=lnbits
      - POSTGRES_PASSWORD=***      - POSTGRES_DB=lnbits
    volumes:
      - postgres_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U lnbits"]
      interval: 5s
      timeout: 5s
      retries: 10
volumes:
  lnbits_data:
  postgres_data:

Insert your phoenixd password and start:

PASS=$(grep phoenixd.api-password ~/.phoenix/phoenix.conf | cut -d= -f2 | xargs)
sed -i "s/YOUR_PHOENIXD_PASSWORD_HERE/$PASS/" docker-compose.yml
docker compose up -d

5. Create Admin Account

Visit http://YOUR_SERVER_IP:5000 in a browser, click Create an Account, choose a username and password. Then:

# Get your User ID from the profile page (the hex string), then:
nano ~/lnbits/docker-compose.yml

Add under environment::

      - LNBITS_ADMIN_USERS=YOUR_USER_ID_HERE
cd ~/lnbits && docker compose down && docker compose up -d

6. Connect BlueWallet

Open BlueWallet → +LightningLNDHub → enter:

  • URL: https://your-server.com/lndhub/ext/
  • Username & password from step 5


Support this work

Found these guides valuable? Bitcoin and lightning donations help keep this project running.

Lightning: haji@hilac.hajisatoshi.xyz

Contact

Email: hello@hajisatoshi.xyz

Nostr: npub1l7j9s2znwsfcezul4635gnezjg52t7x88efrdehm8h5sp7r6yu4qqfkujm