RTL/docker/bin/b-cli

21 lines
467 B
Text
Raw Permalink Normal View History

#!/usr/bin/env bash
Rebuild the regtest dev fixture: bitcoind + 3 LND nodes + RTL The setup in docker/ has been unable to start since Feb 2021. The boltz service added in f817ae39 references BOLTZ_* variables that are not in .env (so its ports render as ":" and compose rejects the file with "invalid proto"), a ./boltz build context that has never existed in the repo, and boltz_data/boltz_shared volumes that are never declared. Because compose validates the whole project up front, this broke every service: "docker compose up -d bitcoind", the first command in the README, failed too. Rather than repair a five-year-old file pinned to bitcoind 0.19.0 and lnd 0.12.0-beta, this replaces it. What changed: - bitcoind 30.0 and 3x lnd 0.20.0-beta, using Polar's images. They are multi-arch, so nothing is built locally and this works on arm64. The old setup built bitcoind and lnd from local Dockerfiles. - Three nodes, not one: alice -> bob -> carol. bob forwards, so RTL's routing and forwarding screens have data. Two nodes leave them empty. - scripts/seed.sh funds the nodes, opens channels, and makes payments with fixed amounts. A fresh run reproduces identical state, so screenshots taken before and after a change differ only by the change. It is deliberately not idempotent and refuses to run against a seeded network, since re-running would double-fund it. - rtl/RTL-Config.regtest.json configures all three nodes. RTL rewrites its config on startup, so an init container stages a copy into a volume: a read-only bind mount makes RTL exit with EROFS, and a writable one would let RTL modify a tracked file. It is not named RTL-Config.json because .gitignore matches that bare name at any depth. - bin/ln-cli now takes a node name and passes --lnddir=/home/lnd/.lnd, because 'docker compose exec' lands as root while lnd's datadir is under /home/lnd. Both helpers use compose v2. - README rewritten to match. Boltz, Core Lightning and Eclair are left out of this pass. Polar publishes multi-arch clightning and eclair images, so adding them later needs compose services, config entries and seed adapters, but no image building. Verified from a clean 'down -v': all nodes sync, channels go active, 5/5 payments route through bob, bob records 5 forwards, and RTL serves the UI with all three nodes configured. Two independent from-scratch runs produced identical balances. The old bitcoind/ and lnd/ build contexts are now unreferenced but left in place for a follow-up.
2026-07-15 23:09:03 -07:00
#
# bitcoin-cli against the regtest fixture.
#
# bin/b-cli getblockchaininfo
# bin/b-cli -rpcwallet=rtldev getbalance
# bin/b-cli -rpcwallet=rtldev generatetoaddress 6 <address>
Rebuild the regtest dev fixture: bitcoind + 3 LND nodes + RTL The setup in docker/ has been unable to start since Feb 2021. The boltz service added in f817ae39 references BOLTZ_* variables that are not in .env (so its ports render as ":" and compose rejects the file with "invalid proto"), a ./boltz build context that has never existed in the repo, and boltz_data/boltz_shared volumes that are never declared. Because compose validates the whole project up front, this broke every service: "docker compose up -d bitcoind", the first command in the README, failed too. Rather than repair a five-year-old file pinned to bitcoind 0.19.0 and lnd 0.12.0-beta, this replaces it. What changed: - bitcoind 30.0 and 3x lnd 0.20.0-beta, using Polar's images. They are multi-arch, so nothing is built locally and this works on arm64. The old setup built bitcoind and lnd from local Dockerfiles. - Three nodes, not one: alice -> bob -> carol. bob forwards, so RTL's routing and forwarding screens have data. Two nodes leave them empty. - scripts/seed.sh funds the nodes, opens channels, and makes payments with fixed amounts. A fresh run reproduces identical state, so screenshots taken before and after a change differ only by the change. It is deliberately not idempotent and refuses to run against a seeded network, since re-running would double-fund it. - rtl/RTL-Config.regtest.json configures all three nodes. RTL rewrites its config on startup, so an init container stages a copy into a volume: a read-only bind mount makes RTL exit with EROFS, and a writable one would let RTL modify a tracked file. It is not named RTL-Config.json because .gitignore matches that bare name at any depth. - bin/ln-cli now takes a node name and passes --lnddir=/home/lnd/.lnd, because 'docker compose exec' lands as root while lnd's datadir is under /home/lnd. Both helpers use compose v2. - README rewritten to match. Boltz, Core Lightning and Eclair are left out of this pass. Polar publishes multi-arch clightning and eclair images, so adding them later needs compose services, config entries and seed adapters, but no image building. Verified from a clean 'down -v': all nodes sync, channels go active, 5/5 payments route through bob, bob records 5 forwards, and RTL serves the UI with all three nodes configured. Two independent from-scratch runs produced identical balances. The old bitcoind/ and lnd/ build contexts are now unreferenced but left in place for a follow-up.
2026-07-15 23:09:03 -07:00
set -euo pipefail
cd "$(dirname "$0")/.."
# shellcheck disable=SC1091
source .env
Rebuild the regtest dev fixture: bitcoind + 3 LND nodes + RTL The setup in docker/ has been unable to start since Feb 2021. The boltz service added in f817ae39 references BOLTZ_* variables that are not in .env (so its ports render as ":" and compose rejects the file with "invalid proto"), a ./boltz build context that has never existed in the repo, and boltz_data/boltz_shared volumes that are never declared. Because compose validates the whole project up front, this broke every service: "docker compose up -d bitcoind", the first command in the README, failed too. Rather than repair a five-year-old file pinned to bitcoind 0.19.0 and lnd 0.12.0-beta, this replaces it. What changed: - bitcoind 30.0 and 3x lnd 0.20.0-beta, using Polar's images. They are multi-arch, so nothing is built locally and this works on arm64. The old setup built bitcoind and lnd from local Dockerfiles. - Three nodes, not one: alice -> bob -> carol. bob forwards, so RTL's routing and forwarding screens have data. Two nodes leave them empty. - scripts/seed.sh funds the nodes, opens channels, and makes payments with fixed amounts. A fresh run reproduces identical state, so screenshots taken before and after a change differ only by the change. It is deliberately not idempotent and refuses to run against a seeded network, since re-running would double-fund it. - rtl/RTL-Config.regtest.json configures all three nodes. RTL rewrites its config on startup, so an init container stages a copy into a volume: a read-only bind mount makes RTL exit with EROFS, and a writable one would let RTL modify a tracked file. It is not named RTL-Config.json because .gitignore matches that bare name at any depth. - bin/ln-cli now takes a node name and passes --lnddir=/home/lnd/.lnd, because 'docker compose exec' lands as root while lnd's datadir is under /home/lnd. Both helpers use compose v2. - README rewritten to match. Boltz, Core Lightning and Eclair are left out of this pass. Polar publishes multi-arch clightning and eclair images, so adding them later needs compose services, config entries and seed adapters, but no image building. Verified from a clean 'down -v': all nodes sync, channels go active, 5/5 payments route through bob, bob records 5 forwards, and RTL serves the UI with all three nodes configured. Two independent from-scratch runs produced identical balances. The old bitcoind/ and lnd/ build contexts are now unreferenced but left in place for a follow-up.
2026-07-15 23:09:03 -07:00
exec docker compose exec -T bitcoind bitcoin-cli \
-regtest \
-rpcuser="$BITCOIN_RPC_USER" \
-rpcpassword="$BITCOIN_RPC_PASSWORD" \
-rpcport="$BITCOIN_RPC_PORT" \
"$@"