Bitcoin/Lightning regtest environment for local development (fork of lnbits/legend-regtest-enviroment)
  • Shell 99.1%
  • Dockerfile 0.9%
Find a file
Padreug 0ca8f03a9d
Some checks failed
ci / regtest (push) Has been cancelled
fix(bitcoind): accept lnbits/lnbits rpcauth alongside cookie
The lnbits regtest test harness (tests/regtest/helpers.py) authenticates to
bitcoind with -rpcuser=lnbits -rpcpassword=lnbits, but bitcoind was cookie-only,
so mine_blocks / pay_onchain / create_onchain_address (and any bitcoind-using
regtest test) failed with "Incorrect rpcuser or rpcpassword".

Add -rpcauth for user lnbits (password lnbits). rpcauth does not set
rpcpassword, so the auto-generated .cookie is still produced and the LN nodes'
--bitcoind.rpccookie auth keeps working. Verified: both cookie and
lnbits/lnbits creds authenticate; wrong creds rejected. Surfaced while
validating aiolabs/lnbits#53 (native on-chain receive/send) against real lnd-1.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 22:53:16 +02:00
.github/workflows feat: add boltz client client (#20) 2025-12-22 09:17:28 +01:00
data feat: add boltz client client (#20) 2025-12-22 09:17:28 +01:00
fava create custom fava image to have latest version 2026-01-19 08:45:04 -05:00
.gitignore dev compose: add nsecbunker service, build from aiolabs fork checkout 2026-05-26 00:53:29 +02:00
CLAUDE.md local customizations: fava, litd, extensions path, lndconnect 2026-04-27 03:32:10 -04:00
docker-compose.dev.yml dev compose: drop Secure flag on auth cookies for HTTP LAN-IP dev 2026-06-09 23:11:34 +02:00
docker-compose.yml fix(bitcoind): accept lnbits/lnbits rpcauth alongside cookie 2026-06-15 22:53:16 +02:00
docker-scripts.sh feat: add boltz client client (#20) 2025-12-22 09:17:28 +01:00
LICENSE Initial commit 2022-06-15 14:53:49 +01:00
lnbits-entrypoint.sh regtest: rename castle → libra in default-installed extensions 2026-05-05 20:44:47 +02:00
lndconnect.sh local customizations: fava, litd, extensions path, lndconnect 2026-04-27 03:32:10 -04:00
pict-rs-nginx.conf dev-stack: front pict-rs with nginx CORS sidecar 2026-05-20 17:11:45 +02:00
README.md feat: add boltz client client (#20) 2025-12-22 09:17:28 +01:00
start-regtest start-regtest: use env-based bash shebang 2026-05-05 20:45:51 +02:00

TESTS

nodes

  • lnd-1: for locally testing your current lnbits
  • lnd-2: used for boltz backend
  • lnd-3: used for lnbits inside docker
  • cln-1: for locally testing your current lnbits
  • cln-2: used for clightning-REST
  • eclair-1: for locally testing your current lnbits

Installing regtest

get the regtest enviroment ready

# Install docker https://docs.docker.com/engine/install/
# Make sure your user has permission to use docker 'sudo usermod -aG docker ${USER}' then reboot
# Stop/start docker 'sudo systemctl stop docker' 'sudo systemctl start docker'

sudo apt install jq
git clone https://github.com/lnbits/lnbits.git
cd lnbits
docker build -t lnbits/lnbits .
mkdir docker
git clone https://github.com/lnbits/legend-regtest-enviroment.git docker
cd docker
chmod +x ./start-regtest
./start-regtest # start the regtest and also run tests
sudo chown -R $USER ./data # Give the data file permissions for user

Running LNbits on regtest

add this ENV variables to your .env file

DEBUG=true

# LND
LNBITS_BACKEND_WALLET_CLASS="LndRestWallet"
LND_REST_ENDPOINT=https://127.0.0.1:8081/
LND_REST_CERT=/home/user/repos/lnbits/docker/data/lnd-1/tls.cert
LND_REST_MACAROON=/home/user/repos/lnbits/docker/data/lnd-1/data/chain/bitcoin/regtest/admin.macaroon

# CLN
LNBITS_BACKEND_WALLET_CLASS="CoreLightningWallet"
CORELIGHTNING_RPC=./docker/data/clightning-1/regtest/lightning-rpc


# Run LNbits
uv run lnbits

# Run LNbits with hot reload
make dev

testing

chmod +x ./start-regtest
./start-regtest
# short answer :)
./start-regtest && echo "PASSED" || echo "FAILED" > /dev/null

usage of the bitcoin-cli-sim, lightning-cli-sim and lncli-sim aliases

cd ~/lnbits/docker
source docker-scripts.sh
# use bitcoin core, mine a block
bitcoin-cli-sim -generate 1

# use c-lightning nodes
lightning-cli-sim 1 newaddr | jq -r '.bech32' # use node 1
lightning-cli-sim 2 getinfo # use node 2
lightning-cli-sim 3 getinfo # use node 3

# use lnd nodes
lncli-sim 1 newaddr p2wsh
lncli-sim 2 listpeers

urls

debugging docker logs

docker logs lnbits-lnbits-1 -f
docker logs lnbits-boltz-1 -f
docker logs lnbits-clightning-1-1 -f
docker logs lnbits-lnd-2-1 -f