Skip to content

Commit

Permalink
add regtest
Browse files Browse the repository at this point in the history
  • Loading branch information
dni committed Nov 8, 2023
1 parent 84a8a8e commit f8919f0
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 28 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ docker/data/electrs/*
!docker/data/boltz
docker/data/boltz/*
!docker/data/boltz/boltz.conf

!docker/data/elements
docker/data/elements/*
!docker/data/elements/elements.conf
53 changes: 28 additions & 25 deletions docker/data/boltz/boltz.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ minSwapAmount = 10_000
swapMinimal = 1000
swapMaximal = 1050

#[[pairs]]
#base = "L-BTC"
#quote = "BTC"
#fee = 0.1
#rate = 1
#maxSwapAmount = 40_294_967
#minSwapAmount = 10_000
#
# [pairs.timeoutDelta]
# reverse = 1440
# swapMinimal = 1000
# swapMaximal = 1050
[[pairs]]
base = "L-BTC"
quote = "BTC"
fee = 0.1
rate = 1
maxSwapAmount = 40_294_967
minSwapAmount = 10_000

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

[[currencies]]
symbol = "BTC"
Expand All @@ -38,6 +38,7 @@ minSwapAmount = 10_000
maxZeroConfAmount = 0

[currencies.chain]
# mempoolSpace = "http://mempool-web:8090/api"
host = "bitcoind"
zmqpubrawtx = "tcp://bitcoind:29000"
zmqpubrawblock = "tcp://bitcoind:29001"
Expand All @@ -51,16 +52,18 @@ maxZeroConfAmount = 0
certpath = "/data/lnd/tls.cert"
macaroonpath = "/data/lnd/data/chain/bitcoin/regtest/admin.macaroon"

#[liquid]
#symbol = "L-BTC"
#network = "liquidRegtest"
#
#maxSwapAmount = 40_294_967
#minSwapAmount = 10_000
#
# [liquid.chain]
# host = "elementsd"
# port = 18884
# cookie = "/root/.elements/liquid.cookie"
# zmqpubrawtx = "tcp://elementsd:31000"
# zmqpubhashblock = "tcp://elementsd:31002"
[liquid]
symbol = "L-BTC"
network = "liquidRegtest"

maxSwapAmount = 40_294_967
minSwapAmount = 10_000

[liquid.chain]
host = "elementsd"
port = 18884
user = "boltz"
password = "boltz"
# cookie = "/root/.elements/liquid.cookie"
zmqpubrawtx = "tcp://elementsd:31000"
zmqpubhashblock = "tcp://elementsd:31002"
32 changes: 32 additions & 0 deletions docker/data/elements/elements.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
chain=liquidregtest
txindex=1

rpcuser=boltz
rpcpassword=boltz

# server
rest=1
server=1
rpcallowip=0.0.0.0/0

# liquid stuff
validatepegin=0
initialfreecoins=2100000000000000
fallbackfee=0.000001

[liquidregtest]
rpcbind=0.0.0.0
rpcport=18884

## Dynafed
con_dyna_deploy_start=0
con_dyna_deploy_signal=1
con_nminerconfirmationwindow=1
con_nrulechangeactivationthreshold=1

## Taproot signaling
con_taproot_signal_start=0

zmqpubrawtx=tcp://0.0.0.0:31000
zmqpubrawblock=tcp://0.0.0.0:31001
zmqpubhashblock=tcp://0.0.0.0:31002
51 changes: 49 additions & 2 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ services:
hostname: boltz
depends_on:
- lnd
- elementsd
- bitcoind
image: boltz/boltz:3.3.0
entrypoint: "sh -c 'sleep 40; /boltz-backend/bin/boltzd'"
ports:
Expand All @@ -13,6 +15,18 @@ services:
volumes:
- ./data/lnd:/data/lnd/
- ./data/boltz/:/root/.boltz/
- ./data/elements/:/root/.elements/

elementsd:
hostname: elements
image: ghcr.io/vulpemventures/elements:22.1.1
expose:
- 18884
- 31000
- 31001
- 31002
volumes:
- ./data/elements/:/home/elements/.elements/

bitcoind:
hostname: bitcoind
Expand All @@ -29,7 +43,7 @@ services:
depends_on:
- bitcoind
image: boltz/c-lightning:23.08.1
entrypoint: "sh -c 'sleep 15 && lightningd --large-channels --network regtest --bind-addr=0.0.0.0:9735 --bitcoin-rpcconnect=bitcoind --bitcoin-rpcport=18443 --bitcoin-rpcuser=boltz --bitcoin-rpcpassword=boltz'"
entrypoint: "sh -c 'sleep 15 && lightningd --dev-bitcoind-poll=1 --large-channels --network regtest --bind-addr=0.0.0.0:9735 --bitcoin-rpcconnect=bitcoind --bitcoin-rpcport=18443 --bitcoin-rpcuser=boltz --bitcoin-rpcpassword=boltz'"
expose:
- 9735
volumes:
Expand Down Expand Up @@ -84,7 +98,7 @@ services:
- mempool-db
environment:
MEMPOOL_BACKEND: "none"
BACKEND_PORT: "8999"
BACKEND_HTTP_PORT: "8999"
# ELECTRUM_HOST: electrs
# ELECTRUM_PORT: "50001"
# ELECTRUM_TLS_ENABLED: "false"
Expand All @@ -110,3 +124,36 @@ services:
MYSQL_PASSWORD: "mempool"
MYSQL_ROOT_PASSWORD: "admin"
image: mariadb:10.5.8

mempool-api-liquid:
depends_on:
# - electrs
- mempool-db
environment:
MEMPOOL_BACKEND: "none"
BACKEND_HTTP_PORT: "8998"
# ELECTRUM_HOST: electrs
# ELECTRUM_PORT: "50001"
# ELECTRUM_TLS_ENABLED: "false"
CORE_RPC_HOST: elementsd
CORE_RPC_PORT: "18884"
CORE_RPC_USERNAME: "boltz"
CORE_RPC_PASSWORD: "boltz"
DATABASE_ENABLED: "true"
DATABASE_HOST: "mempool-db-liquid"
DATABASE_DATABASE: "mempool"
DATABASE_USERNAME: "mempool"
DATABASE_PASSWORD: "mempool"
STATISTICS_ENABLED: "true"
image: mempool/backend:latest
restart: on-failure
ports:
- 8998:8998

mempool-db-liquid:
environment:
MYSQL_DATABASE: "mempool"
MYSQL_USER: "mempool"
MYSQL_PASSWORD: "mempool"
MYSQL_ROOT_PASSWORD: "admin"
image: mariadb:10.5.8
14 changes: 13 additions & 1 deletion docker/docker-scripts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ lightning-cli-sim() {
docker exec $COMPOSE_PROJECT_NAME-corelightning-1 lightning-cli --network regtest $@
}

elements-cli-sim() {
docker exec $COMPOSE_PROJECT_NAME-elementsd-1 elements-cli "$@"
}

lncli-sim() {
docker exec $COMPOSE_PROJECT_NAME-lnd-1 lncli --network regtest --rpcserver=lnd:10009 $@
}
Expand Down Expand Up @@ -45,7 +49,7 @@ regtest-start-log(){
regtest-stop(){
docker compose down --volumes
# clean up lightning node data
sudo rm -rf ./data/corelightning ./data/lnd ./data/boltz/boltz.db
sudo rm -rf ./data/corelightning ./data/lnd ./data/boltz/boltz.db ./data/elements/liquidregtest
# recreate lightning node data folders preventing permission errors
mkdir ./data/corelightning ./data/lnd
}
Expand All @@ -62,8 +66,16 @@ bitcoin-init(){
bitcoin-cli-sim -generate 150 > /dev/null
}

elements-init(){
elements-cli-sim createwallet regtest || elements-cli-sim loadwallet regtest true
echo "mining 150 liquid blocks..."
elements-cli-sim -generate 150 > /dev/null
elements-cli-sim rescanblockchain 0 > /dev/null
}

regtest-init(){
bitcoin-init
elements-init
lightning-sync
lightning-init
}
Expand Down
1 change: 1 addition & 0 deletions docker/regtest
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ run "cln channel[0].our_amount_msat" $balance_size_msat $(lightning-cli-sim list

run "boltz service status" "200" $(curl -s -o /dev/null --head -w "%{http_code}" "http://localhost:9001/version")
run "mempool service status" "200" $(curl -s -o /dev/null --head -w "%{http_code}" "http://localhost:8999/api/v1/blocks/tip/height")
run "mempool_liquid service status" "200" $(curl -s -o /dev/null --head -w "%{http_code}" "http://localhost:8998/api/v1/blocks/tip/height")

# return non-zero exit code if a test fails
if [[ "$failed" == "true" ]]; then
Expand Down

0 comments on commit f8919f0

Please sign in to comment.