# Architecture des Flux et Services - LeCoffre Node ## Tableau des Services - IP/Domaines et Ports ### 🏠 **Services Locaux (Docker Compose)** | Service | Container | Port Local | Port Interne | Protocole | URL d'accĂšs | |---------|-----------|------------|--------------|-----------|-------------| | **tor** | tor-proxy | - | 9050 | TCP | RĂ©seau interne uniquement | | **bitcoin** | bitcoin-signet | - | 38332 (RPC)
38333 (P2P)
29000 (ZMQ hash)
29001 (ZMQ rawtx) | TCP | Réseau interne uniquement | | **blindbit** | blindbit-oracle | 0.0.0.0:8000 | 8000 | HTTP | http://0.0.0.0:8000 | | **sdk_relay** | sdk_relay | 0.0.0.0:8090
0.0.0.0:8091 | 8090 (WS)
8091 (HTTP) | WebSocket/HTTP | ws://0.0.0.0:8090
http://0.0.0.0:8091 | | **lecoffre-back** | lecoffre-back | 0.0.0.0:8080 | 8080 | HTTP | http://0.0.0.0:8080 | | **lecoffre-front** | lecoffre-front | 127.0.0.2:3004 | 3000 | HTTP | http://127.0.0.2:3004 | | **ihm_client** | ihm_client | 0.0.0.0:3003 | 3003 | HTTP | http://0.0.0.0:3003 | | **sdk_signer** | sdk_signer | 0.0.0.0:3001 | 3001 | HTTP/WebSocket | http://0.0.0.0:3001 | | **sdk_storage** | sdk_storage | 0.0.0.0:8081 | 8080 | HTTP | http://0.0.0.0:8081 | ### 🌐 **Services Externes** | Service | Domaine | Port | Protocole | URL d'accĂšs | Statut | |---------|---------|------|-----------|-------------|--------| | **Bootstrap Relay** | dev3.4nkweb.com | 443 | WSS | wss://dev3.4nkweb.com/ws/ | ✅ Actif | | **Signer Externe** | dev3.4nkweb.com | 9090 | WS | ws://dev3.4nkweb.com:9090 | ✅ Actif | | **Signer Base** | dev3.4nkweb.com | 443 | HTTPS | https://dev3.4nkweb.com | ✅ Actif | | **Mempool** | mempool2.4nkweb.com | 443 | HTTPS | https://mempool2.4nkweb.com | ✅ Actif | | **Storage** | dev4.4nkweb.com | 443 | HTTPS | https://dev4.4nkweb.com/storage | ✅ Actif | ### 🔄 **Proxy Nginx (dev4.4nkweb.com)** | Route | Destination | Port | Protocole | Description | |-------|-------------|------|-----------|-------------| | **/** | ihm_client | 3003 | HTTP | Interface principale | | **/lecoffre** | lecoffre-front | 3004 | HTTP | Application LeCoffre | | **/api/** | lecoffre-back | 8080 | HTTP | API Backend | | **/back/** | lecoffre-back | 8080 | HTTP | API Backend (alias) | | **/ws/** | sdk_relay | 8090 | WebSocket | Relay WebSocket | | **/signer/** | sdk_signer | 3001 | HTTP/WebSocket | Service Signer | | **/src/service-workers/** | ihm_client | 3003 | HTTP | Service Workers | ### 🏠 **Proxy Nginx Local (local.4nkweb.com)** | Route | Destination | Port | Protocole | Description | |-------|-------------|------|-----------|-------------| | **/** | Redirection | 3000 | HTTP | Redirige vers port 3000 | | **/lecoffre/** | lecoffre-front | 3004 | HTTP | Application LeCoffre local | ### 🔧 **Configuration Bitcoin Signet** | Service | Port | Protocole | Description | |---------|------|-----------|-------------| | **RPC** | 38332 | TCP | Interface RPC Bitcoin | | **P2P** | 38333 | TCP | RĂ©seau peer-to-peer | | **ZMQ Hash** | 29000 | TCP | Notifications de blocs | | **ZMQ RawTx** | 29001 | TCP | Notifications de transactions | | **Tor** | 9050 | TCP | Proxy Tor | ### 🌐 **RĂ©seau Docker** | RĂ©seau | Subnet | Driver | Services | |--------|--------|--------|----------| | **btcnet** | 172.20.0.0/16 | bridge | Tous les services | ### 🔗 **Variables d'Environnement ClĂ©s** | Variable | Valeur | Service | |----------|--------|---------| | **VITE_BOOTSTRAPURL** | wss://dev4.4nkweb.com/ws/ | ihm_client | | **SIGNER_WS_URL** | ws://dev3.4nkweb.com:9090 | sdk_signer | | **SIGNER_BASE_URL** | https://dev3.4nkweb.com | sdk_signer | | **RELAY_URLS** | wss://dev4.4nkweb.com/ws/,wss://dev3.4nkweb.com/ws/ | sdk_signer | | **bootstrap_url** | wss://dev3.4nkweb.com/ws/ | sdk_relay | | **storage** | https://dev4.4nkweb.com/storage | sdk_relay | ## Flux d'Architecture ### 🔄 **Flux Principal** ``` Internet → dev4.4nkweb.com (Nginx) → Services Locaux ``` 1. **Frontend** : `https://dev4.4nkweb.com/lecoffre` → lecoffre-front (127.0.0.2:3004) 2. **API** : `https://dev4.4nkweb.com/api/` → lecoffre-back (0.0.0.0:8080) 3. **IHM** : `https://dev4.4nkweb.com/` → ihm_client (0.0.0.0:3003) 4. **WebSocket** : `https://dev4.4nkweb.com/ws/` → sdk_relay (0.0.0.0:8090) ### 🔗 **Flux de Redirection** ``` local.4nkdev.com → local.4nkweb.com → https://dev4.4nkweb.com/lecoffre ``` ### 🌐 **Flux Externes** - **Bootstrap** : `wss://dev3.4nkweb.com/ws/` (Relay externe) - **Signer** : `ws://dev3.4nkweb.com:9090` (Actuellement inactif) - **Mempool** : `https://mempool2.4nkweb.com` (RĂ©seau Bitcoin Signet) ## ⚠ **Points d'Attention** 1. **dev3.4nkweb.com:9090** - Service signer externe actuellement inactif 2. **dev3.4nkweb.com** - Retourne 502 Bad Gateway (services backend indisponibles) 3. **Ports 0.0.0.0** - Services locaux uniquement accessibles depuis la machine 4. **Ports 127.0.0.2** - lecoffre-front sur interface sĂ©parĂ©e ## 📋 **Ordre de DĂ©marrage des Services** Selon les rĂšgles du projet, l'ordre de dĂ©marrage est : 1. **tor** - Proxy anonyme 2. **bitcoin** - NƓud Bitcoin Signet 3. **blindbit** - Oracle Bitcoin 4. **sdk_storage** - Stockage temporaire 5. **sdk_relay** - Relais des transactions 6. **sdk_signer** - Signature des processus 7. **ihm_client** - Interface utilisateur ## 🔧 **Configuration Critique** - **Mempool du rĂ©seau signet** : `https://mempool2.4nkweb.com/fr/docs/api/rest` - **Test de connectivitĂ© Bitcoin** : `docker exec bitcoin-signet bitcoin-cli -signet -rpccookiefile=/home/bitcoin/.bitcoin/signet/.cookie getblockchaininfo` - **Test WebSocket Bootstrap** : `wss://dev3.4nkweb.com/ws/`