# 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/`