From 8e2be34d0d4366adc01f8c1a395e8a46239c5987 Mon Sep 17 00:00:00 2001 From: Sosthene Date: Mon, 30 Jun 2025 16:26:37 +0200 Subject: [PATCH] init commit --- bitcoin/Dockerfile | 55 ++++++++++++++++++ bitcoin/bitcoin.conf | 40 +++++++++++++ blindbit/Dockerfile | 31 ++++++++++ blindbit/blindbit.toml | 28 +++++++++ docker-compose.yml | 127 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 281 insertions(+) create mode 100644 bitcoin/Dockerfile create mode 100644 bitcoin/bitcoin.conf create mode 100644 blindbit/Dockerfile create mode 100644 blindbit/blindbit.toml create mode 100644 docker-compose.yml diff --git a/bitcoin/Dockerfile b/bitcoin/Dockerfile new file mode 100644 index 0000000..0d40955 --- /dev/null +++ b/bitcoin/Dockerfile @@ -0,0 +1,55 @@ +# bitcoin/Dockerfile +FROM debian:bullseye-slim as builder + +# Installation des dépendances +RUN apt-get update && apt-get install -y \ + curl \ + gnupg \ + && rm -rf /var/lib/apt/lists/* + +# Version de Bitcoin Core +ENV VERSION=24.1 + +# Téléchargement et vérification de Bitcoin Core +WORKDIR /tmp +RUN curl -O https://bitcoincore.org/bin/bitcoin-core-${VERSION}/bitcoin-${VERSION}-x86_64-linux-gnu.tar.gz && \ + curl -O https://bitcoincore.org/bin/bitcoin-core-${VERSION}/SHA256SUMS.asc && \ + curl -O https://bitcoincore.org/bin/bitcoin-core-${VERSION}/SHA256SUMS + +# Extraction de Bitcoin Core +RUN tar -xzf bitcoin-${VERSION}-x86_64-linux-gnu.tar.gz + +# Image finale +FROM debian:bullseye-slim + +# On redéfinit la version dans l'image finale +ENV VERSION=24.1 + +# Installation des dépendances nécessaires +RUN apt-get update && apt-get install -y \ + libatomic1 \ + && rm -rf /var/lib/apt/lists/* + +# Créer l'utilisateur et le groupe bitcoin +RUN groupadd -g 1000 bitcoin && \ + useradd -m -d /home/bitcoin -g bitcoin bitcoin + +# Copie des binaires depuis le builder +COPY --from=builder /tmp/bitcoin-${VERSION}/bin/bitcoind /usr/local/bin/ +COPY --from=builder /tmp/bitcoin-${VERSION}/bin/bitcoin-cli /usr/local/bin/ + +# Configuration +RUN mkdir -p /home/bitcoin/.bitcoin/wallets /home/bitcoin/.bitcoin/signet && \ + chown -R bitcoin:bitcoin /home/bitcoin/.bitcoin +COPY bitcoin.conf /home/bitcoin/.bitcoin/bitcoin.conf +RUN chown bitcoin:bitcoin /home/bitcoin/.bitcoin/bitcoin.conf + +VOLUME ["/home/bitcoin/.bitcoin"] + +# Exposition des ports (signet) +EXPOSE 38332 38333 29000 18443 + +USER bitcoin +WORKDIR /home/bitcoin +ENTRYPOINT ["bitcoind", "-conf=/home/bitcoin/.bitcoin/bitcoin.conf", "-signet", "-printtoconsole"] + diff --git a/bitcoin/bitcoin.conf b/bitcoin/bitcoin.conf new file mode 100644 index 0000000..319d44e --- /dev/null +++ b/bitcoin/bitcoin.conf @@ -0,0 +1,40 @@ +# Configuration globale +datadir=/home/bitcoin/.bitcoin +server=1 +txindex=1 +debug=1 +loglevel=debug +logthreadnames=1 +signet=1 +onion=tor:9050 +listenonion=1 + +# Paramètres RPC +rpcauth=bitcoin:c8ea921c7357bd6a5a8a7c43a12350a7$955e25b17672987b17c5a12f12cd8b9c1d38f0f86201c8cd47fc431f2e1c7956 +rpcallowip=0.0.0.0/0 +rpcworkqueue=32 +rpcthreads=4 +rpcdoccheck=1 + +# Paramètres ZMQ +zmqpubhashblock=tcp://0.0.0.0:29000 +zmqpubrawtx=tcp://0.0.0.0:29000 + +[signet] +listen=1 +bind=0.0.0.0:38333 +rpcbind=0.0.0.0:18443 +rpcport=18443 +fallbackfee=0.0001 +blockfilterindex=1 +datacarriersize=205 +acceptnonstdtxn=1 +dustrelayfee=0.00000001 +minrelaytxfee=0.00000001 +prune=0 +signetchallenge=0020341c43803863c252df326e73574a27d7e19322992061017b0dc893e2eab90821 +walletdir=/home/bitcoin/.bitcoin/wallets +wallet=mining +wallet=watchonly +maxtxfee=1 +addnode=tlv2yqamflv22vfdzy2hha2nwmt6zrwrhjjzz4lx7qyq7lyc6wfhabyd.onion \ No newline at end of file diff --git a/blindbit/Dockerfile b/blindbit/Dockerfile new file mode 100644 index 0000000..020deb0 --- /dev/null +++ b/blindbit/Dockerfile @@ -0,0 +1,31 @@ +# blindbit-oracle/Dockerfile +FROM golang:1.22 as builder + +WORKDIR /app + +# Cloner le repo blindbit-oracle +RUN git clone --branch dev --depth 1 https://github.com/setavenger/blindbit-oracle.git . + +# Compiler le binaire +RUN go build -o /go/bin/blindbit-oracle ./src + +# Utiliser debian:bookworm-slim qui contient GLIBC 2.34 +FROM debian:bookworm-slim + +# Installation des dépendances nécessaires +RUN apt-get update && apt-get install -y ca-certificates curl && rm -rf /var/lib/apt/lists/* + +# Copier le binaire depuis le builder +COPY --from=builder /go/bin/blindbit-oracle /usr/local/bin/blindbit-oracle + +# Créer le répertoire de données +RUN mkdir -p /data + +# Créer le volume pour les données +VOLUME ["/data"] + +# Exposer le port par défaut +EXPOSE 8000 + +# Démarrer blindbit-oracle avec le répertoire de données spécifié +ENTRYPOINT ["blindbit-oracle", "-datadir", "/data"] \ No newline at end of file diff --git a/blindbit/blindbit.toml b/blindbit/blindbit.toml new file mode 100644 index 0000000..b35ecb0 --- /dev/null +++ b/blindbit/blindbit.toml @@ -0,0 +1,28 @@ +# Configuration pour blindbit-oracle +host = "0.0.0.0:8000" + +# Définit la chaîne sur laquelle le wallet fonctionne +chain = "signet" + +# Point d'accès RPC Bitcoin +rpc_endpoint = "http://bitcoin:18443" + +# Chemin vers le fichier cookie RPC Bitcoin +cookie_path = "/home/bitcoin/.bitcoin/signet/.cookie" + +# Identifiants RPC Bitcoin (non utilisés avec cookie_path) +rpc_user = "" +rpc_pass = "" + +# Hauteur de départ pour la synchronisation +sync_start_height = 1 + +# Paramètres de performance +max_parallel_tweak_computations = 4 +max_parallel_requests = 4 + +# Configuration des index +tweaks_only = 0 +tweaks_full_basic = 1 +tweaks_full_with_dust_filter = 1 +tweaks_cut_through_with_dust_filter = 1 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..cfea315 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,127 @@ +version: "3.8" + +services: + tor: + image: dperson/torproxy + container_name: tor-proxy + networks: + btcnet: + aliases: + - tor + ports: + - "9052:9050" # Port SOCKS (9052 sur l'hôte, 9050 dans le conteneur) + restart: unless-stopped + + bitcoin: + build: ./bitcoin + container_name: bitcoin-signet + depends_on: + - tor + volumes: + - bitcoin_data:/home/bitcoin/.bitcoin + - ./bitcoin/bitcoin.conf:/home/bitcoin/.bitcoin/bitcoin.conf + ports: + - "38333:38333" # signet p2p + - "18443:18443" # signet rpc + - "29000:29000" # zmq + networks: + btcnet: + aliases: + - bitcoin + entrypoint: > + /bin/sh -c " + mkdir -p /home/bitcoin/.bitcoin/wallets && + bitcoind -conf=/home/bitcoin/.bitcoin/bitcoin.conf -signet -printtoconsole" + healthcheck: + test: ["CMD", "bitcoin-cli", "-conf=/home/bitcoin/.bitcoin/bitcoin.conf", "getblockchaininfo"] + interval: 30s + timeout: 10s + retries: 3 + + blindbit: + build: ./blindbit + container_name: blindbit-oracle + depends_on: + bitcoin: + condition: service_healthy + volumes: + - blindbit_data:/data + - ./blindbit/blindbit.toml:/data/blindbit.toml + - bitcoin_data:/home/bitcoin/.bitcoin + ports: + - "8000:8000" + networks: + btcnet: + aliases: + - blindbit + + sdk_relay: + build: + context: . + dockerfile: sdk_relay/Dockerfile + container_name: sdk_relay + depends_on: + - blindbit + volumes: + - bitcoin_data:/home/bitcoin/.bitcoin + - ./bitcoin/bitcoin.conf:/home/bitcoin/.bitcoin/bitcoin.conf + - sdk_relay_data:/home/bitcoin/.4nk + ports: + - "8090:8090" + - "8091:8091" + networks: + btcnet: + aliases: + - sdk_relay + logging: + driver: "json-file" + options: + max-size: "10m" + max-file: "3" + environment: + - RUST_LOG=debug,bitcoincore_rpc=trace + - HOME=/home/bitcoin + - BITCOIN_COOKIE_PATH=/home/bitcoin/.bitcoin/signet/.cookie + restart: on-failure:3 + entrypoint: > + /bin/sh -c " + mkdir -p /home/bitcoin/.4nk && + strace -f -e trace=file /usr/local/bin/sdk_relay --config .conf" + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8091/health"] + interval: 30s + timeout: 10s + retries: 3 + + lecoffre-back: + image: git.4nkweb.com/4nk/lecoffre-back-mini:latest + container_name: lecoffre-back + networks: + btcnet: + aliases: + - lecoffre-back + labels: + - "com.centurylinklabs.watchtower.enable=true" + + watchtower: + image: containrrr/watchtower + container_name: watchtower + volumes: + - /var/run/docker.sock:/var/run/docker.sock + command: --interval 30 --label-enable + networks: + - btcnet + +volumes: + bitcoin_data: + name: 4nk_node_bitcoin_data + blindbit_data: + sdk_relay_data: + +networks: + btcnet: + name: 4nk_node_btcnet + driver: bridge + ipam: + config: + - subnet: 172.20.0.0/16