Skip to content

Commit

Permalink
fixup merge
Browse files Browse the repository at this point in the history
fixup readme

debug ci

remove debug

open lnd-3 ports fors lnbits regtests
  • Loading branch information
dni committed Jul 26, 2024
1 parent b9fbcbf commit 905811c
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 98 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ jobs:
- uses: actions/checkout@v2
- name: Run tests
run: |
chmod +x ./regtest
./regtest
git clone https://github.com/lnbits/lnbits
docker build -t lnbits/lnbits lnbits
chmod +x ./start-regtest
./start-regtest
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
![TESTS](https://github.com/BoltzExchange/legend-regtest-enviroment/actions/workflows/ci.yml/badge.svg)
![TESTS](https://github.com/lnbits/legend-regtest-enviroment/actions/workflows/ci.yml/badge.svg)

# nodes
* lnd-1: for locally testing
* lnd-1: for locally testing your current lnbits
* lnd-2: used for boltz backend
* cln-1: for locally testing
* 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
Expand Down Expand Up @@ -62,9 +65,6 @@ source docker-scripts.sh
# use bitcoin core, mine a block
bitcoin-cli-sim -generate 1

# use elements, mine a liquid 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
Expand All @@ -78,6 +78,7 @@ lncli-sim 2 listpeers
# urls
* boltz api: http://localhost:9001/
* lnd-1 rest: http://localhost:8081/
* lnbits: http://localhost:5001/

# debugging docker logs
```sh
Expand Down
30 changes: 0 additions & 30 deletions data/boltz/boltz.conf
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,6 @@ minSwapAmount = 10_000
swapMaximal = 1050
swapTaproot = 300

[[pairs]]
base = "RBTC"
quote = "BTC"
rate = 1
fee = 0.5

maxSwapAmount = 4_294_967
minSwapAmount = 10_000

[pairs.timeoutDelta]
reverse = 1440
swapMinimal = 1000
swapMaximal = 1050
swapTaproot = 1440

[[currencies]]
symbol = "BTC"
network = "bitcoinRegtest"
Expand Down Expand Up @@ -98,18 +83,3 @@ maxZeroConfAmount = 40_294_967
cookie = "/root/.elements/liquid.cookie"
zmqpubrawtx = "tcp://elementsd:31000"
zmqpubhashblock = "tcp://elementsd:31002"


[rsk]
providerEndpoint = "http://anvil:8545"

etherSwapAddress = "0x5fbdb2315678afecb367f032d93f642f64180aa3"
erc20SwapAddress = "0xe7f1725e7734ce288f8367e1bb143e90bb3f0512"

[[rsk.tokens]]
symbol = "RBTC"

maxSwapAmount = 4_294_96700
minSwapAmount = 10000

minWalletBalance = 100_000_000
100 changes: 64 additions & 36 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ services:
image: lnbits/lnbits
restart: on-failure
user: "0:0"
entrypoint: "sh -c 'sleep 30; poetry run lnbits'"
environment:
HOST: lnbits
PORT: 5001
DEBUG: true
LNBITS_HOST: lnbits
LNBITS_PORT: 5001
LNBITS_BACKEND_WALLET_CLASS: "LndRestWallet"
LNBITS_DATA_FOLDER: "./data"
LND_REST_ENDPOINT: "https://lnd-3:8081/"
Expand All @@ -25,7 +23,7 @@ services:
bitcoind:
hostname: bitcoind
restart: always
image: boltz/bitcoin-core:24.0.1
image: boltz/bitcoin-core:27.1
command:
- -regtest
- -fallbackfee=0.00000253
Expand All @@ -34,6 +32,13 @@ services:
- -txindex
- -rpcallowip=0.0.0.0/0
- -rpcbind=0.0.0.0
# eclair
# - -rpcuser=lnbits
# - -rpcpassword=lnbits
# - -dbcache=2048
# - -rpcworkqueue=128
# - -rpcclienttimeout=30

expose:
- 18444
ports:
Expand All @@ -57,6 +62,8 @@ services:
- 18884:18884
volumes:
- ./data/elements/elements.conf:/home/elements/.elements/elements.conf
volumes_from:
- bitcoind:ro

clightning-1:
hostname: clightning-1
Expand Down Expand Up @@ -87,17 +94,28 @@ services:

clightning-2:
hostname: clightning-2
restart: always
depends_on:
- bitcoind
image: boltz/c-lightning:22.11.1
entrypoint: "sh -c 'sleep 15 && lightningd --large-channels --network regtest --grpc-port 9737 --bind-addr=0.0.0.0:9735 --bitcoin-rpcconnect=bitcoind --bitcoin-rpcport=18443 --bitcoin-rpcuser=lnbits --bitcoin-rpcpassword=lnbits'"
image: boltz/c-lightning:23.08.1
command:
- --large-channels
- --network
- regtest
- --bind-addr=0.0.0.0:9735
- --bitcoin-rpcconnect=bitcoind
- --bitcoin-rpcport=18443
- --grpc-port=9736
- --dev-bitcoind-poll=3
- --dev-fast-gossip
- --experimental-offers
- --experimental-dual-fund
expose:
- 9735
ports:
- 9737:9737
- 9736
volumes:
- ./data/clightning-2:/root/.lightning/
volumes_from:
- bitcoind:ro

clightning-2-rest:
hostname: clightning-2-rest
Expand Down Expand Up @@ -134,7 +152,7 @@ services:
- 9735
- 9736
volumes:
- ./data/clightning-2:/root/.lightning/
- ./data/clightning-3:/root/.lightning/
volumes_from:
- bitcoind:ro

Expand All @@ -161,9 +179,6 @@ services:
- 8081
- 9735
- 10009
ports:
- 8081:8081
- 10009:10009
volumes:
- ./data/lnd-1:/root/.lnd/
volumes_from:
Expand Down Expand Up @@ -191,42 +206,57 @@ services:
expose:
- 8081
- 9735
ports:
- 11009:10009
- 10009
volumes:
- ./data/lnd-2:/root/.lnd/
volumes_from:
- bitcoind:ro

lnd-3:
hostname: lnd-3
depends_on:
- bitcoind
image: boltz/lnd:0.17.4-beta
restart: on-failure
entrypoint: "sh -c 'sleep 20; lnd --listen=lnd-3:9735 --rpclisten=lnd-3:10009 --restlisten=lnd-3:8081 --bitcoin.active --bitcoin.regtest --bitcoin.node=bitcoind --bitcoind.rpchost=bitcoind --bitcoind.zmqpubrawtx=bitcoind:29000 --bitcoind.zmqpubrawblock=bitcoind:29001 --bitcoind.rpcuser=lnbits --bitcoind.rpcpass=lnbits --noseedbackup --protocol.wumbo-channels'"
ports:
- 8081:8081
- 10009:10009
command:
- --listen=lnd-3:9735
- --rpclisten=lnd-3:10009
- --restlisten=lnd-3:8081
- --bitcoin.active
- --bitcoin.regtest
- --bitcoin.node=bitcoind
- --bitcoind.rpchost=bitcoind
- --bitcoind.zmqpubrawtx=bitcoind:29000
- --bitcoind.zmqpubrawblock=bitcoind:29001
- --bitcoind.rpccookie=/root/.bitcoin/regtest/.cookie
- --noseedbackup
- --protocol.wumbo-channels
expose:
- 8081
- 9735
- 10009
ports:
- 8081:8081
- 10009:10009
volumes:
- ./data/lnd-3:/root/.lnd/
volumes_from:
- bitcoind:ro

eclair:
hostname: eclair
depends_on:
- bitcoind
image: boltz/eclair:0.8.0
restart: on-failure
entrypoint: "sh -c 'JAVA_OPTS=-Xmx512m /eclair-node/bin/eclair-node.sh -Declair.datadir=/root/eclair -Declair.printToConsole'"
ports:
- 8082:8080
expose:
- 9735
- 8080
volumes:
- ./data/eclair:/root/eclair
# eclair:
# hostname: eclair
# depends_on:
# - bitcoind
# image: boltz/eclair:0.8.0
# restart: on-failure
# entrypoint: "sh -c 'JAVA_OPTS=-Xmx512m /eclair-node/bin/eclair-node.sh -Declair.datadir=/root/eclair -Declair.printToConsole'"
# ports:
# - 8082:8080
# expose:
# - 9735
# - 8080
# volumes:
# - ./data/eclair:/root/eclair

boltz:
hostname: boltz
Expand Down Expand Up @@ -325,5 +355,3 @@ services:

volumes:
lnbits-data:
volumes_from:
- bitcoind:ro
39 changes: 23 additions & 16 deletions docker-scripts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ regtest-start-log(){
regtest-stop(){
docker compose down --volumes
# clean up lightning node data
sudo rm -rf ./data/clightning-1 ./data/clightning-2 ./data/lnd-1 ./data/lnd-2 ./data/boltz/boltz.db ./data/elements/liquidregtest ./data/bitcoin/regtest
sudo rm -rf ./data/clightning-1 ./data/clightning-2 ./data/clightning-3 ./data/lnd-1 ./data/lnd-2 ./data/lnd-3 ./data/boltz/boltz.db ./data/elements/liquidregtest ./data/bitcoin/regtest
# recreate lightning node data folders preventing permission errors
mkdir ./data/clightning-1 ./data/clightning-2 ./data/lnd-1 ./data/lnd-2
mkdir ./data/clightning-1 ./data/clightning-2 ./data/clightning-3 ./data/lnd-1 ./data/lnd-2 ./data/lnd-3
}

regtest-restart(){
Expand Down Expand Up @@ -159,23 +159,29 @@ elements-init(){
}

boltz-client-init(){
boltzcli-sim wallet create lnbits LBTC
echo "boltz-client-init..."
# boltzcli-sim wallet create lnbits LBTC
# boltzcli-sim formatmacaroon
}

lightning-sync(){
wait-for-clightning-sync 1
wait-for-clightning-sync 2
wait-for-clightning-sync 3
wait-for-lnd-sync 1
wait-for-lnd-sync 2
wait-for-lnd-sync 3
}

lightning-init(){
# create 10 UTXOs for each node
for i in 0 1 2; do
fund_clightning_node 1
fund_clightning_node 2
fund_clightning_node 3
fund_lnd_node 1
fund_lnd_node 2
fund_lnd_node 3
done

echo "mining 3 blocks..."
Expand Down Expand Up @@ -246,24 +252,25 @@ lightning-init(){
bitcoin-cli-sim -generate $channel_confirms > /dev/null
wait-for-lnd-channel 3

# lnd-1 -> eclair-1
lncli-sim 1 connect $(get-eclair-pubkey)@lnbits-eclair-1 > /dev/null
echo "open channel from lnd-2 to eclair-1"
lncli-sim 1 openchannel $(get-eclair-pubkey) $channel_size $balance_size > /dev/null
bitcoin-cli-sim -generate $channel_confirms > /dev/null
wait-for-lnd-channel 1
# # lnd-1 -> eclair-1
# lncli-sim 1 connect $(get-eclair-pubkey)@lnbits-eclair-1 > /dev/null
# echo "open channel from lnd-2 to eclair-1"
# lncli-sim 1 openchannel $(get-eclair-pubkey) $channel_size $balance_size > /dev/null
# bitcoin-cli-sim -generate $channel_confirms > /dev/null
# wait-for-lnd-channel 1

# lnd-2 -> eclair-1
lncli-sim 2 connect $(get-eclair-pubkey)@lnbits-eclair-1 > /dev/null
echo "open channel from lnd-2 to eclair-1"
lncli-sim 2 openchannel $(get-eclair-pubkey) $channel_size $balance_size > /dev/null
bitcoin-cli-sim -generate $channel_confirms > /dev/null
wait-for-lnd-channel 2
# # lnd-2 -> eclair-1
# lncli-sim 2 connect $(get-eclair-pubkey)@lnbits-eclair-1 > /dev/null
# echo "open channel from lnd-2 to eclair-1"
# lncli-sim 2 openchannel $(get-eclair-pubkey) $channel_size $balance_size > /dev/null
# bitcoin-cli-sim -generate $channel_confirms > /dev/null
# wait-for-lnd-channel 2

wait-for-clightning-channel 1
wait-for-clightning-channel 2
wait-for-clightning-channel 3

wait-for-eclair-channel
# wait-for-eclair-channel

lightning-sync
}
Expand Down
Loading

0 comments on commit 905811c

Please sign in to comment.