Skip to content

Instantly share code, notes, and snippets.

@chrisguida
Last active March 28, 2025 17:47
Show Gist options
  • Save chrisguida/afbb23b30e6257a3193a76d887dd51ef to your computer and use it in GitHub Desktop.
Save chrisguida/afbb23b30e6257a3193a76d887dd51ef to your computer and use it in GitHub Desktop.
Deploy boltz-backend and boltz-web-app for mutinynet on debian

prerequisites

make sure you have rust, postgresql17, some other dev libs, and bitcoin/CLN running on mutinynet

rust

google rustup install, follow instructions, then make sure rustc --version does something

postgresql17, libssl-dev, libpq-dev, rsync

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt bookworm-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt update
sudo apt install -y postgresql-17 postgresql-client-17 libssl-dev libpq-dev rsync

give instance-level permissions:

sudo -u postgres psql
CREATE USER boltz WITH PASSWORD 'boltz';
CREATE DATABASE boltz;
GRANT ALL PRIVILEGES ON DATABASE boltz TO boltz;
\q

give database-level permissions:

sudo -u postgres psql -d boltz
GRANT USAGE, CREATE ON SCHEMA public TO boltz;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO boltz;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON TABLES TO boltz;

bitcoin/CLN on mutinynet

this is left as an exercise to the reader

hint: make sure you have a wallet loaded, e.g.:

bitcoin-cli createwallet "boltz"

add this to your config:

wallet=boltz
zmqpubrawtx=tcp://0.0.0.0:29000
zmqpubrawblock=tcp://0.0.0.0:29001
zmqpubhashblock=tcp://0.0.0.0:29002

boltz-backend

see documentation at https://docs.boltz.exchange/api/deployment

install node

nvm

https://github.com/nvm-sh/nvm?tab=readme-ov-file#install--update-script

(probably something like curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.2/install.sh | bash)

node

nvm install --lts

boltz-backend

mkdir -p ~/code && cd ~/code
git clone https://github.com/boltzexchange/boltz-backend
cd boltz-backend
npm install

hold plugin

git submodule init && git submodule update
cd hold
cargo build --release

assuming you have CLN running as the cln systemd service with the cln user:

sudo mkdir -p /home/cln/cln-plugins-enabled
sudo cp target/release/hold /home/cln/cln-plugins-enabled/
sudo chown -R cln:cln /home/cln/cln-plugins-enabled

then edit your config:

sudo vim /home/cln/.lightning/config

and make sure the plugin-dir is there:

plugin-dir=/home/cln/cln-plugins-enabled

then restart CLN:

sudo systemctl restart cln

make sure the hold plugin starts:

lightning-cli plugin list | grep hold

make sure the client-key.pem file is readable by the current user (which presumably is in the cln group):

sudo chmod g+r /home/cguida/.lightning/signet/hold/client-key.pem

copy this into ~/.boltz/boltz.conf:

[postgres]
host = "127.0.0.1"
port = 5432
database = "boltz"
username = "boltz"
password = "boltz"

[nodeSwitch]
clnAmountThreshold = 1_000_000

[swap]
deferredClaimSymbols = ["BTC", "L-BTC"]

[[pairs]]
base = "BTC"
quote = "BTC"
rate = 1
fee = 0.4
swapInFee = 0.2

invoiceExpiry = 361

maxSwapAmount = 4_294_967
minSwapAmount = 50_000

    [pairs.timeoutDelta]
    reverse = 1440
    swapMinimal = 1440
    swapMaximal = 2880
    swapTaproot = 10080

[[currencies]]
symbol = "BTC"
network = "bitcoinRegtest"
minWalletBalance = 10_000_000
minLocalBalance = 10_000_000
minRemoteBalance = 10_000_000
maxSwapAmount = 4_294_967
minSwapAmount = 50_000
maxZeroConfAmount = 0
preferredWallet = "core"

    [currencies.chain]
    host = "127.0.0.1"
    port = 38_332
    #cookie = "docker/regtest/data/core/cookies/.bitcoin-cookie"
    cookie = "/home/cguida/.bitcoin/signet/.cookie"

    [currencies.lnd]
    host = "127.0.0.1"
    port = 10_009
    certpath = "docker/regtest/data/lnd/certificates/tls.cert"
    macaroonpath = "docker/regtest/data/lnd/macaroons/admin.macaroon"

    [currencies.cln]
    host = "127.0.0.1"
    port = 9736
    # port = 9645
    rootCertPath = "/home/cguida/.lightning/signet/ca.pem"
    privateKeyPath = "/home/cguida/.lightning/signet/client-key.pem"
    certChainPath = "/home/cguida/.lightning/signet/client.pem"

        [currencies.cln.hold]
        host = "127.0.0.1"
        port = 9292
        #rootCertPath = "docker/regtest/home/cguida/.lightning/hold/ca.pem"
        #privateKeyPath = "docker/regtest/home/cguida/.lightning/hold/client-key.pem"
        #certChainPath = "docker/regtest/home/cguida/.lightning/hold/client.pem"
        rootCertPath = "/home/cguida/.lightning/signet/hold/ca.pem"
        privateKeyPath = "/home/cguida/.lightning/signet/hold/client-key.pem"
        certChainPath = "/home/cguida/.lightning/signet/hold/client.pem"

[sidecar]
  [sidecar.grpc]
  host = "127.0.0.1"
  port = 9003

  [sidecar.webhook]
  retryInterval = 60

  [sidecar.metrics]
  host = "127.0.0.1"
  port = 9093

  [sidecar.api]
  host = "127.0.0.1"
  port = 9005

  [sidecar.ws]
  host = "0.0.0.0"
  port = 9004

Now run the backend server

npm run dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment