rerise de lecoffre_node
This commit is contained in:
commit
4f4fec33be
276
README.md
Normal file
276
README.md
Normal file
@ -0,0 +1,276 @@
|
||||
# 4NK Node - Infrastructure Docker
|
||||
|
||||
Infrastructure Docker complète pour le développement et le déploiement de services 4NK
|
||||
|
||||
## 🏗️ Architecture
|
||||
|
||||
4NK Node est composé de plusieurs services orchestrés via Docker Compose :
|
||||
|
||||
- **Tor** : Proxy anonyme pour Bitcoin Core
|
||||
- **Bitcoin Core** : Nœud Bitcoin en mode signet
|
||||
- **Blindbit** : Service de filtres pour les paiements silencieux
|
||||
- **sdk_relay** : Service de relais pour l'intégration avec les applications
|
||||
|
||||
## 🚀 Démarrage rapide
|
||||
|
||||
### Prérequis
|
||||
|
||||
- Docker et Docker Compose installés
|
||||
- Au moins 10 Go d'espace disque disponible
|
||||
- Connexion Internet pour la synchronisation Bitcoin
|
||||
|
||||
### Installation
|
||||
|
||||
```bash
|
||||
# Cloner le repository
|
||||
git clone https://git.4nkweb.com/4nk/4NK_node.git
|
||||
cd 4NK_node
|
||||
|
||||
# Lancer tous les services
|
||||
sudo docker-compose up -d
|
||||
|
||||
# Vérifier le statut des services
|
||||
sudo docker-compose ps
|
||||
```
|
||||
|
||||
### Services disponibles
|
||||
|
||||
| Service | Port | Description |
|
||||
|---------|------|-------------|
|
||||
| Tor | 9050, 9051 | Proxy anonyme |
|
||||
| Bitcoin Core | 18443 (RPC), 29000 (ZMQ) | Nœud Bitcoin signet |
|
||||
| Blindbit | 8000 | Service de filtres |
|
||||
| sdk_relay | 8090, 8091 | Service de relais |
|
||||
|
||||
## 📋 Configuration
|
||||
|
||||
### Bitcoin Core
|
||||
|
||||
Configuration automatique pour le réseau signet avec :
|
||||
|
||||
- RPC activé sur le port 18443
|
||||
- ZMQ activé sur le port 29000
|
||||
- Connexion Tor pour l'anonymat
|
||||
- Synchronisation automatique
|
||||
|
||||
### Blindbit
|
||||
|
||||
Service de filtres pour les paiements silencieux :
|
||||
|
||||
- Version stable (branche master)
|
||||
- Connexion automatique à Bitcoin Core
|
||||
- API REST sur le port 8000
|
||||
|
||||
### sdk_relay
|
||||
|
||||
Service de relais pour l'intégration :
|
||||
|
||||
- Configuration Docker automatique
|
||||
- Authentification par cookie Bitcoin Core
|
||||
- Connexion aux services via réseau Docker
|
||||
|
||||
## 🔧 Scripts utilitaires
|
||||
|
||||
### Tests de connectivité
|
||||
|
||||
```bash
|
||||
# Test complet de tous les services
|
||||
cd sdk_relay
|
||||
./test_final.sh
|
||||
|
||||
# Test de connectivité réseau
|
||||
./test_connectivity.sh
|
||||
|
||||
# Test simple
|
||||
./test_simple.sh
|
||||
```
|
||||
|
||||
### Débogage
|
||||
|
||||
```bash
|
||||
# Débogage du container sdk_relay
|
||||
./debug_container.sh
|
||||
|
||||
# Logs des services
|
||||
sudo docker-compose logs [service_name]
|
||||
```
|
||||
|
||||
## 🌐 Réseau Docker
|
||||
|
||||
Tous les services communiquent via le réseau `4nk_node_btcnet` avec résolution DNS automatique :
|
||||
|
||||
- `bitcoin` : Bitcoin Core
|
||||
- `blindbit` : Service Blindbit
|
||||
- `tor` : Proxy Tor
|
||||
- `sdk_relay` : Service de relais
|
||||
|
||||
## 📊 Monitoring
|
||||
|
||||
### Healthchecks
|
||||
|
||||
Les services incluent des healthchecks automatiques :
|
||||
|
||||
```bash
|
||||
# Vérifier l'état des healthchecks
|
||||
sudo docker-compose ps
|
||||
|
||||
# Logs des healthchecks
|
||||
sudo docker-compose logs | grep health
|
||||
```
|
||||
|
||||
### Logs
|
||||
|
||||
```bash
|
||||
# Logs de tous les services
|
||||
sudo docker-compose logs -f
|
||||
|
||||
# Logs d'un service spécifique
|
||||
sudo docker-compose logs -f bitcoin
|
||||
sudo docker-compose logs -f blindbit
|
||||
sudo docker-compose logs -f sdk_relay
|
||||
```
|
||||
|
||||
## 🔒 Sécurité
|
||||
|
||||
### Authentification
|
||||
|
||||
- Bitcoin Core utilise l'authentification par cookie
|
||||
- Les cookies sont automatiquement copiés dans les containers
|
||||
- Permissions restrictives sur les fichiers sensibles
|
||||
|
||||
### Réseau
|
||||
|
||||
- Isolation via réseau Docker
|
||||
- Communication interne uniquement
|
||||
- Ports exposés limités au minimum nécessaire
|
||||
|
||||
## 🛠️ Développement
|
||||
|
||||
### Ajout d'un nouveau service
|
||||
|
||||
1. Créer le Dockerfile dans un sous-répertoire
|
||||
2. Ajouter le service dans `docker-compose.yml`
|
||||
3. Configurer les dépendances et le réseau
|
||||
4. Ajouter les healthchecks si nécessaire
|
||||
|
||||
### Modification de la configuration
|
||||
|
||||
```bash
|
||||
# Modifier la configuration Bitcoin Core
|
||||
sudo docker-compose down
|
||||
# Éditer bitcoin/bitcoin.conf
|
||||
sudo docker-compose up -d bitcoin
|
||||
|
||||
# Modifier la configuration Blindbit
|
||||
# Éditer blindbit/blindbit.toml
|
||||
sudo docker-compose restart blindbit
|
||||
```
|
||||
|
||||
## 📁 Structure des fichiers
|
||||
|
||||
```
|
||||
lecoffre_node/
|
||||
├── bitcoin/
|
||||
│ ├── Dockerfile
|
||||
│ └── bitcoin.conf
|
||||
├── blindbit/
|
||||
│ ├── Dockerfile
|
||||
│ └── blindbit.toml
|
||||
├── sdk_relay/
|
||||
│ ├── Dockerfile
|
||||
│ ├── .conf.docker
|
||||
│ └── scripts/
|
||||
├── tor/
|
||||
│ ├── Dockerfile
|
||||
│ └── torrc
|
||||
├── docker-compose.yml
|
||||
└── README.md
|
||||
```
|
||||
|
||||
## 🚨 Dépannage
|
||||
|
||||
### Problèmes courants
|
||||
|
||||
1. **Ports déjà utilisés**
|
||||
|
||||
```bash
|
||||
# Vérifier les ports utilisés
|
||||
sudo netstat -tlnp | grep -E "(18443|8000|9050)"
|
||||
|
||||
# Arrêter les services conflictuels
|
||||
sudo docker-compose down
|
||||
```
|
||||
|
||||
2. **Problèmes de synchronisation Bitcoin**
|
||||
|
||||
```bash
|
||||
# Vérifier les logs Bitcoin Core
|
||||
sudo docker-compose logs bitcoin
|
||||
|
||||
# Redémarrer Bitcoin Core
|
||||
sudo docker-compose restart bitcoin
|
||||
```
|
||||
|
||||
3. **Problèmes de connectivité sdk_relay**
|
||||
|
||||
```bash
|
||||
# Tester la connectivité
|
||||
cd sdk_relay
|
||||
./test_final.sh
|
||||
|
||||
# Vérifier la configuration
|
||||
./debug_container.sh
|
||||
```
|
||||
|
||||
### Logs détaillés
|
||||
|
||||
```bash
|
||||
# Logs avec timestamps
|
||||
sudo docker-compose logs -t
|
||||
|
||||
# Logs des 100 dernières lignes
|
||||
sudo docker-compose logs --tail=100
|
||||
|
||||
# Logs depuis une date
|
||||
sudo docker-compose logs --since="2024-01-01T00:00:00"
|
||||
```
|
||||
|
||||
## 📈 Performance
|
||||
|
||||
### Ressources recommandées
|
||||
|
||||
- **CPU** : 2 cœurs minimum, 4 cœurs recommandés
|
||||
- **RAM** : 4 Go minimum, 8 Go recommandés
|
||||
- **Stockage** : 20 Go minimum pour la blockchain signet
|
||||
- **Réseau** : Connexion stable pour la synchronisation
|
||||
|
||||
### Optimisations
|
||||
|
||||
```bash
|
||||
# Limiter l'utilisation CPU
|
||||
sudo docker-compose up -d --scale bitcoin=1
|
||||
|
||||
# Surveiller l'utilisation des ressources
|
||||
sudo docker stats
|
||||
```
|
||||
|
||||
## 🤝 Contribution
|
||||
|
||||
1. Fork le repository
|
||||
2. Créer une branche feature (`git checkout -b feature/nouvelle-fonctionnalite`)
|
||||
3. Commit les changements (`git commit -am 'Ajout de nouvelle fonctionnalité'`)
|
||||
4. Push la branche (`git push origin feature/nouvelle-fonctionnalite`)
|
||||
5. Créer une Pull Request
|
||||
|
||||
## 📄 Licence
|
||||
|
||||
Ce projet est sous licence MIT. Voir le fichier LICENSE pour plus de détails.
|
||||
|
||||
## 🆘 Support
|
||||
|
||||
Pour obtenir de l'aide :
|
||||
|
||||
1. Consulter la documentation
|
||||
2. Vérifier les issues existantes
|
||||
3. Créer une nouvelle issue avec les détails du problème
|
||||
4. Inclure les logs et la configuration utilisée
|
55
bitcoin/Dockerfile
Normal file
55
bitcoin/Dockerfile
Normal file
@ -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"]
|
||||
|
42
bitcoin/bitcoin.conf
Normal file
42
bitcoin/bitcoin.conf
Normal file
@ -0,0 +1,42 @@
|
||||
# Configuration globale
|
||||
datadir=/home/bitcoin/.bitcoin
|
||||
server=1
|
||||
txindex=1
|
||||
debug=1
|
||||
loglevel=debug
|
||||
logthreadnames=1
|
||||
signet=1
|
||||
onion=tor:9050
|
||||
listenonion=1
|
||||
proxy=tor:9050
|
||||
|
||||
# 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
|
||||
rpcbind=0.0.0.0
|
||||
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
|
31
blindbit/Dockerfile
Normal file
31
blindbit/Dockerfile
Normal file
@ -0,0 +1,31 @@
|
||||
# blindbit-oracle/Dockerfile
|
||||
FROM golang:1.24 as builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Cloner le repo blindbit-oracle (version stable)
|
||||
RUN git clone --branch master --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"]
|
28
blindbit/blindbit.toml
Normal file
28
blindbit/blindbit.toml
Normal file
@ -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
|
114
docker-compose.yml
Normal file
114
docker-compose.yml
Normal file
@ -0,0 +1,114 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
tor:
|
||||
image: dperson/torproxy:latest
|
||||
container_name: tor-proxy
|
||||
networks:
|
||||
btcnet:
|
||||
aliases:
|
||||
- tor
|
||||
ports:
|
||||
- "9050:9050" # Port SOCKS
|
||||
- "9051:9051" # Port de contrôle
|
||||
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
|
||||
environment:
|
||||
- TOR_HOST=tor
|
||||
- TOR_PORT=9050
|
||||
restart: unless-stopped
|
||||
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
|
||||
volumes:
|
||||
- blindbit_data:/data
|
||||
- ./blindbit/blindbit.toml:/data/blindbit.toml
|
||||
- bitcoin_data:/home/bitcoin/.bitcoin
|
||||
ports:
|
||||
- "8000:8000"
|
||||
networks:
|
||||
btcnet:
|
||||
aliases:
|
||||
- blindbit
|
||||
restart: unless-stopped
|
||||
|
||||
sdk_relay:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: lecoffre_node/sdk_relay/Dockerfile
|
||||
container_name: sdk_relay
|
||||
depends_on:
|
||||
bitcoin:
|
||||
condition: service_healthy
|
||||
blindbit:
|
||||
condition: service_started
|
||||
volumes:
|
||||
- bitcoin_data:/home/bitcoin/.bitcoin
|
||||
- ./bitcoin/bitcoin.conf:/home/bitcoin/.bitcoin/bitcoin.conf
|
||||
- sdk_relay_data:/home/bitcoin/.4nk
|
||||
- ./sdk_relay/.conf.docker:/home/bitcoin/.conf.docker
|
||||
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 "
|
||||
cp /home/bitcoin/.conf.docker /home/bitcoin/.conf &&
|
||||
cp /home/bitcoin/.bitcoin/signet/.cookie /home/bitcoin/.4nk/bitcoin.cookie &&
|
||||
chmod 600 /home/bitcoin/.4nk/bitcoin.cookie &&
|
||||
/usr/local/bin/sdk_relay --config .conf"
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8091/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
|
||||
volumes:
|
||||
bitcoin_data:
|
||||
name: 4nk_node_bitcoin_data
|
||||
blindbit_data:
|
||||
name: 4nk_node_blindbit_data
|
||||
sdk_relay_data:
|
||||
name: 4nk_node_sdk_relay_data
|
||||
|
||||
networks:
|
||||
btcnet:
|
||||
name: 4nk_node_btcnet
|
||||
driver: bridge
|
16
sdk_relay/.conf.docker
Normal file
16
sdk_relay/.conf.docker
Normal file
@ -0,0 +1,16 @@
|
||||
# Configuration sdk_relay pour Docker
|
||||
# Services connectés via réseau Docker
|
||||
|
||||
# Bitcoin Core RPC (utilise le nom d'hôte Docker et le cookie)
|
||||
core_url=http://bitcoin:18443
|
||||
core_wallet=relay_wallet
|
||||
ws_url=127.0.0.1:8080
|
||||
wallet_name=relay_wallet.json
|
||||
network=signet
|
||||
blindbit_url=http://blindbit:8000
|
||||
zmq_url=tcp://bitcoin:29000
|
||||
data_dir=.4nk
|
||||
|
||||
# Mode développement
|
||||
dev_mode=true
|
||||
standalone=false
|
50
sdk_relay/Dockerfile
Normal file
50
sdk_relay/Dockerfile
Normal file
@ -0,0 +1,50 @@
|
||||
# sdk_relay Dockerfile
|
||||
FROM rust:1.89 as builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copier les sources
|
||||
COPY sdk_relay/ /app/sdk_relay/
|
||||
COPY sdk_common/ /app/sdk_common/
|
||||
|
||||
# Compiler sdk_relay
|
||||
WORKDIR /app/sdk_relay
|
||||
RUN sed -i 's|path = "../sdk_common"|path = "/app/sdk_common"|' Cargo.toml && \
|
||||
cargo build --release
|
||||
|
||||
# Image finale
|
||||
FROM debian:bookworm-slim
|
||||
|
||||
# Installation des dépendances
|
||||
RUN apt-get update && apt-get install -y \
|
||||
ca-certificates \
|
||||
curl \
|
||||
strace \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copier le binaire
|
||||
COPY --from=builder /app/sdk_relay/target/release/sdk_relay /usr/local/bin/sdk_relay
|
||||
|
||||
# Créer l'utilisateur bitcoin
|
||||
RUN groupadd -g 1000 bitcoin && \
|
||||
useradd -m -d /home/bitcoin -g bitcoin bitcoin
|
||||
|
||||
# Répertoire de travail
|
||||
WORKDIR /home/bitcoin
|
||||
|
||||
# Créer le répertoire de données
|
||||
RUN mkdir -p /home/bitcoin/.4nk
|
||||
|
||||
# Copier la configuration
|
||||
COPY sdk_relay/.conf /home/bitcoin/.conf
|
||||
|
||||
# Changer les permissions
|
||||
RUN chown -R bitcoin:bitcoin /home/bitcoin
|
||||
|
||||
USER bitcoin
|
||||
|
||||
# Exposer les ports
|
||||
EXPOSE 8090 8091
|
||||
|
||||
# Point d'entrée par défaut (peut être surchargé)
|
||||
CMD ["/bin/bash"]
|
57
sdk_relay/debug_container.sh
Executable file
57
sdk_relay/debug_container.sh
Executable file
@ -0,0 +1,57 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Script de débogage pour le container sdk_relay
|
||||
set -e
|
||||
|
||||
echo "🔍 Débogage du container sdk_relay..."
|
||||
echo ""
|
||||
|
||||
# Test 1: Vérifier que le container sdk_relay est connecté au réseau
|
||||
echo "📡 Test 1: Réseau du container sdk_relay"
|
||||
if sudo docker inspect sdk_relay | grep -q "4nk_node_btcnet"; then
|
||||
echo "✅ Container connecté au réseau 4nk_node_btcnet"
|
||||
else
|
||||
echo "❌ Container non connecté au réseau 4nk_node_btcnet"
|
||||
fi
|
||||
|
||||
# Test 2: Vérifier la configuration dans le container
|
||||
echo ""
|
||||
echo "📡 Test 2: Configuration dans le container"
|
||||
echo "Configuration .conf:"
|
||||
sudo docker exec sdk_relay cat /home/bitcoin/.conf 2>/dev/null || echo "❌ Impossible de lire .conf"
|
||||
|
||||
echo ""
|
||||
echo "Configuration .conf.docker:"
|
||||
sudo docker exec sdk_relay cat /home/bitcoin/.conf.docker 2>/dev/null || echo "❌ Impossible de lire .conf.docker"
|
||||
|
||||
# Test 3: Vérifier la résolution DNS depuis sdk_relay
|
||||
echo ""
|
||||
echo "📡 Test 3: Résolution DNS depuis sdk_relay"
|
||||
echo "Résolution 'bitcoin':"
|
||||
sudo docker exec sdk_relay getent hosts bitcoin 2>/dev/null || echo "❌ Impossible de résoudre 'bitcoin'"
|
||||
|
||||
echo "Résolution 'blindbit':"
|
||||
sudo docker exec sdk_relay getent hosts blindbit 2>/dev/null || echo "❌ Impossible de résoudre 'blindbit'"
|
||||
|
||||
# Test 4: Vérifier la connectivité depuis sdk_relay
|
||||
echo ""
|
||||
echo "📡 Test 4: Connectivité depuis sdk_relay"
|
||||
echo "Test Bitcoin Core (port 18443):"
|
||||
sudo docker exec sdk_relay sh -c "nc -z bitcoin 18443" 2>/dev/null && echo "✅ Bitcoin Core accessible" || echo "❌ Bitcoin Core inaccessible"
|
||||
|
||||
echo "Test Blindbit (port 8000):"
|
||||
sudo docker exec sdk_relay sh -c "nc -z blindbit 8000" 2>/dev/null && echo "✅ Blindbit accessible" || echo "❌ Blindbit inaccessible"
|
||||
|
||||
# Test 5: Vérifier les variables d'environnement
|
||||
echo ""
|
||||
echo "📡 Test 5: Variables d'environnement"
|
||||
sudo docker exec sdk_relay env | grep -E "(RUST_LOG|HOME|BITCOIN)" || echo "❌ Variables d'environnement non trouvées"
|
||||
|
||||
# Test 6: Vérifier le répertoire de travail
|
||||
echo ""
|
||||
echo "📡 Test 6: Répertoire de travail"
|
||||
sudo docker exec sdk_relay pwd
|
||||
sudo docker exec sdk_relay ls -la /home/bitcoin/
|
||||
|
||||
echo ""
|
||||
echo "🎯 Résumé du débogage terminé"
|
49
sdk_relay/test_connectivity.sh
Executable file
49
sdk_relay/test_connectivity.sh
Executable file
@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Script de test de connectivité pour sdk_relay
|
||||
set -e
|
||||
|
||||
echo "🔍 Test de connectivité pour sdk_relay..."
|
||||
echo ""
|
||||
|
||||
# Test 1: Vérifier que le container sdk_relay peut résoudre les noms d'hôtes
|
||||
echo "📡 Test 1: Résolution DNS depuis sdk_relay"
|
||||
if sudo docker run --rm --network 4nk_node_btcnet --name test_sdk_relay lecoffre_node_sdk_relay getent hosts bitcoin 2>/dev/null | grep -q "bitcoin"; then
|
||||
echo "✅ Résolution DNS 'bitcoin' OK"
|
||||
else
|
||||
echo "❌ Résolution DNS 'bitcoin' échoue"
|
||||
fi
|
||||
|
||||
if sudo docker run --rm --network 4nk_node_btcnet --name test_sdk_relay lecoffre_node_sdk_relay getent hosts blindbit 2>/dev/null | grep -q "blindbit"; then
|
||||
echo "✅ Résolution DNS 'blindbit' OK"
|
||||
else
|
||||
echo "❌ Résolution DNS 'blindbit' échoue"
|
||||
fi
|
||||
|
||||
# Test 2: Vérifier la connectivité depuis sdk_relay
|
||||
echo ""
|
||||
echo "📡 Test 2: Connectivité depuis sdk_relay"
|
||||
if sudo docker run --rm --network 4nk_node_btcnet --name test_sdk_relay lecoffre_node_sdk_relay sh -c "nc -z bitcoin 18443" 2>/dev/null; then
|
||||
echo "✅ Bitcoin Core accessible depuis sdk_relay"
|
||||
else
|
||||
echo "❌ Bitcoin Core inaccessible depuis sdk_relay"
|
||||
fi
|
||||
|
||||
if sudo docker run --rm --network 4nk_node_btcnet --name test_sdk_relay lecoffre_node_sdk_relay sh -c "nc -z blindbit 8000" 2>/dev/null; then
|
||||
echo "✅ Blindbit accessible depuis sdk_relay"
|
||||
else
|
||||
echo "❌ Blindbit inaccessible depuis sdk_relay"
|
||||
fi
|
||||
|
||||
# Test 3: Vérifier la configuration dans le container sdk_relay
|
||||
echo ""
|
||||
echo "📡 Test 3: Configuration dans sdk_relay"
|
||||
echo "Configuration .conf.docker:"
|
||||
sudo docker run --rm --network 4nk_node_btcnet --name test_sdk_relay lecoffre_node_sdk_relay cat /home/bitcoin/.conf.docker 2>/dev/null || echo "❌ Impossible de lire .conf.docker"
|
||||
|
||||
echo ""
|
||||
echo "🎯 Résumé:"
|
||||
echo " - DNS bitcoin: $(if sudo docker run --rm --network 4nk_node_btcnet --name test_sdk_relay lecoffre_node_sdk_relay getent hosts bitcoin 2>/dev/null | grep -q "bitcoin"; then echo "✅"; else echo "❌"; fi)"
|
||||
echo " - DNS blindbit: $(if sudo docker run --rm --network 4nk_node_btcnet --name test_sdk_relay lecoffre_node_sdk_relay getent hosts blindbit 2>/dev/null | grep -q "blindbit"; then echo "✅"; else echo "❌"; fi)"
|
||||
echo " - Connectivité Bitcoin: $(if sudo docker run --rm --network 4nk_node_btcnet --name test_sdk_relay lecoffre_node_sdk_relay sh -c "nc -z bitcoin 18443" 2>/dev/null; then echo "✅"; else echo "❌"; fi)"
|
||||
echo " - Connectivité Blindbit: $(if sudo docker run --rm --network 4nk_node_btcnet --name test_sdk_relay lecoffre_node_sdk_relay sh -c "nc -z blindbit 8000" 2>/dev/null; then echo "✅"; else echo "❌"; fi)"
|
56
sdk_relay/test_docker.sh
Executable file
56
sdk_relay/test_docker.sh
Executable file
@ -0,0 +1,56 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Script de test pour vérifier la configuration Docker
|
||||
set -e
|
||||
|
||||
echo "🔍 Test de la configuration Docker..."
|
||||
echo ""
|
||||
|
||||
# Test 1: Vérifier que le fichier de configuration Docker existe
|
||||
echo "📡 Test 1: Fichier de configuration Docker"
|
||||
if [ -f ".conf.docker" ]; then
|
||||
echo "✅ Fichier .conf.docker présent"
|
||||
echo "📄 Contenu:"
|
||||
cat .conf.docker
|
||||
else
|
||||
echo "❌ Fichier .conf.docker manquant"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test 2: Vérifier la résolution DNS dans le réseau Docker
|
||||
echo ""
|
||||
echo "📡 Test 2: Résolution DNS Docker"
|
||||
if sudo docker exec bitcoin-signet getent hosts bitcoin 2>/dev/null | grep -q "bitcoin"; then
|
||||
echo "✅ Résolution DNS 'bitcoin' OK"
|
||||
else
|
||||
echo "❌ Résolution DNS 'bitcoin' échoue"
|
||||
fi
|
||||
|
||||
if sudo docker exec bitcoin-signet getent hosts blindbit 2>/dev/null | grep -q "blindbit"; then
|
||||
echo "✅ Résolution DNS 'blindbit' OK"
|
||||
else
|
||||
echo "❌ Résolution DNS 'blindbit' échoue"
|
||||
fi
|
||||
|
||||
# Test 3: Vérifier la connectivité réseau
|
||||
echo ""
|
||||
echo "📡 Test 3: Connectivité réseau"
|
||||
if sudo docker exec bitcoin-signet sh -c "nc -z bitcoin 18443" 2>/dev/null; then
|
||||
echo "✅ Bitcoin Core accessible depuis le réseau Docker"
|
||||
else
|
||||
echo "❌ Bitcoin Core inaccessible depuis le réseau Docker"
|
||||
fi
|
||||
|
||||
if sudo docker exec bitcoin-signet sh -c "nc -z blindbit 8000" 2>/dev/null; then
|
||||
echo "✅ Blindbit accessible depuis le réseau Docker"
|
||||
else
|
||||
echo "❌ Blindbit inaccessible depuis le réseau Docker"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "🎯 Résumé:"
|
||||
echo " - Configuration Docker: $(if [ -f ".conf.docker" ]; then echo "✅"; else echo "❌"; fi)"
|
||||
echo " - DNS bitcoin: $(if sudo docker exec bitcoin-signet getent hosts bitcoin 2>/dev/null | grep -q "bitcoin"; then echo "✅"; else echo "❌"; fi)"
|
||||
echo " - DNS blindbit: $(if sudo docker exec bitcoin-signet getent hosts blindbit 2>/dev/null | grep -q "blindbit"; then echo "✅"; else echo "❌"; fi)"
|
||||
echo " - Connectivité Bitcoin: $(if sudo docker exec bitcoin-signet sh -c "nc -z bitcoin 18443" 2>/dev/null; then echo "✅"; else echo "❌"; fi)"
|
||||
echo " - Connectivité Blindbit: $(if sudo docker exec bitcoin-signet sh -c "nc -z blindbit 8000" 2>/dev/null; then echo "✅"; else echo "❌"; fi)"
|
69
sdk_relay/test_final.sh
Executable file
69
sdk_relay/test_final.sh
Executable file
@ -0,0 +1,69 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Script de test final pour sdk_relay
|
||||
set -e
|
||||
|
||||
echo "🔍 Test final de sdk_relay..."
|
||||
echo ""
|
||||
|
||||
# Test 1: Vérifier que tous les services sont prêts
|
||||
echo "📡 Test 1: Services prêts"
|
||||
if sudo docker-compose ps | grep -q "bitcoin-signet.*Up"; then
|
||||
echo "✅ Bitcoin Core en cours d'exécution"
|
||||
else
|
||||
echo "❌ Bitcoin Core non démarré"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if sudo docker-compose ps | grep -q "blindbit-oracle.*Up"; then
|
||||
echo "✅ Blindbit en cours d'exécution"
|
||||
else
|
||||
echo "❌ Blindbit non démarré"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test 2: Vérifier la résolution DNS depuis sdk_relay
|
||||
echo ""
|
||||
echo "📡 Test 2: Résolution DNS depuis sdk_relay"
|
||||
if sudo docker run --rm --network 4nk_node_btcnet lecoffre_node_sdk_relay getent hosts bitcoin 2>/dev/null | grep -q "bitcoin"; then
|
||||
echo "✅ Résolution DNS 'bitcoin' OK"
|
||||
else
|
||||
echo "❌ Résolution DNS 'bitcoin' échoue"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if sudo docker run --rm --network 4nk_node_btcnet lecoffre_node_sdk_relay getent hosts blindbit 2>/dev/null | grep -q "blindbit"; then
|
||||
echo "✅ Résolution DNS 'blindbit' OK"
|
||||
else
|
||||
echo "❌ Résolution DNS 'blindbit' échoue"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test 3: Vérifier la connectivité depuis sdk_relay
|
||||
echo ""
|
||||
echo "📡 Test 3: Connectivité depuis sdk_relay"
|
||||
if sudo docker run --rm --network 4nk_node_btcnet lecoffre_node_sdk_relay sh -c "curl -s -f http://bitcoin:18443 >/dev/null" 2>/dev/null; then
|
||||
echo "✅ Bitcoin Core accessible depuis sdk_relay"
|
||||
else
|
||||
echo "❌ Bitcoin Core inaccessible depuis sdk_relay"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if sudo docker run --rm --network 4nk_node_btcnet lecoffre_node_sdk_relay sh -c "curl -s -f http://blindbit:8000 >/dev/null" 2>/dev/null; then
|
||||
echo "✅ Blindbit accessible depuis sdk_relay"
|
||||
else
|
||||
echo "❌ Blindbit inaccessible depuis sdk_relay"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test 4: Vérifier la configuration dans le container sdk_relay
|
||||
echo ""
|
||||
echo "📡 Test 4: Configuration dans sdk_relay"
|
||||
echo "Configuration .conf.docker:"
|
||||
sudo docker run --rm --network 4nk_node_btcnet lecoffre_node_sdk_relay cat /home/bitcoin/.conf.docker 2>/dev/null || echo "❌ Impossible de lire .conf.docker"
|
||||
|
||||
echo ""
|
||||
echo "🎯 Tous les tests sont passés ! sdk_relay peut maintenant démarrer."
|
||||
echo ""
|
||||
echo "💡 Pour démarrer sdk_relay:"
|
||||
echo " sudo docker-compose up -d sdk_relay"
|
54
sdk_relay/test_simple.sh
Executable file
54
sdk_relay/test_simple.sh
Executable file
@ -0,0 +1,54 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Script de test simple pour sdk_relay
|
||||
set -e
|
||||
|
||||
echo "🔍 Test simple de sdk_relay..."
|
||||
echo ""
|
||||
|
||||
# Test 1: Vérifier que le fichier de configuration existe
|
||||
echo "📡 Test 1: Fichier de configuration"
|
||||
if [ -f ".conf.docker" ]; then
|
||||
echo "✅ Fichier .conf.docker présent"
|
||||
else
|
||||
echo "❌ Fichier .conf.docker manquant"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test 2: Vérifier la résolution DNS depuis le réseau Docker
|
||||
echo ""
|
||||
echo "📡 Test 2: Résolution DNS depuis le réseau Docker"
|
||||
if sudo docker run --rm --network 4nk_node_btcnet debian:bookworm-slim getent hosts bitcoin 2>/dev/null | grep -q "bitcoin"; then
|
||||
echo "✅ Résolution DNS 'bitcoin' OK"
|
||||
else
|
||||
echo "❌ Résolution DNS 'bitcoin' échoue"
|
||||
fi
|
||||
|
||||
if sudo docker run --rm --network 4nk_node_btcnet debian:bookworm-slim getent hosts blindbit 2>/dev/null | grep -q "blindbit"; then
|
||||
echo "✅ Résolution DNS 'blindbit' OK"
|
||||
else
|
||||
echo "❌ Résolution DNS 'blindbit' échoue"
|
||||
fi
|
||||
|
||||
# Test 3: Vérifier la connectivité depuis le réseau Docker
|
||||
echo ""
|
||||
echo "📡 Test 3: Connectivité depuis le réseau Docker"
|
||||
if sudo docker run --rm --network 4nk_node_btcnet debian:bookworm-slim sh -c "nc -z bitcoin 18443" 2>/dev/null; then
|
||||
echo "✅ Bitcoin Core accessible depuis le réseau Docker"
|
||||
else
|
||||
echo "❌ Bitcoin Core inaccessible depuis le réseau Docker"
|
||||
fi
|
||||
|
||||
if sudo docker run --rm --network 4nk_node_btcnet debian:bookworm-slim sh -c "nc -z blindbit 8000" 2>/dev/null; then
|
||||
echo "✅ Blindbit accessible depuis le réseau Docker"
|
||||
else
|
||||
echo "❌ Blindbit inaccessible depuis le réseau Docker"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "🎯 Résumé:"
|
||||
echo " - Configuration: $(if [ -f ".conf.docker" ]; then echo "✅"; else echo "❌"; fi)"
|
||||
echo " - DNS bitcoin: $(if sudo docker run --rm --network 4nk_node_btcnet debian:bookworm-slim getent hosts bitcoin 2>/dev/null | grep -q "bitcoin"; then echo "✅"; else echo "❌"; fi)"
|
||||
echo " - DNS blindbit: $(if sudo docker run --rm --network 4nk_node_btcnet debian:bookworm-slim getent hosts blindbit 2>/dev/null | grep -q "blindbit"; then echo "✅"; else echo "❌"; fi)"
|
||||
echo " - Connectivité Bitcoin: $(if sudo docker run --rm --network 4nk_node_btcnet debian:bookworm-slim sh -c "nc -z bitcoin 18443" 2>/dev/null; then echo "✅"; else echo "❌"; fi)"
|
||||
echo " - Connectivité Blindbit: $(if sudo docker run --rm --network 4nk_node_btcnet debian:bookworm-slim sh -c "nc -z blindbit 8000" 2>/dev/null; then echo "✅"; else echo "❌"; fi)"
|
18
tor/Dockerfile
Normal file
18
tor/Dockerfile
Normal file
@ -0,0 +1,18 @@
|
||||
# Tor proxy pour Bitcoin Core
|
||||
FROM dperson/torproxy:latest
|
||||
|
||||
# Exposer les ports Tor
|
||||
EXPOSE 9050 9051
|
||||
|
||||
# Configuration Tor pour Bitcoin Core
|
||||
ENV TOR_SERVICE_DIR=/var/lib/tor
|
||||
ENV TOR_CONFIG_FILE=/etc/tor/torrc
|
||||
|
||||
# Créer le répertoire de configuration
|
||||
RUN mkdir -p /etc/tor
|
||||
|
||||
# Configuration Tor de base
|
||||
COPY torrc /etc/tor/torrc
|
||||
|
||||
# Point d'entrée personnalisé
|
||||
ENTRYPOINT ["/usr/sbin/tor", "-f", "/etc/tor/torrc"]
|
20
tor/torrc
Normal file
20
tor/torrc
Normal file
@ -0,0 +1,20 @@
|
||||
# Configuration Tor pour Bitcoin Core
|
||||
# Port SOCKS
|
||||
SocksPort 9050
|
||||
SocksListenAddress 0.0.0.0
|
||||
|
||||
# Port de contrôle (optionnel)
|
||||
ControlPort 9051
|
||||
ControlListenAddress 0.0.0.0
|
||||
|
||||
# Répertoire de données
|
||||
DataDirectory /var/lib/tor
|
||||
|
||||
# Logs
|
||||
Log notice stdout
|
||||
|
||||
# Autoriser les connexions depuis Bitcoin Core
|
||||
SocksPolicy accept 0.0.0.0/0
|
||||
|
||||
# Configuration pour Bitcoin Core
|
||||
AutomapHostsOnResolve 1
|
Loading…
x
Reference in New Issue
Block a user