Skip to content
This repository has been archived by the owner on Jul 26, 2024. It is now read-only.

Commit

Permalink
feat: add boltz-client
Browse files Browse the repository at this point in the history
- added `clightning-2` for use with boltz-client
  • Loading branch information
dni committed Mar 25, 2024
1 parent 4b32702 commit 350f3ce
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 1 deletion.
39 changes: 39 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@ services:
- ./data/boltz/:/root/.boltz/
- ./data/elements/:/root/.elements/

boltz-client:
hostname: boltz-client
depends_on:
- clightning-2
- elementsd
- bitcoind
restart: always
image: boltz/boltz-client:latest
ports:
- 9002:9002
volumes:
- ./data/clightning-2:/data/clightning/
- ./data/boltz/:/root/.boltz/
- ./data/elements/:/root/.elements/

anvil:
hostname: anvil
image: ghcr.io/foundry-rs/foundry:latest
Expand Down Expand Up @@ -84,6 +99,30 @@ services:
volumes:
- ./data/clightning-1:/root/.lightning/

clightning-2:
hostname: clightning-2
restart: always
depends_on:
- bitcoind
image: boltz/c-lightning:23.08.1
command:
- --large-channels
- --network
- regtest
- --bind-addr=0.0.0.0:9737
- --bitcoin-rpcconnect=bitcoind
- --bitcoin-rpcport=18443
- --bitcoin-rpcuser=regtest
- --bitcoin-rpcpassword=regtest
- --grpc-port=9738
- --dev-bitcoind-poll=3
expose:
- 9737
ports:
- 9738:9738
volumes:
- ./data/clightning-2:/root/.lightning/

lnd-1:
hostname: lnd-1
depends_on:
Expand Down
26 changes: 26 additions & 0 deletions docker-scripts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ elements-cli-sim() {
docker exec regtest-elementsd-1 elements-cli "$@"
}

boltz-cli-sim() {
docker exec regtest-boltz-client-1 boltzcli "$@"
}

bitcoin-address() {
curl localhost:3002/address/"$1" | jq .
}
Expand Down Expand Up @@ -116,11 +120,17 @@ elements-init(){
elements-cli-sim rescanblockchain 0 > /dev/null
}

boltz-client-init(){
boltzcli-sim wallet create lnbits LBTC
boltzcli-sim formatmacaroon
}

regtest-init(){
bitcoin-init
elements-init
lightning-sync
lightning-init
boltz-client-init
}

lightning-sync(){
Expand Down Expand Up @@ -169,6 +179,22 @@ lightning-init(){
wait-for-lnd-channel 2
wait-for-clightning-channel 1

# lnd-1 -> cln-2
lncli-sim 1 connect $(lightning-cli-sim 2 getinfo | jq -r '.id')@regtest-clightning-2-1 > /dev/null
echo "open channel from lnd-1 to cln-2"
lncli-sim 1 openchannel $(lightning-cli-sim 2 getinfo | jq -r '.id') $channel_size $balance_size > /dev/null
bitcoin-cli-sim -generate $channel_confirms > /dev/null
wait-for-lnd-channel 1
wait-for-clightning-channel 2

# lnd-2 -> cln-2
lncli-sim 2 connect $(lightning-cli-sim 2 getinfo | jq -r '.id')@regtest-clightning-2-1 > /dev/null
echo "open channel from lnd-2 to cln-2"
lncli-sim 2 openchannel $(lightning-cli-sim 2 getinfo | jq -r '.id') $channel_size $balance_size > /dev/null
bitcoin-cli-sim -generate $channel_confirms > /dev/null
wait-for-lnd-channel 2
wait-for-clightning-channel 2

lightning-sync

}
Expand Down
2 changes: 1 addition & 1 deletion regtest
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ for i in 1 2; do
run "lnd-$i .channels[0].capacity" $channel_size $(lncli-sim $i listchannels | jq -r ".channels[0].capacity")
run "lnd-$i .channels[0].push_amount_sat" $balance_size $(lncli-sim $i listchannels | jq -r ".channels[0].push_amount_sat")
done
for i in 1; do
for i in 1 2; do
# run "cln-$i blockheight" $blockheight $(lightning-cli-sim $i getinfo | jq -r ".blockheight")
run "cln-$i utxo count" $utxos $(lightning-cli-sim $i listfunds | jq -r ".outputs | length")
run "cln-$i openchannels" $channel_count $(lightning-cli-sim $i getinfo | jq -r ".num_active_channels")
Expand Down

0 comments on commit 350f3ce

Please sign in to comment.