Skip to content

Commit 567e409

Browse files
committed
lndk-eclair bolt12 test environment
1 parent 1a41760 commit 567e409

File tree

10 files changed

+184
-2
lines changed

10 files changed

+184
-2
lines changed

.env.development

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ RPC_PORT=18443
126126
P2P_PORT=18444
127127
ZMQ_BLOCK_PORT=28334
128128
ZMQ_TX_PORT=28335
129+
ZMQ_HASHBLOCK_PORT=29000
129130

130131
# sn_lnd container stuff
131132
SN_LND_REST_PORT=8080
@@ -134,6 +135,8 @@ SN_LND_P2P_PORT=9735
134135
# docker exec -u lnd sn_lnd lncli newaddress p2wkh --unused
135136
SN_LND_ADDR=bcrt1q7q06n5st4vqq3lssn0rtkrn2qqypghv9xg2xnl
136137
SN_LND_PUBKEY=02cb2e2d5a6c5b17fa67b1a883e2973c82e328fb9bd08b2b156a9e23820c87a490
138+
# sn_lndk stuff
139+
SN_LNDK_GRPC_PORT=10011
137140

138141
# lnd container stuff
139142
LND_REST_PORT=8081
@@ -148,6 +151,11 @@ CLN_REST_PORT=9092
148151
CLN_ADDR=bcrt1q02sqd74l4pxedy24fg0qtjz4y2jq7x4lxlgzrx
149152
CLN_PUBKEY=03ca7acec181dbf5e427c682c4261a46a0dd9ea5f35d97acb094e399f727835b90
150153

154+
# sndev cli eclair getnewaddress
155+
# sndev cli eclair getinfo
156+
ECLAIR_ADDR="bcrt1qdus2yml69wsax3unz8pts9h979lc3s4tw0tpf6"
157+
ECLAIR_PUBKEY="02268c74cc07837041131474881f97d497706b89a29f939555da6d094b65bd5af0"
158+
151159
LNCLI_NETWORK=regtest
152160

153161
# localstack container stuff

docker-compose.yml

Lines changed: 95 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,12 +241,15 @@ services:
241241
- '-debug=1'
242242
- '-zmqpubrawblock=tcp://0.0.0.0:${ZMQ_BLOCK_PORT}'
243243
- '-zmqpubrawtx=tcp://0.0.0.0:${ZMQ_TX_PORT}'
244+
- '-zmqpubhashblock=tcp://bitcoin:${ZMQ_HASHBLOCK_PORT}'
244245
- '-txindex=1'
245246
- '-dnsseed=0'
246247
- '-upnp=0'
247248
- '-rpcbind=0.0.0.0'
248249
- '-rpcallowip=0.0.0.0/0'
250+
- '-whitelist=0.0.0.0/0'
249251
- '-rpcport=${RPC_PORT}'
252+
- '-deprecatedrpc=signrawtransaction'
250253
- '-rest'
251254
- '-listen=1'
252255
- '-listenonion=0'
@@ -262,6 +265,8 @@ services:
262265
volumes:
263266
- bitcoin:/home/bitcoin/.bitcoin
264267
labels:
268+
CLI: "bitcoin-cli"
269+
CLI_ARGS: "-chain=regtest -rpcport=${RPC_PORT} -rpcuser=${RPC_USER} -rpcpassword=${RPC_PASS}"
265270
ofelia.enabled: "true"
266271
ofelia.job-exec.minecron.schedule: "@every 1m"
267272
ofelia.job-exec.minecron.command: >
@@ -270,12 +275,12 @@ services:
270275
command bitcoin-cli -chain=regtest -rpcport=${RPC_PORT} -rpcuser=${RPC_USER} -rpcpassword=${RPC_PASS} "$$@"
271276
}
272277
blockcount=$$(bitcoin-cli getblockcount 2>/dev/null)
273-
nodes=(${SN_LND_ADDR} ${LND_ADDR} ${CLN_ADDR})
278+
nodes=(${SN_LND_ADDR} ${LND_ADDR} ${CLN_ADDR} ${ECLAIR_ADDR})
274279
if (( blockcount <= 0 )); then
275280
echo "Creating wallet and address..."
276281
bitcoin-cli createwallet ""
277282
nodes+=($$(bitcoin-cli getnewaddress))
278-
echo "Mining 100 blocks to sn_lnd, lnd, cln..."
283+
echo "Mining 100 blocks to sn_lnd, lnd, cln, eclair..."
279284
for addr in "$${nodes[@]}"; do
280285
bitcoin-cli generatetoaddress 100 $$addr
281286
echo "Mining 100 blocks to a random address..."
@@ -341,6 +346,10 @@ services:
341346
- '--allow-circular-route'
342347
- '--bitcoin.defaultchanconfs=1'
343348
- '--maxpendingchannels=10'
349+
- '--gossip.sub-batch-delay=1s'
350+
- '--protocol.custom-message=513'
351+
- '--protocol.custom-nodeann=39'
352+
- '--protocol.custom-init=39'
344353
expose:
345354
- "9735"
346355
ports:
@@ -363,6 +372,32 @@ services:
363372
fi
364373
"
365374
cpu_shares: "${CPU_SHARES_MODERATE}"
375+
sn_lndk:
376+
build:
377+
context: ./docker/lndk
378+
container_name: sn_lndk
379+
restart: unless-stopped
380+
profiles:
381+
- payments
382+
depends_on:
383+
sn_lnd:
384+
condition: service_healthy
385+
restart: true
386+
env_file: *env_file
387+
command:
388+
- 'lndk'
389+
- '--grpc-host=0.0.0.0'
390+
- '--address=https://sn_lnd:10009'
391+
- '--cert-path=/home/lnd/.lnd/tls.cert'
392+
- '--macaroon-path=/home/lnd/.lnd/data/chain/bitcoin/regtest/admin.macaroon'
393+
ports:
394+
- "${SN_LNDK_GRPC_PORT}:7000"
395+
volumes:
396+
- sn_lnd:/home/lnd/.lnd
397+
labels:
398+
CLI: "lndk-cli --macaroon-path=/home/lnd/.lnd/data/chain/bitcoin/regtest/admin.macaroon"
399+
CLI_USER: "lndk"
400+
cpu_shares: "${CPU_SHARES_MODERATE}"
366401
lnd:
367402
build:
368403
context: ./docker/lnd
@@ -524,6 +559,63 @@ services:
524559
fi
525560
"
526561
cpu_shares: "${CPU_SHARES_MODERATE}"
562+
eclair:
563+
build:
564+
context: ./docker/eclair
565+
args:
566+
- LN_NODE_FOR=stacker
567+
container_name: eclair
568+
profiles:
569+
- payments
570+
restart: unless-stopped
571+
depends_on:
572+
<<: *depends_on_bitcoin
573+
environment:
574+
<<: *env_file
575+
JAVA_OPTS:
576+
-Declair.printToConsole
577+
-Dakka.loglevel=DEBUG
578+
-Declair.server.port=9735
579+
-Declair.server.public-ips.0=eclair
580+
-Declair.api.binding-ip=0.0.0.0
581+
-Declair.api.enabled=true
582+
-Declair.api.port=8080
583+
-Declair.api.password=pass
584+
-Declair.node-alias=eclair
585+
-Declair.chain=regtest
586+
-Declair.bitcoind.host=bitcoin
587+
-Declair.bitcoind.rpcport=${RPC_PORT}
588+
-Declair.bitcoind.rpcuser=${RPC_USER}
589+
-Declair.bitcoind.rpcpassword=${RPC_PASS}
590+
-Declair.bitcoind.zmqblock=tcp://bitcoin:${ZMQ_HASHBLOCK_PORT}
591+
-Declair.bitcoind.zmqtx=tcp://bitcoin:${ZMQ_TX_PORT}
592+
-Declair.bitcoind.batch-watcher-requests=false
593+
-Declair.features.option_onion_messages=optional
594+
-Declair.features.option_route_blinding=optional
595+
-Declair.features.keysend=optional
596+
-Declair.channel.accept-incoming-static-remote-key-channels=true
597+
-Declair.tip-jar.description=bolt12
598+
-Declair.tip-jar.default-amount-msat=100000000
599+
-Declair.tip-jar.max-final-expiry-delta=1000
600+
volumes:
601+
- eclair:/data
602+
expose:
603+
- "9735"
604+
labels:
605+
CLI: "eclair-cli"
606+
CLI_USER: "root"
607+
CLI_ARGS: "-p pass"
608+
ofelia.enabled: "true"
609+
ofelia.job-exec.eclair_channel_cron.schedule: "@every 1m"
610+
ofelia.job-exec.eclair_channel_cron.command: >
611+
bash -c "
612+
if [ $$(eclair-cli -p pass channels | jq 'length') -ge 3 ]; then
613+
exit 0
614+
else
615+
eclair-cli -p pass connect --uri=$SN_LND_PUBKEY@sn_lnd:9735
616+
eclair-cli -p pass open --nodeId=$SN_LND_PUBKEY --fundingFeerateSatByte=1 --fundingSatoshis=1000000 --pushMsat=500000000 --announceChannel=true
617+
fi
618+
"
527619
channdler:
528620
image: mcuadros/ofelia:latest
529621
container_name: channdler
@@ -665,3 +757,4 @@ volumes:
665757
nwc_send:
666758
nwc_recv:
667759
tordata:
760+
eclair:

