l402_middleware 2.2.1

A middleware library for rust that provides handler functions to accept microtransactions before serving ad-free content or any paid APIs.
Documentation
services:
  bitcoind:
    image: lncm/bitcoind:v25.0
    container_name: bitcoind
    user: root
    command: -regtest -rpcbind=0.0.0.0 -rpcallowip=0.0.0.0/0 -rpcauth=user:63cf03615adebaa9356591f95b07ec7b$$920588e53f94798bda636acac1b6a77e10e3ee7fe57e414d62f3ee9e580cd27a -fallbackfee=0.0001 -zmqpubrawblock=tcp://0.0.0.0:28332 -zmqpubrawtx=tcp://0.0.0.0:28333 -zmqpubhashblock=tcp://0.0.0.0:28334 -wallet=new_wallet
    ports:
      - "18443:18443"
      - "28332:28332"
      - "28333:28333"
      - "28334:28334"
    volumes:
      - bitcoin_data:/root/.bitcoin

  tor:
    image: dperson/torproxy:latest
    container_name: tor
    ports:
      - "9050:9050"  # SOCKS5 proxy
      - "9051:9051"  # Control port
    volumes:
      - tor-data:/var/lib/tor
    restart: unless-stopped
    command: >
      sh -c "
      echo 'SOCKSPort 0.0.0.0:9050' > /etc/tor/torrc &&
      echo 'ControlPort 0.0.0.0:9051' >> /etc/tor/torrc &&
      echo 'CookieAuthentication 1' >> /etc/tor/torrc &&
      echo 'HiddenServiceDir /var/lib/tor/hidden_service/' >> /etc/tor/torrc &&
      echo 'HiddenServicePort 10009 lndnode:10009' >> /etc/tor/torrc &&
      echo 'HiddenServiceVersion 3' >> /etc/tor/torrc &&
      tor -f /etc/tor/torrc
      "

  lndnode:
    image: lightninglabs/lndinit:v0.1.33-beta-lnd-v0.20.0-beta
    container_name: lndnode
    user: root
    hostname: lnd
    entrypoint: 
      - sh
      - -c
      - |
        if [[ ! -f /root/seed.txt ]]; then
          lndinit gen-seed > /root/seed.txt
        fi
        if [[ ! -f /root/walletpassword.txt ]]; then
          lndinit gen-password > /root/walletpassword.txt
        fi
        lndinit -v init-wallet \
          --secret-source=file \
          --file.seed=/root/seed.txt \
          --file.wallet-password=/root/walletpassword.txt \
          --init-file.output-wallet-dir=/root/.lnd/data/chain/bitcoin/regtest \
          --init-file.validate-password
        mkdir -p /root/.lnd
        if [ ! -f "/root/.lnd/umbrel-lnd.conf" ]; then
          touch "/root/.lnd/umbrel-lnd.conf"
        fi
        # Remove old TLS cert if it exists to force regeneration with correct hostname
        if [ -f "/root/.lnd/tls.cert" ]; then
          rm -f /root/.lnd/tls.cert /root/.lnd/tls.key
        fi
        # Start LND with correct lnddir and exec to run in foreground
        exec lnd --lnddir=/root/.lnd --listen=0.0.0.0:9735 --rpclisten=0.0.0.0:10009 --restlisten=0.0.0.0:8080 --bitcoin.active --bitcoin.regtest --bitcoin.node=bitcoind --bitcoind.rpchost=bitcoind --bitcoind.rpcuser=user --bitcoind.rpcpass=pass --bitcoind.zmqpubrawblock=tcp://bitcoind:28332 --bitcoind.zmqpubrawtx=tcp://bitcoind:28333 --configfile=/root/.lnd/umbrel-lnd.conf --wallet-unlock-password-file=/root/walletpassword.txt --wallet-unlock-allow-create --rpcmiddleware.enable --tlsextradomain=lnd --tlsextraip=127.0.0.1
    ports:
      - "9735:9735"
      - "10009:10009"
      - "8080:8080"
    volumes:
      - lndnode-data:/root/.lnd
    restart: unless-stopped
    depends_on:
      - bitcoind

  litd:
    image: "lightninglabs/lightning-terminal:v0.14.1-alpha-path-prefix"
    container_name: litd
    restart: unless-stopped
    dns:
      - 8.8.8.8
      - 8.8.4.4
    expose:
      - "8080"
    ports:
      - "8081:8080"
    volumes:
      - "litd-data:/root/.lit"
      - "lndnode-data:/root/.lnd:ro"
    depends_on:
      - bitcoind
      - lndnode
    entrypoint:
      - sh
      - -c
      - |
        echo "Waiting for LND files in /root/.lnd..."
        while [ ! -f /root/.lnd/tls.cert ]; do
          sleep 2
        done
        while [ ! -f /root/.lnd/data/chain/bitcoin/regtest/admin.macaroon ]; do
          sleep 2
        done
        echo "LND files found, starting litd..."
        exec litd "$$@"
    command:
      - "--insecure-httplisten=0.0.0.0:8080"
      - "--network=regtest"
      - "--uipassword=password123"
      - "--lnd-mode=remote"
      - "--remote.lnd.rpcserver=lnd:10009"
      - "--remote.lnd.macaroonpath=/root/.lnd/data/chain/bitcoin/regtest/admin.macaroon"
      - "--remote.lnd.tlscertpath=/root/.lnd/tls.cert"
      - "--faraday.connect_bitcoin"
      - "--faraday.bitcoin.host=bitcoind:18443"
      - "--faraday.bitcoin.user=user"
      - "--faraday.bitcoin.password=pass"
      - "--autopilot.disable"
      - "--remote.lit-debuglevel=trace"


  cln:
    image: elementsproject/lightningd:v25.05
    container_name: cln
    user: root
    entrypoint:
      - sh 
      - -c
      - |
        # Install NWC plugin
        if [ ! -f "/usr/local/libexec/c-lightning/plugins/cln-nip47" ]; then
          apt-get update && apt-get install -y wget
          cd /tmp
          wget -O nwc.tar.gz https://github.com/daywalker90/cln-nip47/releases/download/v0.1.3/cln-nip47-v0.1.3-x86_64-linux-gnu.tar.gz
          tar xzf nwc.tar.gz
          chmod +x cln-nip47
          mv cln-nip47 /usr/local/libexec/c-lightning/plugins/cln-nip47
        fi
        lightningd \
          --network=regtest \
          --bitcoin-rpcconnect=bitcoind \
          --bitcoin-rpcport=18443 \
          --bitcoin-rpcuser=user \
          --bitcoin-rpcpassword=pass \
          --addr=cln:9835 \
          --grpc-port=9996 \
          --plugin=/usr/local/libexec/c-lightning/plugins/cln-nip47 \
          --nip47-relays=wss://relay.damus.io
    ports:
      - "9835:9835"
      - "9996:9996"
    volumes:
      - cln-data:/root/.lightning:rw
      - /cln-socket:/root/.lightning/regtest
    depends_on:
      - bitcoind

  eclair:
    image: acinq/eclair:release-0.8.0
    container_name: eclair
    user: root
    environment:
      - JAVA_OPTS=-Xmx512m -Declair.chain=regtest -Declair.server.public-ips.0=eclair -Declair.server.port=9945 -Declair.api.enabled=true -Declair.api.binding-ip=0.0.0.0 -Declair.api.port=8282 -Declair.api.password=eclairpass -Declair.bitcoind.host=bitcoind -Declair.bitcoind.rpcport=18443 -Declair.bitcoind.rpcuser=user -Declair.bitcoind.rpcpassword=pass -Declair.bitcoind.zmqblock=tcp://bitcoind:28334 -Declair.bitcoind.zmqtx=tcp://bitcoind:28333 -Declair.bitcoind.wallet=new_wallet -Declair.node-alias=eclair-node -Declair.trampoline-payments-enable=true
    ports:
      - "9945:9945"  # P2P port
      - "8282:8282"  # API port
    volumes:
      - eclair-data:/data
    restart: unless-stopped
    depends_on:
      - bitcoind

volumes:
  bitcoin_data:
  lndnode-data:
  litd-data:
  cln-data:
  eclair-data:
  tor-data: