├── .gitignore ├── .gitlab-ci.yml ├── README.md ├── bitcoind ├── .dockerignore ├── Dockerfile ├── Dockerfile.gitian ├── README.md ├── bitcoin.service ├── build-and-push-to-dockerhub.sh └── run-gitian.sh ├── btc-rpc-proxy ├── Dockerfile ├── README.md └── build-and-push-to-dockerhub.sh ├── charged ├── Dockerfile ├── README.md ├── build-and-push-to-dockerhub.sh └── charge.service ├── electrsd ├── Dockerfile ├── README.md └── build-and-push-to-dockerhub.sh ├── elementsd ├── Dockerfile ├── README.md ├── build-and-push-to-dockerhub.sh ├── elements.service └── run-gitian.sh ├── hal-docker ├── Dockerfile ├── README.md └── build-and-push-to-dockerhub.sh ├── lightningd ├── .dockerignore ├── Dockerfile ├── README.md ├── arm │ ├── Dockerfile.armv7 │ ├── Dockerfile.armv7-esplora │ └── README.md ├── build-and-push-to-dockerhub.sh ├── lightning.service ├── misc │ ├── historian │ │ ├── Dockerfile │ │ ├── build-and-push-to-dockerhub.sh │ │ └── connectionpool.py │ ├── rebalance.Dockerfile │ └── sauron.Dockerfile ├── peerswap │ ├── Dockerfile │ ├── build-and-push-to-dockerhub.sh │ └── debian.Dockerfile └── qemu-arm-static ├── liquidd-legacy ├── Dockerfile └── publish.sh ├── tor ├── Dockerfile ├── README.md ├── build-and-push-to-dockerhub.sh ├── tor.service └── torrc └── waterfalls ├── Dockerfile └── build-and-push-to-dockerhub.sh /.gitignore: -------------------------------------------------------------------------------- 1 | qemu-arm-static 2 | *.py* 3 | !lightningd/misc/historian/*.py* -------------------------------------------------------------------------------- /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | variables: 2 | GIT_SUBMODULE_STRATEGY: none 3 | CI_DISPOSABLE_ENVIRONMENT: "true" 4 | DOCKER_HOST: tcp://docker:2375 5 | DOCKER_TLS_CERTDIR: "" 6 | DOCKER_BUILDKIT: 1 7 | 8 | default: 9 | image: docker:27 10 | services: 11 | - name: docker:27-dind 12 | command: ["dockerd", "--host=tcp://0.0.0.0:2375"] 13 | alias: "docker" 14 | before_script: 15 | - docker info 16 | - docker buildx create 17 | --driver=docker-container 18 | --name=buildkit-builder 19 | --use 20 | --platform linux/amd64,linux/arm64 21 | tags: 22 | - cloud 23 | retry: 24 | max: 2 25 | when: 26 | - runner_system_failure 27 | - unknown_failure 28 | - stuck_or_timeout_failure 29 | 30 | stages: 31 | - build_push 32 | 33 | build_bitcoind: 34 | stage: build_push 35 | when: manual 36 | only: 37 | changes: 38 | - bitcoind/** 39 | script: 40 | - cd bitcoind && sh ./build-and-push-to-dockerhub.sh 41 | 42 | build_lightningd: 43 | stage: build_push 44 | when: manual 45 | only: 46 | changes: 47 | - lightningd/Dockerfile 48 | script: 49 | - cd lightningd && sh ./build-and-push-to-dockerhub.sh 50 | 51 | build_lightningd_peerswap: 52 | stage: build_push 53 | when: manual 54 | only: 55 | changes: 56 | - lightningd/peerswap/* 57 | script: 58 | - cd lightningd/peerswap && sh ./build-and-push-to-dockerhub.sh 59 | 60 | build_lightningd_historian: 61 | stage: build_push 62 | when: manual 63 | only: 64 | changes: 65 | - lightningd/misc/historian/* 66 | script: 67 | - cd lightningd/misc/historian && sh ./build-and-push-to-dockerhub.sh 68 | 69 | build_elementsd: 70 | stage: build_push 71 | when: manual 72 | only: 73 | changes: 74 | - elementsd/** 75 | script: 76 | - cd elementsd && sh ./build-and-push-to-dockerhub.sh 77 | 78 | build_waterfalls: 79 | stage: build_push 80 | when: manual 81 | only: 82 | changes: 83 | - waterfalls/** 84 | script: 85 | - cd waterfalls && sh ./build-and-push-to-dockerhub.sh 86 | 87 | build_electrsd: 88 | stage: build_push 89 | when: manual 90 | only: 91 | changes: 92 | - electrsd/** 93 | script: 94 | - cd electrsd && sh ./build-and-push-to-dockerhub.sh 95 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Bitcoin-Related Docker Images 2 | This repository will be continuously maintained, but suggestions, comments, PRs are welcome! 3 | This repository doesn't introduce anything novel, it just accumulates some Bitcoin-related, dockerized daemons/services. 4 | 5 | Some simple HOW-TO-RUNs are included. Keep in mind that there have been some assumptions made by the way the HOW-TO-RUNs are defined (i.e. you need to have `/mnt/data/...` created, `bitcoin/lightning.conf` files, etc.). Feel free to make suggestions how to make the services even more generic and simpler to productionize. Also, if you don't want to run as a systemd service, just use the `docker run...` part with its respective options. 6 | 7 | ## Builds 8 | * Changes to the respective `elementsd`, `bitcoind`, `lightningd` subdirectory will create a manual build job 9 | * Edit the `VER` in the `build-and-push-to-dockerhub.sh` script to update the version 10 | * If you also want to tag the Docker image with `:latest`, set the env variable `LATEST` to `1` before triggering the job -------------------------------------------------------------------------------- /bitcoind/.dockerignore: -------------------------------------------------------------------------------- 1 | *.service 2 | *.md 3 | 4 | -------------------------------------------------------------------------------- /bitcoind/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:bookworm-slim 2 | 3 | ARG TARGETARCH TARGETOS 4 | ARG BITCOIN_VERSION 5 | ENV BITCOIN_VERSION=$BITCOIN_VERSION 6 | ENV WLADIMIRVDL_PGP_KEY=71A3B16735405025D447E8F274810B012346C9A6 7 | ENV ACHOW_PGP_KEY=152812300785C96444D3334D17565732E08E5E41 8 | 9 | WORKDIR /opt/bitcoin 10 | 11 | RUN apt update \ 12 | && apt install -qfy ca-certificates gnupg bash wget 13 | 14 | RUN if [ "${TARGETARCH}" = "arm64" ]; then \ 15 | wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-aarch64-linux-gnu.tar.gz; \ 16 | else \ 17 | wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz; \ 18 | fi \ 19 | && wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/SHA256SUMS.asc \ 20 | && wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/SHA256SUMS 21 | 22 | RUN gpg --keyserver hkps://keys.openpgp.org --recv-keys ${WLADIMIRVDL_PGP_KEY} ${ACHOW_PGP_KEY} \ 23 | && csplit -ksz SHA256SUMS.asc /-----BEGIN/ '{*}' \ 24 | && for i in xx*; do gpg --verify $i SHA256SUMS && break; done \ 25 | && if [ "${TARGETARCH}" = "arm64" ]; then \ 26 | grep bitcoin-${BITCOIN_VERSION}-aarch64-linux-gnu.tar.gz SHA256SUMS | sha256sum -c; \ 27 | else \ 28 | grep bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz SHA256SUMS | sha256sum -c; \ 29 | fi 30 | 31 | RUN mkdir -p bitcoin /root/.bitcoin \ 32 | && if [ "${TARGETARCH}" = "arm64" ]; then \ 33 | tar xzvf bitcoin-${BITCOIN_VERSION}-aarch64-linux-gnu.tar.gz --strip-components=1 -C bitcoin; \ 34 | else \ 35 | tar xzvf bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz --strip-components=1 -C bitcoin; \ 36 | fi \ 37 | && mv bitcoin/bin/* /usr/local/bin/ \ 38 | && mv bitcoin/lib/* /usr/local/lib/ \ 39 | && mv bitcoin/include/* /usr/local/include/ \ 40 | && mv bitcoin/share/* /usr/local/share/ 41 | 42 | RUN apt clean && apt autoclean 43 | -------------------------------------------------------------------------------- /bitcoind/Dockerfile.gitian: -------------------------------------------------------------------------------- 1 | FROM alpine@sha256:769fddc7cc2f0a1c35abb2f91432e8beecf83916c421420e6a6da9f8975464b6 2 | 3 | RUN apk update && apk add --no-cache bash wget ca-certificates gnupg 4 | 5 | # Add GNU Lib C 6 | ENV GLIBC_VERSION=2.28-r0 7 | RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub && \ 8 | wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk && \ 9 | wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-bin-${GLIBC_VERSION}.apk 10 | 11 | RUN apk update && \ 12 | apk --no-cache add glibc-${GLIBC_VERSION}.apk && \ 13 | apk --no-cache add glibc-bin-${GLIBC_VERSION}.apk && \ 14 | rm -f glibc-* 15 | 16 | COPY ./bitcoin/bin /usr/local/bin/ 17 | COPY ./bitcoin/include /usr/local/include/ 18 | COPY ./bitcoin/lib /usr/local/lib/ 19 | COPY ./bitcoin/share /usr/local/share/ 20 | -------------------------------------------------------------------------------- /bitcoind/README.md: -------------------------------------------------------------------------------- 1 | # Bitcoin 2 | 3 | * `Dockerfile` downloads the compiled binaries from . The file was adapted from 4 | * `Dockerfile.gitian` uses [gitian](https://github.com/devrandom/gitian-builder) to build from [source](https://github.com/bitcoin/bitcoin). 5 | 6 | You can update Bitcoin's version in the `Dockerfile` or `run-gitian.sh` based on the version you want to build (e.g. `v0.18.1` or `commit_hash`). 7 | 8 | ## Building from source 9 | 10 | If you're on MAC (or Windows), run inside an Ubuntu container (you need [Docker](https://docs.docker.com/install/#supported-platforms)). Assuming you've `git cloned && cd bitcoin-images`: 11 | 12 | ```bash 13 | docker run -itd --name ub -v `pwd`/bitcoind:/opt/bitcoind -v /var/run/docker.sock:/var/run/docker.sock ubuntu:bionic sleep infinity 14 | ``` 15 | 16 | Open a shell inside the container (`docker exec -it ub bash`) and install the necessary packages: 17 | 18 | ```bash 19 | apt-get update && \ 20 | apt-get install -y git ruby apt-transport-https ca-certificates curl gnupg-agent software-properties-common && \ 21 | curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - && \ 22 | add-apt-repository \ 23 | "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ 24 | $(lsb_release -cs) \ 25 | stable" && \ 26 | apt-get update && apt-get install docker-ce -y 27 | cd /opt/bitcoind 28 | ./run_gitian.sh 29 | ``` 30 | 31 | You can watch the install or build logs by running `docker exec ub tail -f /opt/bitcoind/gitian/var/install|build.log` in another terminal window. 32 | After gitian has finished successfully, you can `Ctrl+D` out of the container and remove it `docker rm -f ub`. 33 | 34 | Lastly, you can build the Docker image(s) with the Bitcoin binaries by specifying the appropriate Dockerfile: 35 | 36 | ```bash 37 | docker build -t blockstream/bitcoind:tag_or_commit -f Dockerfile.gitian . 38 | ``` 39 | 40 | Or feel free to adapt `build-and-push-to-dockerhub.sh` to build/push to your own repo/registry. 41 | -------------------------------------------------------------------------------- /bitcoind/bitcoin.service: -------------------------------------------------------------------------------- 1 | /etc/systemd/system/bitcoin.service 2 | 3 | [Unit] 4 | Description=Bitcoin node 5 | Wants=docker.target 6 | After=docker.service 7 | 8 | [Service] 9 | Restart=always 10 | RestartSec=3 11 | ExecStartPre=/usr/bin/docker pull blockstream/bitcoind:latest 12 | ExecStart=/usr/bin/docker run \ 13 | --network=host \ 14 | --pid=host \ 15 | --name=bitcoin \ 16 | -v /mnt/data/bitcoin/bitcoin.conf:/root/.bitcoin/bitcoin.conf:ro \ 17 | -v /mnt/data/testnet:/root/.bitcoin:rw \ 18 | blockstream/bitcoind:latest bitcoind -testnet -printtoconsole 19 | ExecStop=/usr/bin/docker exec bitcoin bitcoin-cli stop 20 | ExecStopPost=/usr/bin/sleep 3 21 | ExecStopPost=/usr/bin/docker rm -f bitcoin 22 | 23 | [Install] 24 | WantedBy=multi-user.target 25 | -------------------------------------------------------------------------------- /bitcoind/build-and-push-to-dockerhub.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -ex 3 | 4 | export VER=${VER:-27.2} 5 | docker buildx build --platform linux/amd64,linux/arm64 \ 6 | --push \ 7 | --cache-from blockstream/bitcoind:latest \ 8 | --build-arg BITCOIN_VERSION=${VER} \ 9 | --build-arg BUILDKIT_INLINE_CACHE=1 \ 10 | -t blockstream/bitcoind:${VER} . || { echo -e "\nSomething broke"; exit 1; } 11 | 12 | if [[ $LATEST -eq 1 ]] 13 | then 14 | docker buildx imagetools create -t blockstream/bitcoind:latest blockstream/bitcoind:${VER} 15 | fi 16 | -------------------------------------------------------------------------------- /bitcoind/run-gitian.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -v 4 | 5 | BITCOIN_VERSION=v0.18.1 6 | BITCOIN_DIR=0.18.1 7 | export USE_DOCKER=1 8 | 9 | git clone https://github.com/devrandom/gitian-builder.git gitian 10 | git clone https://github.com/bitcoin/bitcoin -b ${BITCOIN_VERSION} gitian/inputs/bitcoin 11 | sed -i '/50cacher$/d' gitian/bin/make-base-vm # don't use apt cache 12 | cd gitian && bin/make-base-vm --docker --suite bionic 13 | 14 | sed -i 's#HOSTS=.*#HOSTS="x86_64-linux-gnu"#' inputs/bitcoin/contrib/gitian-descriptors/gitian-linux.yml 15 | sed -i 's#CONFIGFLAGS=.*#CONFIGFLAGS="--without-gui --enable-glibc-back-compat --enable-reduce-exports --disable-bench --disable-gui-tests"#' inputs/bitcoin/contrib/gitian-descriptors/gitian-linux.yml 16 | sed -i 's#.*QT_RCC.*##g' inputs/bitcoin/contrib/gitian-descriptors/gitian-linux.yml 17 | sed -i '0,/MAKEOPTS=(/{s/MAKEOPTS=(*/&NO_QT=1 /}' bin/gbuild 18 | 19 | bin/gbuild --skip-fetch --num-make 2 --memory 4000 --url bitcoin=inputs/bitcoin --commit bitcoin=${BITCOIN_VERSION} inputs/bitcoin/contrib/gitian-descriptors/gitian-linux.yml 20 | mkdir ../bitcoin && tar -xzvf build/out/bitcoin-${BITCOIN_DIR}-x86_64-linux-gnu.tar.gz --strip-components 1 -C ../bitcoin 21 | cd ../ && rm -rf gitian 22 | -------------------------------------------------------------------------------- /btc-rpc-proxy/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust:1.82-alpine 2 | 3 | ARG VER 4 | ENV VER=$VER 5 | 6 | RUN apk --no-cache -u add bash curl jq git musl-dev 7 | 8 | RUN cargo install --git https://github.com/Kixunil/btc-rpc-proxy.git --tag $VER 9 | -------------------------------------------------------------------------------- /btc-rpc-proxy/README.md: -------------------------------------------------------------------------------- 1 | ### Dockerized Bitcoin RPC Proxy 2 | https://github.com/Kixunil/btc-rpc-proxy 3 | ``` 4 | docker run -d --name=proxy blockstream/btc-rpc-proxy:latest btc_rpc_proxy --conf=/etc/btc-rpc-proxy/config.toml --default-fetch-blocks --verbose 5 | ``` -------------------------------------------------------------------------------- /btc-rpc-proxy/build-and-push-to-dockerhub.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -ex 3 | 4 | export VER=v0.4.0 5 | 6 | docker buildx build \ 7 | --platform linux/amd64,linux/arm64 \ 8 | --push \ 9 | --cache-from blockstream/btc-rpc-proxy:latest \ 10 | --build-arg VER=${VER} \ 11 | -t blockstream/btc-rpc-proxy:${VER} \ 12 | -t blockstream/btc-rpc-proxy:latest . || { echo -e "\nSomething broke"; exit 1; } 13 | -------------------------------------------------------------------------------- /charged/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:lts-slim AS builder 2 | 3 | ARG CHARGED_VERSION 4 | ENV CHARGED_VERSION=$CHARGED_VERSION 5 | 6 | WORKDIR /opt/charged 7 | 8 | RUN apt-get update && apt-get install -y git 9 | 10 | # Build charged 11 | RUN git clone https://github.com/ElementsProject/lightning-charge.git -b ${CHARGED_VERSION} /opt/charged \ 12 | && npm install \ 13 | && npm run dist \ 14 | && rm -rf src test 15 | 16 | FROM node:lts-slim 17 | 18 | COPY --from=builder /opt/charged /opt/charged 19 | 20 | WORKDIR /opt/charged 21 | ENV HOME /root 22 | ENV NODE_ENV production 23 | 24 | RUN apt-get update && apt-get install -y --no-install-recommends \ 25 | inotify-tools libgmp-dev libsqlite3-dev \ 26 | && rm -rf /var/lib/apt/lists/* \ 27 | && ln -sf /opt/charged/bin/charged /usr/bin/charged \ 28 | && mkdir /data 29 | -------------------------------------------------------------------------------- /charged/README.md: -------------------------------------------------------------------------------- 1 | ## Charged 2 | The Dockerfile was adapted from https://github.com/ElementsProject/lightning-charge/blob/master/Dockerfile. 3 | 4 | Feel free to adapt the `build-and-push-to-dockerhub.sh` to push to your own repo/registry. 5 | -------------------------------------------------------------------------------- /charged/build-and-push-to-dockerhub.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -ex 3 | 4 | export VER=v0.4.26 5 | 6 | docker buildx build \ 7 | --platform linux/amd64,linux/arm64 \ 8 | --push \ 9 | --cache-from blockstream/charged:latest \ 10 | --build-arg CHARGED_VERSION=${VER} \ 11 | -t blockstream/charged:$VER \ 12 | -t blockstream/charged:latest . || `echo -e "\nSomething broke" && exit 1` 13 | -------------------------------------------------------------------------------- /charged/charge.service: -------------------------------------------------------------------------------- 1 | /etc/systemd/system/charge.service 2 | 3 | [Unit] 4 | Description=Charge daemon 5 | Wants=docker.target 6 | After=docker.service 7 | 8 | [Service] 9 | Restart=always 10 | RestartSec=3 11 | ExecStartPre=/usr/bin/docker pull blockstream/charged:latest 12 | ExecStart=/usr/bin/docker run \ 13 | --network=host \ 14 | --pid=host \ 15 | --name=charge \ 16 | -v /mnt/data/lightning:/root/.lightning:ro \ 17 | -v /mnt/data/charge:/data:rw \ 18 | -e "API_TOKEN=$TOKEN" 19 | blockstream/charged:latest charged -d /data/charge.db -l /root/.lightning 20 | ExecStop=/usr/bin/docker rm -f charge 21 | 22 | [Install] 23 | WantedBy=multi-user.target 24 | -------------------------------------------------------------------------------- /electrsd/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:bookworm-slim 2 | 3 | ARG ELECTRSD_VERSION 4 | ENV ELECTRSD_VERSION=$ELECTRSD_VERSION 5 | 6 | RUN useradd -s /bin/bash -u 2000 electrsd 7 | 8 | RUN apt update 9 | RUN apt install -qfy curl 10 | RUN mkdir -p /home/electrsd && chown -R electrsd:electrsd /home/electrsd 11 | 12 | WORKDIR /home/electrsd 13 | RUN curl -Ls https://github.com/RCasatta/electrsd/releases/download/electrs_releases/electrs_linux_esplora_${ELECTRSD_VERSION}_liquid.gz | gunzip > electrs 14 | RUN chmod +x electrs 15 | 16 | RUN apt remove -yf curl 17 | RUN apt-get clean && \ 18 | rm -rf /var/lib/apt/lists/* 19 | 20 | USER electrsd 21 | ENTRYPOINT ["./electrs"] -------------------------------------------------------------------------------- /electrsd/README.md: -------------------------------------------------------------------------------- 1 | # electrsd 2 | 3 | 4 | 5 | > Utility to run a regtest electrsd process connected to a given bitcoind instance, useful in integration testing environment. 6 | -------------------------------------------------------------------------------- /electrsd/build-and-push-to-dockerhub.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -ex 3 | 4 | export VER=a33e97e1a1fc63fa9c20a116bb92579bbf43b254 5 | 6 | docker buildx build \ 7 | --platform linux/amd64,linux/arm64 \ 8 | --push \ 9 | --cache-from blockstream/electrsd-liquid:latest \ 10 | --build-arg ELECTRSD_VERSION=${VER} \ 11 | -t blockstream/electrsd-liquid:$VER \ 12 | -t blockstream/electrsd-liquid:latest . || `echo -e "\nSomething broke" && exit 1` 13 | -------------------------------------------------------------------------------- /elementsd/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:bookworm-slim 2 | 3 | ARG TARGETARCH TARGETOS 4 | ARG ELEMENTS_VERSION 5 | ARG GH_REPO=ElementsProject/elements 6 | 7 | ENV ELEMENTS_VERSION=$ELEMENTS_VERSION 8 | ENV GH_REPO=$GH_REPO 9 | ENV PABLO_PGP_KEY=BD0F3062F87842410B06A0432F656B0610604482 10 | ENV BYRON_PGP_KEY=710E44C2DAAE938F778744A1DE8F6EA20A661697 11 | ENV GH_DOWNLOAD=https://github.com/${GH_REPO}/releases/download 12 | 13 | ENV GLIBC_VERSION=2.33-r0 14 | 15 | RUN apt update \ 16 | && apt install -qfy ca-certificates wget gnupg bash 17 | 18 | RUN if [ "${TARGETARCH}" = "arm64" ]; then \ 19 | wget ${GH_DOWNLOAD}/elements-${ELEMENTS_VERSION}/elements-${ELEMENTS_VERSION}-aarch64-linux-gnu.tar.gz; \ 20 | else \ 21 | wget ${GH_DOWNLOAD}/elements-${ELEMENTS_VERSION}/elements-${ELEMENTS_VERSION}-x86_64-linux-gnu.tar.gz; \ 22 | fi \ 23 | && wget ${GH_DOWNLOAD}/elements-${ELEMENTS_VERSION}/SHA256SUMS.asc 24 | 25 | RUN gpg --keyserver hkps://keys.openpgp.org --recv-keys ${BYRON_PGP_KEY} ${PABLO_PGP_KEY} \ 26 | && gpg --output SHA256SUMS --decrypt SHA256SUMS.asc \ 27 | && if [ "${TARGETARCH}" = "arm64" ]; then \ 28 | grep elements-${ELEMENTS_VERSION}-aarch64-linux-gnu.tar.gz SHA256SUMS | sha256sum -c; \ 29 | else \ 30 | grep elements-${ELEMENTS_VERSION}-x86_64-linux-gnu.tar.gz SHA256SUMS | sha256sum -c; \ 31 | fi 32 | 33 | RUN mkdir elements \ 34 | && if [ "${TARGETARCH}" = "arm64" ]; then \ 35 | tar xzvf elements-${ELEMENTS_VERSION}-aarch64-linux-gnu.tar.gz --strip-components=1 -C elements; \ 36 | else \ 37 | tar xzvf elements-${ELEMENTS_VERSION}-x86_64-linux-gnu.tar.gz --strip-components=1 -C elements; \ 38 | fi \ 39 | && mkdir /root/.elements \ 40 | && mv elements/bin/* /usr/local/bin/ \ 41 | && mv elements/lib/* /usr/local/lib/ \ 42 | && mv elements/share/* /usr/local/share/ 43 | 44 | RUN apt-get clean && apt-get autoclean 45 | -------------------------------------------------------------------------------- /elementsd/README.md: -------------------------------------------------------------------------------- 1 | ## Elementsd 2 | * `Dockerfile` downloads the compiled binaries from https://github.com/ElementsProject/elements/releases 3 | * Whereas `Dockerfile.gitian` uses [gitian](https://github.com/devrandom/gitian-builder) to build from [source](https://github.com/ElementsProject/elements) 4 | 5 | You can update Elements' version in the `Dockerfile` and/or `run-gitian.sh` based on the version you want to build (e.g. `v0.18.1` or `commit_hash`). 6 | 7 | ### Building from source 8 | If you're on MAC (or Windows), run inside an Ubuntu container (you need [Docker](https://docs.docker.com/install/#supported-platforms)). Assuming you've `git cloned && cd bitcoin-images`: 9 | ``` 10 | docker run -itd --name ub -v `pwd`/elementsd:/opt/elementsd -v /var/run/docker.sock:/var/run/docker.sock ubuntu:bionic sleep infinity 11 | ``` 12 | Open a shell inside the container (`docker exec -it ub bash`) and install the necessary packages: 13 | ``` 14 | apt-get update && \ 15 | apt-get install -y git ruby apt-transport-https ca-certificates curl gnupg-agent software-properties-common && \ 16 | curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - && \ 17 | add-apt-repository \ 18 | "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ 19 | $(lsb_release -cs) \ 20 | stable" && \ 21 | apt-get update && apt-get install docker-ce -y 22 | cd /opt/elementsd 23 | ./run_gitian.sh 24 | ``` 25 | You can watch the install or build logs by running `docker exec ub tail -f /opt/elementsd/gitian/var/install|build.log` in another terminal window. 26 | After gitian has finished successfully, you can `Ctrl+D` out of the container and remove it `docker rm -f ub`. 27 | 28 | Lastly, you can build the Docker image(s) with the Elements binaries by specifying the appropriate Dockerfile: 29 | ``` 30 | docker build -t blockstream/elementsd:tag_or_commit -f Dockerfile.gitian . 31 | ``` 32 | Or feel free to adapt `build-and-push-to-dockerhub.sh` to build/push to your own repo/registry. 33 | -------------------------------------------------------------------------------- /elementsd/build-and-push-to-dockerhub.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -ex 3 | 4 | export VER=${VER:-23.2.5} 5 | docker buildx build --platform linux/amd64,linux/arm64 \ 6 | --push \ 7 | --cache-from blockstream/elementsd:latest \ 8 | --build-arg ELEMENTS_VERSION=${VER} \ 9 | --build-arg BUILDKIT_INLINE_CACHE=1 \ 10 | --build-arg GH_REPO \ 11 | -t blockstream/elementsd:${VER} . || { echo -e "\nSomething broke"; exit 1; } 12 | 13 | if [[ $LATEST -eq 1 ]] 14 | then 15 | docker buildx imagetools create -t blockstream/elementsd:latest blockstream/elementsd:${VER} 16 | fi 17 | -------------------------------------------------------------------------------- /elementsd/elements.service: -------------------------------------------------------------------------------- 1 | /etc/systemd/system/elements.service 2 | 3 | [Unit] 4 | Description=elementsd pseudo node 5 | Wants=docker.target 6 | After=docker.service 7 | 8 | [Service] 9 | Restart=always 10 | RestartSec=3 11 | ExecStartPre=/usr/bin/docker pull blockstream/elementsd:latest 12 | ExecStart=/usr/bin/docker run \ 13 | --network=host \ 14 | --pid=host \ 15 | --name=elements \ 16 | -v /mnt/data/elements/elements.conf:/root/.elements/elements.conf:ro \ 17 | -v /mnt/data/elements:/root/.elements:rw \ 18 | blockstream/elementsd:latest elementsd -printtoconsole 19 | ExecStop=/usr/bin/docker exec elements elements-cli stop 20 | ExecStopPost=/usr/bin/sleep 3 21 | ExecStopPost=/usr/bin/docker rm -f elements 22 | 23 | [Install] 24 | WantedBy=multi-user.target 25 | -------------------------------------------------------------------------------- /elementsd/run-gitian.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -v 4 | 5 | ELEMENTS_VERSION=elements-0.21.0 6 | ELEMENTS_DIR=0.21.0 7 | export USE_DOCKER=1 8 | 9 | git clone https://github.com/devrandom/gitian-builder.git gitian 10 | git clone https://github.com/ElementsProject/elements -b ${ELEMENTS_VERSION} gitian/inputs/elements 11 | sed -i '/50cacher$/d' gitian/bin/make-base-vm # don't use apt cache 12 | cd gitian && bin/make-base-vm --docker --suite bionic 13 | 14 | sed -i 's#HOSTS=.*#HOSTS="x86_64-linux-gnu"#' inputs/elements/contrib/gitian-descriptors/gitian-linux.yml 15 | sed -i 's#CONFIGFLAGS=.*#CONFIGFLAGS="--without-gui --enable-glibc-back-compat --enable-reduce-exports --disable-bench --disable-gui-tests"#' inputs/elements/contrib/gitian-descriptors/gitian-linux.yml 16 | sed -i 's#.*QT_RCC.*##g' inputs/elements/contrib/gitian-descriptors/gitian-linux.yml 17 | sed -i '0,/MAKEOPTS=(/{s/MAKEOPTS=(*/&NO_QT=1 /}' bin/gbuild 18 | 19 | bin/gbuild --skip-fetch --num-make 2 --memory 4000 --url elements=inputs/elements --commit elements=${ELEMENTS_VERSION} inputs/elements/contrib/gitian-descriptors/gitian-linux.yml 20 | mkdir ../elements && tar -xzvf build/out/elements-${ELEMENTS_DIR}-x86_64-linux-gnu.tar.gz --strip-components 1 -C ../elements 21 | cd ../ && rm -rf gitian 22 | -------------------------------------------------------------------------------- /hal-docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust:1.82-alpine 2 | 3 | ARG VER 4 | ENV VER=$VER 5 | 6 | RUN apk --no-cache -u add bash curl jq git musl-dev 7 | 8 | WORKDIR /opt/hal 9 | 10 | RUN cargo install hal --vers $VER 11 | RUN cargo install hal-elements 12 | -------------------------------------------------------------------------------- /hal-docker/README.md: -------------------------------------------------------------------------------- 1 | ### Dockerized hal 2 | Check crate versions: https://crates.io/search?q=hal-elements. 3 | 4 | Use as: 5 | ``` 6 | $ docker run --rm blockstream/hal-docker hal address inspect tb1qcw5eh6kasd3ts2a2kzg5mal7yhft0nc0h48wjm 7 | { 8 | "network": "testnet", 9 | "type": "p2wpkh", 10 | "script_pub_key": { 11 | "hex": "0014c3a99beadd8362b82baab0914df7fe25d2b7cf0f", 12 | "asm": "OP_0 OP_PUSHBYTES_20 c3a99beadd8362b82baab0914df7fe25d2b7cf0f" 13 | }, 14 | "witness_program_version": 0, 15 | "witness_pubkey_hash": "c3a99beadd8362b82baab0914df7fe25d2b7cf0f" 16 | } 17 | ``` 18 | -------------------------------------------------------------------------------- /hal-docker/build-and-push-to-dockerhub.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export VER=0.9.5 4 | 5 | docker buildx build \ 6 | --platform linux/amd64,linux/arm64 \ 7 | --push \ 8 | --cache-from blockstream/hal-docker:latest \ 9 | --build-arg VER=${VER} \ 10 | -t blockstream/hal-docker:${VER} \ 11 | -t blockstream/hal-docker:latest . || { echo -e "\nSomething broke"; exit 1; } 12 | -------------------------------------------------------------------------------- /lightningd/.dockerignore: -------------------------------------------------------------------------------- 1 | *.service 2 | *.md 3 | *.conf 4 | *.Dockerfile.* 5 | build-and-push-to-dockerhub.sh -------------------------------------------------------------------------------- /lightningd/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG BITCOIN_VERSION=27.0 2 | FROM blockstream/bitcoind:${BITCOIN_VERSION} AS builder 3 | 4 | # Get CLN 5 | ARG CLN_VERSION 6 | ENV CLN_VERSION=$CLN_VERSION 7 | RUN apt update \ 8 | && apt install -qfy jq autoconf automake build-essential git libtool libsqlite3-dev libffi-dev \ 9 | python3 python3-pip net-tools zlib1g-dev libsodium-dev gettext protobuf-compiler 10 | RUN pip3 install mako --break-system-packages \ 11 | && pip3 install grpcio-tools --break-system-packages 12 | RUN curl https://sh.rustup.rs -sSf | bash -s -- -y 13 | RUN echo 'source $HOME/.cargo/env' >> $HOME/.bashrc 14 | RUN git clone https://github.com/ElementsProject/lightning.git --depth 5 -b ${CLN_VERSION} /opt/lightningd 15 | 16 | # Build CLN 17 | WORKDIR /opt/lightningd 18 | RUN git submodule update --init --recursive --depth 5 19 | RUN ./configure --prefix=/opt/lightning_install 20 | RUN make -j$(nproc) 21 | RUN make install 22 | 23 | # Install plugin dependencies 24 | ARG PLUGIN_PATH=/opt/plugins 25 | ARG RAW_GH_PLUGINS=https://raw.githubusercontent.com/lightningd/plugins/master 26 | RUN pip3 install --upgrade pip wheel --break-system-packages 27 | RUN pip3 install -r $RAW_GH_PLUGINS/summary/requirements.txt \ 28 | prometheus-client==0.6.0 --break-system-packages 29 | 30 | # Add custom plugins (prometheus, summary) 31 | RUN apt install -qfy wget 32 | RUN mkdir -p $PLUGIN_PATH 33 | RUN wget -q -O $PLUGIN_PATH/prometheus.py $RAW_GH_PLUGINS/archived/prometheus/prometheus.py 34 | RUN wget -q -O $PLUGIN_PATH/summary.py $RAW_GH_PLUGINS/summary/summary.py 35 | RUN chmod a+x $PLUGIN_PATH/* 36 | RUN wget -q -O $PLUGIN_PATH/summary_avail.py $RAW_GH_PLUGINS/summary/summary_avail.py 37 | 38 | # Final image 39 | FROM debian:bookworm-slim 40 | 41 | # CLN deps 42 | RUN apt update \ 43 | && apt install -qfy jq libtool libsqlite3-dev libffi-dev \ 44 | python3 python3-pip net-tools zlib1g-dev libsodium-dev gettext 45 | 46 | # Copy binaries from builder 47 | COPY --from=builder /opt/lightning_install /usr/local 48 | COPY --from=builder /usr/local/bin/* /usr/local/bin/ 49 | COPY --from=builder /usr/local/lib/* /usr/local/lib/ 50 | COPY --from=builder /usr/local/share/* /usr/local/share/ 51 | COPY --from=builder /opt/plugins /opt/plugins 52 | 53 | RUN apt clean && apt autoclean 54 | 55 | ENTRYPOINT ["lightningd"] 56 | CMD ["--help"] 57 | -------------------------------------------------------------------------------- /lightningd/README.md: -------------------------------------------------------------------------------- 1 | ## Lightningd 2 | The Dockerfile was adapted from https://github.com/ElementsProject/lightning/blob/master/Dockerfile. 3 | 4 | Feel free to adapt the `build-and-push-to-dockerhub.sh` to push to your own repo/registry. 5 | 6 | You can add custom plugins in the [Dockerfile](./Dockerfile#L29), just follow the way the Prometheus plugin has been added. 7 | 8 | ### Plugins 9 | Add `plugin-dir=/opt/plugins` to your `lightning.conf` to make the custom plugins available. -------------------------------------------------------------------------------- /lightningd/arm/Dockerfile.armv7: -------------------------------------------------------------------------------- 1 | FROM arm32v7/alpine:3.12 AS builder 2 | 3 | COPY qemu-arm-static /usr/bin 4 | 5 | # Download bitcoin binaries 6 | ENV BITCOIN_VERSION=0.21.0 7 | ENV BITCOIN_PGP_KEY=01EA5486DE18A882D4C2684590C8019E36C2E964 8 | 9 | WORKDIR /opt/bitcoin 10 | RUN wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz \ 11 | && wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/SHA256SUMS.asc 12 | 13 | RUN apk add --no-cache --upgrade ca-certificates autoconf automake \ 14 | build-base libressl libtool gmp-dev py3-pip \ 15 | sqlite-dev wget git file gnupg swig zlib-dev gettext \ 16 | && pip3 install mako 17 | 18 | RUN gpg --keyserver keyserver.ubuntu.com --recv-keys ${BITCOIN_PGP_KEY} \ 19 | && gpg --verify SHA256SUMS.asc \ 20 | && grep bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz SHA256SUMS.asc | sha256sum -c 21 | RUN tar xzvf bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz --strip-components=1 -C /opt/bitcoin 22 | 23 | # Get c-lightning 24 | ENV CLN_VERSION=v0.9.3 25 | RUN git clone https://github.com/ElementsProject/lightning.git -b ${CLN_VERSION} /opt/lightningd 26 | 27 | # Build c-lightning 28 | WORKDIR /opt/lightningd 29 | RUN ./configure --prefix=/opt/lightning_install 30 | RUN make 31 | RUN make install 32 | 33 | FROM arm32v7/alpine:3.12 34 | 35 | RUN apk add --no-cache gmp-dev sqlite-dev inotify-tools socat bash \ 36 | zlib-dev wget ca-certificates gnupg py3-pip 37 | 38 | # Add GNU Lib C 39 | ENV GLIBC_VERSION=2.28-r0 40 | RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub \ 41 | && wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk \ 42 | && wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-bin-${GLIBC_VERSION}.apk 43 | 44 | RUN apk update \ 45 | && apk --no-cache add glibc-${GLIBC_VERSION}.apk \ 46 | && apk --no-cache add glibc-bin-${GLIBC_VERSION}.apk \ 47 | && rm -f glibc-* 48 | 49 | # Copy binaries from builder 50 | COPY --from=builder /opt/lightning_install /usr/local 51 | COPY --from=builder /opt/bitcoin/bin/* /usr/local/bin/ 52 | 53 | # Install plugin dependencies 54 | RUN pip3 install wheel 55 | RUN pip3 install -r https://raw.githubusercontent.com/lightningd/plugins/3fc4ece1ba42bf69b4f8ab6f5683decada0502b2/summary/requirements.txt \ 56 | prometheus-client==0.6.0 57 | 58 | ARG PLUGIN_PATH=/usr/local/libexec/c-lightning/plugins 59 | 60 | # Add custom plugins (prometheus, summary) 61 | RUN wget -q -O $PLUGIN_PATH/prometheus.py https://raw.githubusercontent.com/lightningd/plugins/3fc4ece1ba42bf69b4f8ab6f5683decada0502b2/prometheus/prometheus.py \ 62 | && wget -q -O $PLUGIN_PATH/summary.py https://raw.githubusercontent.com/lightningd/plugins/3fc4ece1ba42bf69b4f8ab6f5683decada0502b2/summary/summary.py \ 63 | && chmod a+x $PLUGIN_PATH/* \ 64 | && wget -q -O $PLUGIN_PATH/summary_avail.py https://raw.githubusercontent.com/lightningd/plugins/3fc4ece1ba42bf69b4f8ab6f5683decada0502b2/summary/summary_avail.py 65 | -------------------------------------------------------------------------------- /lightningd/arm/Dockerfile.armv7-esplora: -------------------------------------------------------------------------------- 1 | FROM arm32v7/alpine:3.12 AS builder 2 | 3 | COPY qemu-arm-static /usr/bin 4 | 5 | # Download bitcoin binaries 6 | ENV BITCOIN_VERSION=0.21.0 7 | ENV BITCOIN_PGP_KEY=01EA5486DE18A882D4C2684590C8019E36C2E964 8 | 9 | WORKDIR /opt/bitcoin 10 | RUN wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz \ 11 | && wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/SHA256SUMS.asc 12 | 13 | RUN apk add --no-cache --upgrade ca-certificates autoconf automake \ 14 | build-base libressl libtool gmp-dev py3-pip \ 15 | sqlite-dev wget git file gnupg swig zlib-dev gettext curl-dev \ 16 | && pip3 install mako 17 | 18 | RUN gpg --keyserver keyserver.ubuntu.com --recv-keys ${BITCOIN_PGP_KEY} \ 19 | && gpg --verify SHA256SUMS.asc \ 20 | && grep bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz SHA256SUMS.asc | sha256sum -c 21 | RUN tar xzvf bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz --strip-components=1 -C /opt/bitcoin 22 | 23 | # Get c-lightning 24 | ENV CLN_VERSION=v0.9.3 25 | RUN git clone https://github.com/ElementsProject/lightning.git -b ${CLN_VERSION} /opt/lightningd 26 | 27 | # Build c-lightning with custom Esplora plugin 28 | WORKDIR /opt/lightningd 29 | RUN ./configure --prefix=/opt/lightning_install 30 | RUN wget -O plugins/esplora.c https://raw.githubusercontent.com/lvaccaro/esplora_clnd_plugin/master/esplora.c \ 31 | && wget -O Makefile.patch https://raw.githubusercontent.com/lvaccaro/esplora_clnd_plugin/master/Makefile.patch \ 32 | && patch -p1 < Makefile.patch \ 33 | && sed -i 's/LDLIBS = /LDLIBS = -lcurl /g' Makefile 34 | RUN make 35 | RUN make install 36 | 37 | # Add custom plugins 38 | RUN wget -q -O /opt/lightningd/plugins/prometheus.py https://raw.githubusercontent.com/lightningd/plugins/3fc4ece1ba42bf69b4f8ab6f5683decada0502b2/prometheus/prometheus.py \ 39 | && chmod a+x /opt/lightningd/plugins/prometheus.py 40 | 41 | FROM arm32v7/alpine:3.12 42 | 43 | RUN apk add --no-cache gmp-dev sqlite-dev inotify-tools socat bash \ 44 | zlib-dev wget ca-certificates gnupg py3-pip curl-dev 45 | 46 | # Add GNU Lib C 47 | ENV GLIBC_VERSION=2.28-r0 48 | RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub \ 49 | && wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk \ 50 | && wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-bin-${GLIBC_VERSION}.apk 51 | 52 | RUN apk update \ 53 | && apk --no-cache add glibc-${GLIBC_VERSION}.apk \ 54 | && apk --no-cache add glibc-bin-${GLIBC_VERSION}.apk \ 55 | && rm -f glibc-* 56 | 57 | # Copy binaries from builder 58 | COPY --from=builder /opt/lightning_install /usr/local 59 | COPY --from=builder /opt/bitcoin/bin/* /usr/local/bin/ 60 | 61 | # Install plugin dependencies 62 | RUN pip3 install wheel 63 | RUN pip3 install -r https://raw.githubusercontent.com/lightningd/plugins/3fc4ece1ba42bf69b4f8ab6f5683decada0502b2/summary/requirements.txt \ 64 | prometheus-client==0.6.0 65 | 66 | ARG PLUGIN_PATH=/usr/local/libexec/c-lightning/plugins 67 | 68 | # Add custom plugins (prometheus, summary) 69 | RUN wget -q -O $PLUGIN_PATH/prometheus.py https://raw.githubusercontent.com/lightningd/plugins/3fc4ece1ba42bf69b4f8ab6f5683decada0502b2/prometheus/prometheus.py \ 70 | && wget -q -O $PLUGIN_PATH/summary.py https://raw.githubusercontent.com/lightningd/plugins/3fc4ece1ba42bf69b4f8ab6f5683decada0502b2/summary/summary.py \ 71 | && chmod a+x $PLUGIN_PATH/* \ 72 | && wget -q -O $PLUGIN_PATH/summary_avail.py https://raw.githubusercontent.com/lightningd/plugins/3fc4ece1ba42bf69b4f8ab6f5683decada0502b2/summary/summary_avail.py 73 | -------------------------------------------------------------------------------- /lightningd/arm/README.md: -------------------------------------------------------------------------------- 1 | ### Building armv7 2 | You need to: `sudo apt-get install -y qemu-user-static` and copy it in this directory first. 3 | ``` 4 | 48d68c1258465bc0d9e957d9dbe0f8321f7b33436619501f19b1c430b807e69a qemu-arm-static 5 | ``` 6 | -------------------------------------------------------------------------------- /lightningd/build-and-push-to-dockerhub.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -ex 3 | 4 | export BITCOIN_VERSION=${BITCOIN_VERSION:-27.0} 5 | export VER=${VER:-v24.08.2} 6 | 7 | # Skipping ARM, segmentation faults. 8 | docker buildx build \ 9 | --platform linux/amd64 \ 10 | --push \ 11 | --cache-from blockstream/lightningd:latest \ 12 | --build-arg CLN_VERSION=${VER} \ 13 | --build-arg BITCOIN_VERSION=${BITCOIN_VERSION} \ 14 | -t blockstream/lightningd:${VER} . || { echo -e "\nSomething broke"; exit 1; } 15 | 16 | if [[ $LATEST -eq 1 ]] 17 | then 18 | docker buildx imagetools create -t blockstream/lightningd:latest blockstream/lightningd:${VER} 19 | fi -------------------------------------------------------------------------------- /lightningd/lightning.service: -------------------------------------------------------------------------------- 1 | /etc/systemd/system/lightning.service 2 | 3 | [Unit] 4 | Description=Lightning node 5 | Wants=docker.target 6 | After=docker.service 7 | 8 | [Service] 9 | Restart=always 10 | RestartSec=3 11 | ExecStartPre=/usr/bin/docker pull blockstream/lightningd:latest 12 | ExecStart=/usr/bin/docker run \ 13 | --network=host \ 14 | --pid=host \ 15 | --name=lightning \ 16 | -v /mnt/data/lightning/lightning.conf:/root/.lightning/lightning.conf:ro \ 17 | -v /mnt/data/lightning:/root/.lightning \ 18 | blockstream/lightningd:latest lightningd --testnet --conf=/root/.lightning/lightning.conf --plugin-dir=/usr/local/bin/plugins 19 | ExecStop=/usr/bin/docker exec lightning lightning-cli stop 20 | ExecStopPost=/usr/bin/sleep 3 21 | ExecStopPost=/usr/bin/docker rm -f lightning 22 | 23 | [Install] 24 | WantedBy=multi-user.target 25 | -------------------------------------------------------------------------------- /lightningd/misc/historian/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG VER=latest 2 | FROM blockstream/lightningd:${VER} 3 | 4 | # Install plugin dependencies 5 | RUN apt install -qfy jq autoconf automake build-essential git libtool libsqlite3-dev libffi-dev \ 6 | python3 python3-pip net-tools zlib1g-dev libsodium-dev gettext wget unzip pkg-config 7 | RUN pip3 install poetry --break-system-packages 8 | 9 | ENV PLUGIN_PATH=/opt/plugins 10 | 11 | # Add custom plugins (connection pool, historian) 12 | COPY connectionpool.py $PLUGIN_PATH/connectionpool.py 13 | RUN mkdir -p $PLUGIN_PATH/historian/cli \ 14 | && wget -q https://github.com/lightningd/plugins/archive/master.zip \ 15 | && unzip -qqj master.zip "plugins-master/archived/historian/cli/*" -d "${PLUGIN_PATH}/historian/cli" \ 16 | && unzip -qqj master.zip "plugins-master/archived/historian/*" -x "plugins-master/archived/historian/cli/*" -d "${PLUGIN_PATH}/historian/" \ 17 | && rm master.zip \ 18 | && chmod -x $PLUGIN_PATH/historian/historian-cli ## we do not want CLN to think this is a plugin at startup 19 | 20 | RUN cd $PLUGIN_PATH/historian \ 21 | && poetry install 22 | 23 | RUN apt remove -qfy wget unzip jq autoconf automake build-essential git 24 | RUN apt clean && apt autoclean \ 25 | && pip3 uninstall -y poetry --break-system-packages 26 | -------------------------------------------------------------------------------- /lightningd/misc/historian/build-and-push-to-dockerhub.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -ex 3 | 4 | export VER=${VER:-v24.08.2} 5 | 6 | docker buildx build \ 7 | --platform linux/amd64 \ 8 | --push \ 9 | --cache-from blockstream/lightningd:latest \ 10 | --build-arg VER=${VER} \ 11 | -t blockstream/lightningd:${VER}-historian . || { echo -e "\nSomething broke"; exit 1; } 12 | -------------------------------------------------------------------------------- /lightningd/misc/historian/connectionpool.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | from pyln.client import Plugin 3 | from threading import Thread 4 | import urllib3 5 | import json 6 | import time 7 | 8 | plugin = Plugin() 9 | 10 | def maintain(): 11 | target = 100 12 | while True: 13 | print("Checking connection pool") 14 | peers = plugin.rpc.listpeers() 15 | print(peers) 16 | p = urllib3.request('GET', 'https://1ml.com/node?active=true&public=true&json=true&order=lastupdated') 17 | t = json.loads(p.data) 18 | p = [n for n in t if 'addresses' in n and 'onion' not in n['addresses'][0]['addr']] 19 | print(p) 20 | 21 | candidates = [(n['pub_key'], n['addresses'][0]['addr']) for n in p] 22 | print(candidates) 23 | numcandidates = target - len(peers['peers']) 24 | candidates = candidates[:numcandidates] 25 | print(candidates) 26 | 27 | for c in candidates: 28 | try: 29 | plugin.rpc.connect(c[0], c[1]) 30 | except: 31 | pass 32 | 33 | time.sleep(10) 34 | 35 | 36 | @plugin.init() 37 | def init(options, configuration): 38 | print(options, configuration) 39 | t = Thread(target=maintain, daemon=True) 40 | t.start() 41 | 42 | 43 | plugin.run() 44 | -------------------------------------------------------------------------------- /lightningd/misc/rebalance.Dockerfile: -------------------------------------------------------------------------------- 1 | # 3.13.7 2 | FROM alpine@sha256:85e16a753e459ea44a8aa1dfc1cb8b625f9c487b00ea686384a96923a3691f4e AS builder 3 | 4 | # Download bitcoin binaries 5 | ENV WLADIMIRVDL_PGP_KEY=71A3B16735405025D447E8F274810B012346C9A6 6 | ENV ACHOW_PGP_KEY=152812300785C96444D3334D17565732E08E5E41 7 | ENV BITCOIN_VERSION=22.0 8 | 9 | RUN apk add --no-cache --upgrade ca-certificates autoconf automake git libtool \ 10 | gmp-dev sqlite-dev py3-pip net-tools zlib-dev libsodium gettext \ 11 | build-base coreutils wget gnupg coreutils swig postgresql-dev \ 12 | && pip3 install mako mrkd mistune==0.8.4 13 | 14 | # Get bitcoin 15 | RUN wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz \ 16 | && wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/SHA256SUMS.asc \ 17 | && wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/SHA256SUMS 18 | 19 | RUN gpg --keyserver hkps://keys.openpgp.org --recv-keys ${WLADIMIRVDL_PGP_KEY} ${ACHOW_PGP_KEY} \ 20 | && csplit -ksz SHA256SUMS.asc /-----BEGIN/ '{*}' \ 21 | && for i in xx*; do gpg --verify $i SHA256SUMS && break; done \ 22 | && grep bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz SHA256SUMS | sha256sum -c 23 | RUN mkdir /opt/bitcoin \ 24 | && tar xzvf bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz --strip-components=1 -C /opt/bitcoin 25 | 26 | # Get c-lightning 27 | ARG CLN_VERSION=v23.08 28 | ENV CLN_VERSION=$CLN_VERSION 29 | RUN git clone https://github.com/ElementsProject/lightning.git --depth 20 -b ${CLN_VERSION} /opt/lightningd 30 | 31 | # Build c-lightning 32 | WORKDIR /opt/lightningd 33 | RUN git submodule update --init --recursive --depth 20 34 | RUN ./configure --prefix=/opt/lightning_install 35 | # temporary fix for alpine builds 36 | RUN rm -r cli/test/*.c 37 | RUN make -j 32 38 | RUN make install 39 | 40 | FROM alpine@sha256:85e16a753e459ea44a8aa1dfc1cb8b625f9c487b00ea686384a96923a3691f4e 41 | 42 | # C-Lightning deps 43 | RUN apk add --no-cache gmp-dev inotify-tools socat bash \ 44 | zlib-dev ca-certificates gnupg py3-pip sqlite-libs postgresql-libs 45 | RUN apk add --no-cache npm openssl 46 | 47 | # Add GNU Lib C 48 | ENV GLIBC_VERSION=2.33-r0 49 | RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub \ 50 | && wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk \ 51 | && wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-bin-${GLIBC_VERSION}.apk 52 | 53 | RUN apk update \ 54 | && apk --no-cache add glibc-${GLIBC_VERSION}.apk \ 55 | && apk --no-cache add glibc-bin-${GLIBC_VERSION}.apk \ 56 | && rm -f glibc-* 57 | 58 | # Copy binaries from builder 59 | COPY --from=builder /opt/lightning_install /usr/local 60 | COPY --from=builder /opt/bitcoin/bin/* /usr/local/bin/ 61 | COPY --from=builder /opt/bitcoin/lib/* /usr/local/lib/ 62 | COPY --from=builder /opt/bitcoin/share/* /usr/local/share/ 63 | 64 | # Install plugin dependencies 65 | ARG PLUGIN_PATH=/opt/plugins 66 | ARG RAW_GH_PLUGINS=https://raw.githubusercontent.com/lightningd/plugins/3fc4ece1ba42bf69b4f8ab6f5683decada0502b2 67 | 68 | RUN apk add --no-cache --virtual deps wget git 69 | RUN pip3 install --upgrade pip wheel 70 | RUN pip3 install -r $RAW_GH_PLUGINS/rebalance/requirements.txt \ 71 | -r $RAW_GH_PLUGINS/summary/requirements.txt \ 72 | prometheus-client==0.6.0 73 | 74 | # Add custom plugins (rebalance, summary, prometheus, Ride The Lightning) 75 | RUN mkdir -p $PLUGIN_PATH \ 76 | && wget -q -O $PLUGIN_PATH/rebalance.py $RAW_GH_PLUGINS/rebalance/rebalance.py \ 77 | && wget -q -O $PLUGIN_PATH/summary.py $RAW_GH_PLUGINS/summary/summary.py \ 78 | && wget -q -O $PLUGIN_PATH/prometheus.py $RAW_GH_PLUGINS/prometheus/prometheus.py \ 79 | && chmod a+x $PLUGIN_PATH/* \ 80 | && wget -q -O $PLUGIN_PATH/summary_avail.py $RAW_GH_PLUGINS/summary/summary_avail.py 81 | 82 | RUN git clone https://github.com/Ride-The-Lightning/c-lightning-REST.git $PLUGIN_PATH/rtl 83 | RUN cd $PLUGIN_PATH/rtl && npm i --only=production 84 | RUN apk --purge del deps 85 | 86 | ENTRYPOINT ["lightningd"] 87 | CMD ["--help"] -------------------------------------------------------------------------------- /lightningd/misc/sauron.Dockerfile: -------------------------------------------------------------------------------- 1 | # 3.13.6 2 | FROM alpine@sha256:e15947432b813e8ffa90165da919953e2ce850bef511a0ad1287d7cb86de84b5 AS builder 3 | 4 | # Download bitcoin binaries 5 | ENV BITCOIN_VERSION=0.21.1 6 | ENV BITCOIN_PGP_KEY=01EA5486DE18A882D4C2684590C8019E36C2E964 7 | 8 | RUN apk add --no-cache --upgrade ca-certificates autoconf automake \ 9 | build-base libressl libtool gmp-dev py3-pip python2 \ 10 | sqlite-dev wget git file gnupg swig zlib-dev gettext postgresql-dev \ 11 | && pip3 install mako 12 | 13 | # Get bitcoin 14 | WORKDIR /opt/bitcoin 15 | RUN wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz \ 16 | && wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/SHA256SUMS.asc 17 | RUN gpg --keyserver keyserver.ubuntu.com --recv-keys ${BITCOIN_PGP_KEY} \ 18 | && gpg --verify SHA256SUMS.asc \ 19 | && grep bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz SHA256SUMS.asc | sha256sum -c 20 | RUN tar xzvf bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz --strip-components=1 -C /opt/bitcoin 21 | 22 | # Get c-lightning 23 | ARG CLN_VERSION=v23.08 24 | ENV CLN_VERSION=$CLN_VERSION 25 | RUN git clone https://github.com/ElementsProject/lightning.git -b ${CLN_VERSION} /opt/lightningd 26 | 27 | # Build c-lightning 28 | WORKDIR /opt/lightningd 29 | RUN git submodule update --init --recursive --depth 20 30 | RUN ./configure --prefix=/opt/lightning_install 31 | RUN make -j 32 32 | RUN make install 33 | 34 | FROM alpine@sha256:e15947432b813e8ffa90165da919953e2ce850bef511a0ad1287d7cb86de84b5 35 | 36 | # C-Lightning deps 37 | RUN apk add --no-cache gmp-dev inotify-tools socat bash \ 38 | zlib-dev ca-certificates gnupg py3-pip sqlite-libs postgresql-libs 39 | 40 | # Add GNU Lib C 41 | ENV GLIBC_VERSION=2.28-r0 42 | RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub \ 43 | && wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk \ 44 | && wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-bin-${GLIBC_VERSION}.apk 45 | 46 | RUN apk update \ 47 | && apk --no-cache add glibc-${GLIBC_VERSION}.apk \ 48 | && apk --no-cache add glibc-bin-${GLIBC_VERSION}.apk \ 49 | && rm -f glibc-* 50 | 51 | # Copy binaries from builder 52 | COPY --from=builder /opt/lightning_install /usr/local 53 | COPY --from=builder /opt/bitcoin/bin/* /usr/local/bin/ 54 | 55 | # Install plugin dependencies 56 | RUN apk add --no-cache --virtual deps wget 57 | RUN pip3 install --upgrade pip wheel 58 | RUN pip3 install -r https://raw.githubusercontent.com/lightningd/plugins/3fc4ece1ba42bf69b4f8ab6f5683decada0502b2/summary/requirements.txt 59 | 60 | ARG PLUGIN_PATH=/opt/plugins 61 | 62 | # Add custom plugins (sauron, summary) 63 | RUN mkdir -p $PLUGIN_PATH \ 64 | && wget -q -O $PLUGIN_PATH/sauron.py https://raw.githubusercontent.com/lightningd/plugins/3fc4ece1ba42bf69b4f8ab6f5683decada0502b2/sauron/sauron.py \ 65 | && wget -q -O $PLUGIN_PATH/summary.py https://raw.githubusercontent.com/lightningd/plugins/3fc4ece1ba42bf69b4f8ab6f5683decada0502b2/summary/summary.py \ 66 | && chmod a+x $PLUGIN_PATH/* \ 67 | && wget -q -O $PLUGIN_PATH/art.py https://raw.githubusercontent.com/lightningd/plugins/3fc4ece1ba42bf69b4f8ab6f5683decada0502b2/sauron/art.py 68 | RUN apk --purge del deps 69 | 70 | ENTRYPOINT ["lightningd"] 71 | CMD ["--help"] -------------------------------------------------------------------------------- /lightningd/peerswap/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM blockstream/lightningd:v24.08.2 as builder 2 | FROM golang:1.20-alpine3.18 3 | 4 | RUN apk add --no-cache --upgrade curl gnupg 5 | 6 | # Download elements binaries 7 | ENV ELEMENTS_VERSION=22.1.1 8 | ENV ELEMENTS_PGP_KEY="https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xbd0f3062f87842410b06a0432f656b0610604482" 9 | ENV ELEMENTS_TARBALL=elements-${ELEMENTS_VERSION}-x86_64-linux-gnu.tar.gz 10 | 11 | RUN wget https://github.com/ElementsProject/elements/releases/download/elements-${ELEMENTS_VERSION}/${ELEMENTS_TARBALL} \ 12 | && wget https://github.com/ElementsProject/elements/releases/download/elements-${ELEMENTS_VERSION}/SHA256SUMS.asc 13 | 14 | RUN curl -s ${ELEMENTS_PGP_KEY} | gpg --import \ 15 | && gpg --verify SHA256SUMS.asc \ 16 | && grep ${ELEMENTS_TARBALL} SHA256SUMS.asc | sha256sum -c 17 | RUN mkdir /opt/elements \ 18 | && tar xzvf ${ELEMENTS_TARBALL} --strip-components=1 -C /opt/elements \ 19 | && rm ${ELEMENTS_TARBALL} 20 | RUN mv /opt/elements/bin/* /usr/local/bin/ \ 21 | && mv /opt/elements/lib/* /usr/local/lib/ \ 22 | && mv /opt/elements/share/* /usr/local/share/ \ 23 | && rm -rf /opt/elements SHA256SUMS.asc 24 | 25 | # CLN deps 26 | RUN apk add --no-cache ca-certificates gmp libgcc libsodium sqlite-libs zlib \ 27 | inotify-tools socat bash gnupg py3-pip postgresql-libs 28 | 29 | # Add GNU Lib C 30 | ENV GLIBC_VERSION=2.33-r0 31 | RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub \ 32 | && wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk \ 33 | && wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-bin-${GLIBC_VERSION}.apk 34 | 35 | RUN apk update \ 36 | # context for --force-overwrite https://github.com/sgerrand/alpine-pkg-glibc/issues/185 37 | && apk --no-cache add --force-overwrite glibc-${GLIBC_VERSION}.apk glibc-bin-${GLIBC_VERSION}.apk \ 38 | && rm -f glibc-* 39 | 40 | # Copy binaries from builder 41 | COPY --from=builder /usr/local/bin/* /usr/local/bin/ 42 | COPY --from=builder /usr/local/libexec /usr/local/libexec/ 43 | COPY --from=builder /usr/local/lib/libbitcoinconsensus* /usr/local/lib/ 44 | COPY --from=builder /usr/local/share/man1/bitcoin* /usr/local/share/man1/ 45 | 46 | # Install plugin dependencies 47 | ARG PLUGIN_PATH=/opt/plugins 48 | ARG RAW_GH_PLUGINS=https://raw.githubusercontent.com/lightningd/plugins/3fc4ece1ba42bf69b4f8ab6f5683decada0502b2 49 | 50 | RUN apk add --no-cache --virtual deps wget git make gcc musl-dev libffi-dev python3-dev 51 | RUN pip3 install --upgrade pip wheel 52 | RUN pip3 install -r $RAW_GH_PLUGINS/rebalance/requirements.txt \ 53 | -r $RAW_GH_PLUGINS/summary/requirements.txt \ 54 | prometheus-client==0.6.0 \ 55 | pyln-bolt7 \ 56 | pyln-proto 57 | 58 | # Add custom plugins (rebalance, summary, prometheus) 59 | RUN mkdir -p $PLUGIN_PATH \ 60 | && wget -q -O $PLUGIN_PATH/rebalance.py $RAW_GH_PLUGINS/rebalance/rebalance.py \ 61 | && wget -q -O $PLUGIN_PATH/summary.py $RAW_GH_PLUGINS/summary/summary.py \ 62 | && wget -q -O $PLUGIN_PATH/prometheus.py $RAW_GH_PLUGINS/archived/prometheus/prometheus.py \ 63 | && chmod a+x $PLUGIN_PATH/* \ 64 | && wget -q -O $PLUGIN_PATH/summary_avail.py $RAW_GH_PLUGINS/summary/summary_avail.py \ 65 | && wget -q -O $PLUGIN_PATH/clnutils.py $RAW_GH_PLUGINS/rebalance/clnutils.py 66 | 67 | # Add peerswap 68 | ARG PEERSWAP_COMMIT=5935fb4656307a87cafde2513d54deec1c26f8f2 69 | ENV PEERSWAP_COMMIT=$PEERSWAP_COMMIT 70 | RUN git clone https://github.com/ElementsProject/peerswap.git -n $PLUGIN_PATH/ps \ 71 | && cd $PLUGIN_PATH/ps \ 72 | # allows to fetch PRs 73 | && git config --local --add remote.origin.fetch '+refs/pull/*/head:refs/remotes/origin/pr/*' \ 74 | && git fetch \ 75 | && git checkout $PEERSWAP_COMMIT \ 76 | && make cln-release 77 | 78 | RUN apk --purge del deps 79 | 80 | ENTRYPOINT ["lightningd"] 81 | CMD ["--help"] 82 | -------------------------------------------------------------------------------- /lightningd/peerswap/build-and-push-to-dockerhub.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -ex 3 | 4 | export VER=${VER:-v24.08.2} 5 | export PS_VER=${PS_VER:-3eadb6} 6 | 7 | export IMAGE=blockstream/lightningd 8 | export DOCKERFILE=debian.Dockerfile 9 | export FLAVOR=${IMAGE}:${VER}-peerswap-debian 10 | # export DOCKERFILE=Dockerfile 11 | # export FLAVOR=${IMAGE}:${VER}-peerswap 12 | 13 | # --platform linux/amd64,arm64 \ 14 | docker buildx build \ 15 | --platform linux/amd64 \ 16 | --push \ 17 | --cache-from ${FLAVOR} \ 18 | --build-arg CLN_VERSION=${VER} \ 19 | --build-arg PEERSWAP_COMMIT=${PS_VER} \ 20 | -t ${FLAVOR} \ 21 | -f ${DOCKERFILE} \ 22 | -t ${FLAVOR}-${PS_VER} . || { echo -e "\nSomething broke"; exit 1; } 23 | -------------------------------------------------------------------------------- /lightningd/peerswap/debian.Dockerfile: -------------------------------------------------------------------------------- 1 | # https://github.com/docker-library/golang/blob/master/1.22/bullseye/Dockerfile 2 | FROM golang:1.22.11-bullseye AS builder 3 | 4 | WORKDIR /opt 5 | 6 | RUN apt-get update 7 | RUN apt-get install -y \ 8 | autoconf automake build-essential git libtool libgmp-dev libsqlite3-dev \ 9 | python3 python3-pip net-tools zlib1g-dev libsodium-dev gettext jq \ 10 | && pip3 install --upgrade pip mako mrkd mistune==0.8.4 grpcio-tools 11 | 12 | # Download bitcoin binaries 13 | ENV WLADIMIRVDL_PGP_KEY=https://raw.githubusercontent.com/bitcoin-core/guix.sigs/main/builder-keys/laanwj.gpg 14 | ENV ACHOW_PGP_KEY=https://raw.githubusercontent.com/bitcoin-core/guix.sigs/main/builder-keys/achow101.gpg 15 | ENV BITCOIN_VERSION=26.1 16 | ENV BITCOIN_TARBALL=bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz 17 | 18 | # Get bitcoin 19 | RUN wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/${BITCOIN_TARBALL} \ 20 | && wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/SHA256SUMS.asc \ 21 | && wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/SHA256SUMS 22 | 23 | RUN curl -s ${WLADIMIRVDL_PGP_KEY} | gpg --import \ 24 | && curl -s ${ACHOW_PGP_KEY} | gpg --import \ 25 | && csplit -ksz SHA256SUMS.asc /-----BEGIN/ '{*}' \ 26 | && for i in xx*; do gpg --verify $i SHA256SUMS && break; done \ 27 | && grep ${BITCOIN_TARBALL} SHA256SUMS | sha256sum -c 28 | RUN mkdir /opt/bitcoin \ 29 | && tar xzvf ${BITCOIN_TARBALL} --strip-components=1 -C /opt/bitcoin \ 30 | && rm SHA256SUMS* ${BITCOIN_TARBALL} 31 | 32 | # Download elements binaries 33 | ENV ELEMENTS_VERSION=22.1.1 34 | ENV ELEMENTS_PGP_KEY="https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xbd0f3062f87842410b06a0432f656b0610604482" 35 | ENV ELEMENTS_TARBALL=elements-${ELEMENTS_VERSION}-x86_64-linux-gnu.tar.gz 36 | 37 | RUN wget https://github.com/ElementsProject/elements/releases/download/elements-${ELEMENTS_VERSION}/${ELEMENTS_TARBALL} \ 38 | && wget https://github.com/ElementsProject/elements/releases/download/elements-${ELEMENTS_VERSION}/SHA256SUMS.asc 39 | 40 | RUN curl -s ${ELEMENTS_PGP_KEY} | gpg --import \ 41 | && gpg --verify SHA256SUMS.asc \ 42 | && grep ${ELEMENTS_TARBALL} SHA256SUMS.asc | sha256sum -c 43 | RUN mkdir /opt/elements \ 44 | && tar xzvf ${ELEMENTS_TARBALL} --strip-components=1 -C /opt/elements \ 45 | && rm SHA256SUMS* ${ELEMENTS_TARBALL} 46 | 47 | # Get c-lightning 48 | ARG CLN_VERSION=v24.08.2 49 | ENV CLN_VERSION=$CLN_VERSION 50 | RUN git clone https://github.com/ElementsProject/lightning.git --depth 5 -b ${CLN_VERSION} /opt/lightningd 51 | 52 | # Build c-lightning 53 | WORKDIR /opt/lightningd 54 | RUN git submodule update --init --recursive --depth 5 55 | RUN ./configure --prefix=/opt/lightning_install 56 | RUN make -j 32 || sleep 9999 57 | RUN make install 58 | 59 | FROM golang:1.22.11-bullseye 60 | 61 | # C-Lightning deps 62 | RUN apt-get update 63 | RUN apt-get install -yq git bash autoconf automake build-essential libtool libgmp-dev libsqlite3-dev \ 64 | python3 python3-pip net-tools zlib1g-dev libsodium-dev gettext 65 | 66 | # Copy binaries from builder 67 | COPY --from=builder /opt/lightning_install /usr/local 68 | COPY --from=builder /opt/bitcoin/bin/* /usr/local/bin/ 69 | COPY --from=builder /opt/bitcoin/lib/* /usr/local/lib/ 70 | COPY --from=builder /opt/bitcoin/share/* /usr/local/share/ 71 | COPY --from=builder /opt/elements/bin/* /usr/local/bin/ 72 | COPY --from=builder /opt/elements/lib/* /usr/local/lib/ 73 | COPY --from=builder /opt/elements/share/* /usr/local/share/ 74 | 75 | # Install plugin dependencies 76 | ARG PLUGIN_PATH=/opt/plugins 77 | ARG RAW_GH_PLUGINS=https://raw.githubusercontent.com/lightningd/plugins/3fc4ece1ba42bf69b4f8ab6f5683decada0502b2 78 | 79 | RUN apt-get update 80 | RUN apt-get install -yq wget make gcc libffi-dev python3-dev python3-gdbm 81 | RUN pip3 install --upgrade pip wheel 82 | # Not installing paytest's deps since they should be covered by other packages' 83 | ## and its pyln-client/proto version requirement was a bit too old (0.9.2 up to 0.10.0) 84 | RUN pip3 install -r $RAW_GH_PLUGINS/rebalance/requirements.txt \ 85 | -r $RAW_GH_PLUGINS/summary/requirements.txt \ 86 | prometheus-client==0.6.0 \ 87 | pyln-bolt7 \ 88 | pyln-proto 89 | 90 | # Add custom plugins (rebalance, summary, prometheus, paytest) 91 | RUN mkdir -p $PLUGIN_PATH \ 92 | && wget -q -O $PLUGIN_PATH/rebalance.py $RAW_GH_PLUGINS/rebalance/rebalance.py \ 93 | && wget -q -O $PLUGIN_PATH/summary.py $RAW_GH_PLUGINS/summary/summary.py \ 94 | && wget -q -O $PLUGIN_PATH/prometheus.py $RAW_GH_PLUGINS/archived/prometheus/prometheus.py \ 95 | && wget -q -O $PLUGIN_PATH/paytest.py $RAW_GH_PLUGINS/archived/paytest/paytest.py \ 96 | && chmod a+x $PLUGIN_PATH/* \ 97 | && wget -q -O $PLUGIN_PATH/summary_avail.py $RAW_GH_PLUGINS/summary/summary_avail.py \ 98 | && wget -q -O $PLUGIN_PATH/clnutils.py $RAW_GH_PLUGINS/rebalance/clnutils.py 99 | 100 | # Add peerswap 101 | ARG PEERSWAP_COMMIT=5935fb4656307a87cafde2513d54deec1c26f8f2 102 | ENV PEERSWAP_COMMIT=$PEERSWAP_COMMIT 103 | RUN git clone https://github.com/ElementsProject/peerswap.git -n $PLUGIN_PATH/ps \ 104 | && cd $PLUGIN_PATH/ps \ 105 | # allows to fetch PRs 106 | && git config --local --add remote.origin.fetch '+refs/pull/*/head:refs/remotes/origin/pr/*' \ 107 | && git fetch \ 108 | && git checkout $PEERSWAP_COMMIT \ 109 | && make cln-release 110 | 111 | ENTRYPOINT ["lightningd"] 112 | CMD ["--help"] 113 | -------------------------------------------------------------------------------- /lightningd/qemu-arm-static: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blockstream/bitcoin-images/cfb7dc060ae98f1f212d4f4cba2ce79ebb40e107/lightningd/qemu-arm-static -------------------------------------------------------------------------------- /liquidd-legacy/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine 2 | 3 | ENV GLIBC_VERSION=2.28-r0 4 | ENV LIQUID_VERSION=2.14.1.24 5 | 6 | WORKDIR /opt/liquid 7 | 8 | RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub \ 9 | && wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk \ 10 | && wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-bin-${GLIBC_VERSION}.apk 11 | 12 | RUN apk update \ 13 | && apk --no-cache add ca-certificates wget gnupg bash \ 14 | && apk --no-cache add glibc-${GLIBC_VERSION}.apk \ 15 | && apk --no-cache add glibc-bin-${GLIBC_VERSION}.apk 16 | 17 | RUN wget -O liquid-latest.tar.gz https://liquid-packages.blockstream.com/liquid-binary-repo/gitian/liquid-latest.tar.gz \ 18 | & wget -O liquid-latest.tar.gz.asc https://liquid-packages.blockstream.com/liquid-binary-repo/gitian/liquid-latest.tar.gz.asc \ 19 | && gpg --keyserver pgp.mit.edu --recv-keys EA3C448BB4A71A00 \ 20 | && gpg --verify liquid-latest.tar.gz.asc \ 21 | && tar xzvf liquid-latest.tar.gz \ 22 | && mkdir /root/.liquid \ 23 | && apk del wget ca-certificates \ 24 | && cp liquid-${LIQUID_VERSION}/bin/* /usr/local/bin/ \ 25 | && rm -rf liquid* \ 26 | && rm -rf glibc-* 27 | -------------------------------------------------------------------------------- /liquidd-legacy/publish.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | docker pull blockstream/liquidd-legacy:latest || true 4 | docker build --cache-from blockstream/liquidd-legacy:latest -t blockstream/liquidd-legacy:latest . || (echo -e "\nSomething broke" && exit 1) 5 | docker push blockstream/liquidd-legacy:latest 6 | 7 | SHA=$(docker inspect --format='{{index .RepoDigests 0}}' blockstream/liquidd-legacy:latest) 8 | 9 | echo -e "The new image is:\n${SHA}" 10 | -------------------------------------------------------------------------------- /tor/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:bookworm-slim 2 | 3 | RUN useradd -s /bin/bash -u 2000 tor 4 | RUN mkdir -p /var/run/tor && chown -R tor:tor /var/run/tor && chmod 2700 /var/run/tor 5 | RUN mkdir -p /home/tor/tor && chown -R tor:tor /home/tor/tor && chmod 2700 /home/tor/tor 6 | 7 | ARG VER 8 | ENV VER=$VER 9 | RUN apt update && apt install -qfy tor=${VER} 10 | 11 | COPY ./torrc /home/tor/tor/torrc 12 | 13 | USER tor 14 | -------------------------------------------------------------------------------- /tor/README.md: -------------------------------------------------------------------------------- 1 | # Tor Hidden Service 2 | 3 | The default `torrc` file is copied into the image, so feel free to change before building/using this image. 4 | Feel free to adapt the `build-and-push-to-dockerhub.sh` to push to your own repo/registry. 5 | 6 | ## How to run 7 | 8 | The `torrc` file that's included has some minor modifications from the default torrc file. 9 | -------------------------------------------------------------------------------- /tor/build-and-push-to-dockerhub.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export VER=0.4.7.16-1 4 | 5 | docker buildx build \ 6 | --platform linux/amd64,linux/arm64 \ 7 | --push \ 8 | --no-cache \ 9 | --build-arg VER=${VER} \ 10 | -t blockstream/tor:latest \ 11 | -t blockstream/tor:${VER} . || { echo -e "\nSomething broke"; exit 1; } 12 | -------------------------------------------------------------------------------- /tor/tor.service: -------------------------------------------------------------------------------- 1 | /etc/systemd/system/tor.service 2 | 3 | Description=Tor hidden service 4 | Wants=docker.target 5 | After=docker.service 6 | 7 | [Service] 8 | Restart=always 9 | RestartSec=1 10 | ExecStartPre=/usr/bin/docker pull blockstream/tor:latest 11 | ExecStartPre=-/bin/chown -R 2000:2000 /mnt/data/tor 12 | ExecStartPre=-/bin/chmod -R 2700 /mnt/data/tor 13 | ExecStartPre=/sbin/iptables -A INPUT -m tcp -p tcp --dport 9050 -j ACCEPT 14 | ExecStart=/usr/bin/docker run \ 15 | --network=host \ 16 | --pid=host \ 17 | --name=tor \ 18 | --tmpfs /tmp/ \ 19 | -v /mnt/data/torrc:/home/tor/torrc:ro \ 20 | -v /mnt/data/tor:/home/tor/tor:rw \ 21 | blockstream/tor:latest tor -f /home/tor/torrc 22 | ExecStop=/usr/bin/docker rm -f tor 23 | 24 | [Install] 25 | WantedBy=multi-user.target 26 | -------------------------------------------------------------------------------- /tor/torrc: -------------------------------------------------------------------------------- 1 | DataDirectory /home/tor/tor 2 | PidFile /var/run/tor/tor.pid 3 | 4 | ControlSocket /var/run/tor/control GroupWritable RelaxDirModeCheck 5 | ControlSocketsGroupWritable 1 6 | SocksPort unix:/var/run/tor/socks WorldWritable 7 | SocksPort 9050 8 | #ControlPort 9051 9 | 10 | CookieAuthentication 1 11 | CookieAuthFileGroupReadable 1 12 | CookieAuthFile /var/run/tor/control.authcookie 13 | 14 | Log [handshake]debug [*]notice stderr 15 | 16 | HiddenServiceDir /home/tor/tor/hidden_service_v3/ 17 | HiddenServiceVersion 3 18 | HiddenServicePort 80 127.0.0.1:80 19 | -------------------------------------------------------------------------------- /waterfalls/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:bookworm-slim 2 | 3 | ARG WATERFALLS_VERSION 4 | ENV WATERFALLS_VERSION=$WATERFALLS_VERSION 5 | 6 | RUN apt update 7 | RUN apt install -qfy curl 8 | 9 | RUN curl -Ls https://github.com/LeoComandini/waterfalls/releases/download/${WATERFALLS_VERSION}/waterfalls_${WATERFALLS_VERSION}.gz | gunzip > waterfalls 10 | RUN chmod +x waterfalls 11 | 12 | RUN apt remove -yf curl 13 | RUN apt-get clean && \ 14 | rm -rf /var/lib/apt/lists/* 15 | 16 | ENTRYPOINT ["./waterfalls"] -------------------------------------------------------------------------------- /waterfalls/build-and-push-to-dockerhub.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -ex 3 | 4 | export VER=9640f8a 5 | 6 | docker buildx build \ 7 | --platform linux/amd64,linux/arm64 \ 8 | --push \ 9 | --cache-from blockstream/waterfalls:latest \ 10 | --build-arg WATERFALLS_VERSION=${VER} \ 11 | -t blockstream/waterfalls:$VER \ 12 | -t blockstream/waterfalls:latest . || `echo -e "\nSomething broke" && exit 1` 13 | --------------------------------------------------------------------------------