docker/eclair/Dockerfile

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# based on https://github.com/LN-Zap/bolt12-playground
2+
FROM acinq/eclair:0.11.0
3+
4+
5+
ENTRYPOINT JAVA_OPTS="${JAVA_OPTS}" eclair-node/bin/eclair-node.sh "-Declair.datadir=${ECLAIR_DATADIR}"
6+
7+
#################
8+
# Builder image #
9+
#################
10+
FROM maven:3.8.6-openjdk-11-slim AS builder
11+
12+
RUN apt-get update \
13+
&& apt-get install -y --no-install-recommends \
14+
git \
15+
&& apt-get clean \
16+
&& rm -rf /var/lib/apt/lists/*
17+
18+
# References for eclair
19+
ARG ECLAIR_REF=b73a009a1d7d7ea3a158776cd233512b9a538550
20+
ARG ECLAIR_PLUGINS_REF=cdc26dda96774fdc3b54075df078587574891fb7
21+
22+
WORKDIR /usr/src/eclair
23+
RUN git clone https://github.com/ACINQ/eclair.git . \
24+
&& git reset --hard ${ECLAIR_REF}
25+
RUN mvn install -pl eclair-node -am -DskipTests -Dgit.commit.id=notag -Dgit.commit.id.abbrev=notag
26+
27+
WORKDIR /usr/src/eclair-plugins
28+
RUN git clone https://github.com/ACINQ/eclair-plugins.git . \
29+
&& git reset --hard ${ECLAIR_PLUGINS_REF}
30+
WORKDIR /usr/src/eclair-plugins/bolt12-tip-jar
31+
RUN mvn package -DskipTests
32+
33+
# ###############
34+
# # final image #
35+
# ###############
36+
FROM openjdk:11.0.16-jre-slim-bullseye
37+
WORKDIR /opt
38+
39+
# Add utils
40+
RUN apt-get update \
41+
&& apt-get install -y --no-install-recommends \
42+
bash jq curl unzip \
43+
&& apt-get clean \
44+
&& rm -rf /var/lib/apt/lists/*
45+
46+
# copy and install eclair-cli executable
47+
COPY --from=builder /usr/src/eclair/eclair-core/eclair-cli .
48+
RUN chmod +x eclair-cli && mv eclair-cli /sbin/eclair-cli
49+
50+
# we only need the eclair-node.zip to run
51+
COPY --from=builder /usr/src/eclair/eclair-node/target/eclair-node-*.zip ./eclair-node.zip
52+
RUN unzip eclair-node.zip && mv eclair-node-* eclair-node && chmod +x eclair-node/bin/eclair-node.sh
53+
54+
# copy and install bolt12-tip-jar plugin
55+
COPY --from=builder /usr/src/eclair-plugins/bolt12-tip-jar/target/bolt12-tip-jar-0.10.1-SNAPSHOT.jar .
56+
57+
ENV ECLAIR_DATADIR=/data
58+
ENV JAVA_OPTS=
59+
60+
RUN mkdir -p "$ECLAIR_DATADIR"
61+
VOLUME [ "/data" ]
62+
63+
ARG LN_NODE_FOR
64+
ENV LN_NODE_FOR=$LN_NODE_FOR
65+
COPY ["./$LN_NODE_FOR/*", "/data"]
66+
67+
# ENTRYPOINT JAVA_OPTS="${JAVA_OPTS}" eclair-node/bin/eclair-node.sh "-Declair.datadir=${ECLAIR_DATADIR}"
68+
ENTRYPOINT JAVA_OPTS="${JAVA_OPTS}" eclair-node/bin/eclair-node.sh bolt12-tip-jar-0.10.1-SNAPSHOT.jar "-Declair.datadir=${ECLAIR_DATADIR}"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
��thC(����B��qF���`iB�L)L����
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
6��1>��bgO�嵿��}�k �!sb����
4 KB
Binary file not shown.
8 KB
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sqlite
4 KB
Binary file not shown.

docker/lndk/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This image uses fedora 40 because the official pre-built lndk binaries require
2+
# glibc 2.39 which is not available on debian or ubuntu images.
3+
FROM fedora:40
4+
RUN useradd -u 1000 -m lndk
5+
USER lndk
6+
RUN curl --proto '=https' --tlsv1.2 -LsSf https://github.com/lndk-org/lndk/releases/download/v0.2.0/lndk-installer.sh | sh
7+
RUN echo 'source /home/lndk/.cargo/env' >> $HOME/.bashrc
8+
WORKDIR /home/lndk
9+
EXPOSE 7000
10+
ENV PATH="/home/lndk/.cargo/bin:${PATH}"

0 commit comments

Comments
 (0)