From 3c0377cdb983ca5d3d64bfbb0bd1d53c272ee5d2 Mon Sep 17 00:00:00 2001 From: Debian Date: Fri, 29 Aug 2025 16:29:17 +0000 Subject: [PATCH] doc cleanup --- archive/docs/COMMANDES_REDEMARRAGE.md | 663 ----------------------- archive/docs/CONFIGURATION_DEV3.md | 218 -------- archive/docs/EXEMPLES_PRATIQUES.md | 441 --------------- archive/docs/INTEGRATION_DEV3_FINAL.md | 125 ----- archive/docs/README_RESTART_SCRIPT.md | 263 --------- archive/docs/RESUME_AJOUT_DEV3.md | 425 --------------- archive/docs/RESUME_DECOUVERTE_NOEUDS.md | 208 ------- archive/docs/RESUME_SCRIPT_RESTART.md | 226 -------- archive/docs/RESUME_TEST_3_RELAIS.md | 161 ------ archive/docs/explain_node_discovery.md | 379 ------------- docs/templates/API.md | 8 - docs/templates/ARCHITECTURE.md | 8 - docs/templates/CONFIGURATION.md | 6 - docs/templates/INDEX.md | 12 - docs/templates/OPEN_SOURCE_CHECKLIST.md | 7 - docs/templates/README.md | 29 - docs/templates/RELEASE_PLAN.md | 7 - docs/templates/SECURITY_AUDIT.md | 7 - docs/templates/TESTING.md | 6 - docs/templates/USAGE.md | 7 - 20 files changed, 3206 deletions(-) delete mode 100644 archive/docs/COMMANDES_REDEMARRAGE.md delete mode 100644 archive/docs/CONFIGURATION_DEV3.md delete mode 100644 archive/docs/EXEMPLES_PRATIQUES.md delete mode 100644 archive/docs/INTEGRATION_DEV3_FINAL.md delete mode 100644 archive/docs/README_RESTART_SCRIPT.md delete mode 100644 archive/docs/RESUME_AJOUT_DEV3.md delete mode 100644 archive/docs/RESUME_DECOUVERTE_NOEUDS.md delete mode 100644 archive/docs/RESUME_SCRIPT_RESTART.md delete mode 100644 archive/docs/RESUME_TEST_3_RELAIS.md delete mode 100644 archive/docs/explain_node_discovery.md delete mode 100644 docs/templates/API.md delete mode 100644 docs/templates/ARCHITECTURE.md delete mode 100644 docs/templates/CONFIGURATION.md delete mode 100644 docs/templates/INDEX.md delete mode 100644 docs/templates/OPEN_SOURCE_CHECKLIST.md delete mode 100644 docs/templates/README.md delete mode 100644 docs/templates/RELEASE_PLAN.md delete mode 100644 docs/templates/SECURITY_AUDIT.md delete mode 100644 docs/templates/TESTING.md delete mode 100644 docs/templates/USAGE.md diff --git a/archive/docs/COMMANDES_REDEMARRAGE.md b/archive/docs/COMMANDES_REDEMARRAGE.md deleted file mode 100644 index a2be25e9..00000000 --- a/archive/docs/COMMANDES_REDEMARRAGE.md +++ /dev/null @@ -1,663 +0,0 @@ -# Commandes Exactes - Arrêt et Redémarrage 4NK Node - -## 📅 Date : $(date) -## 🎯 Motif : Redémarrage propre pour intégrer dev3.4nkweb.com - ---- - -## 🛑 **1. ARRÊT DE TOUS LES SERVICES** - -```bash -# Arrêt de tous les conteneurs -docker stop $(docker ps -q) 2>/dev/null || true - -# Arrêt de docker-compose -docker-compose down -v 2>/dev/null || true - -# Vérification qu'aucun conteneur ne tourne -docker ps -``` - -**Output attendu :** -``` -CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES -``` - ---- - -## 🧹 **2. NETTOYAGE COMPLET** - -```bash -# Suppression de tous les conteneurs -docker rm -f $(docker ps -aq) 2>/dev/null || true -``` - -**Output reçu :** -``` -38b00bb9a73d -82832dff9e65 -27eb26cf34de -dcc0733ff65a -cf89e4d5d99a -8f5815486a1d -``` - -```bash -# Nettoyage des réseaux -docker network prune -f -``` - -**Output reçu :** -``` -Deleted Networks: -4nk_node_btcnet -``` - ---- - -## 🌐 **3. CRÉATION DU RÉSEAU** - -```bash -# Création du réseau Docker -docker network create 4nk_node_btcnet -``` - -**Output reçu :** -``` -5242f77defc3539b050defd7e1a144e1e066b28010ae97ad6b4e4a1eb553bfe7 -``` - ---- - -## 🚀 **4. DÉMARRAGE DANS L'ORDRE LOGIQUE** - -### **4.1 Tor Proxy** - -```bash -docker run -d --name tor-proxy --network 4nk_node_btcnet --network-alias tor -p 9050:9050 -p 9051:9051 dperson/torproxy:latest -``` - -**Output reçu :** -``` -b2ae583570d4435cd5dcc41f44df8ff33445d4bf2bcbbfcdee0e0a239e7c3a28 -``` - -```bash -sleep 5 && docker ps | grep tor -``` - -**Output reçu :** -``` -b2ae583570d4 dperson/torproxy:latest "/sbin/tini -- /usr/…" 10 seconds ago Up 9 seconds (health: starting) 8118/tcp, 0.0.0.0:9050-9051->9050-9051/tcp, :::9050-9051->9050-9051/tcp tor-proxy -``` - ---- - -### **4.2 Bitcoin Core** - -```bash -docker run -d --name bitcoin-signet --network 4nk_node_btcnet --network-alias bitcoin -p 38333:38333 -p 18443:18443 -p 29000:29000 -v bitcoin_data:/home/bitcoin/.bitcoin -v /home/desk/Téléchargements/code/4NK/4NK_node/bitcoin/bitcoin.conf:/home/bitcoin/.bitcoin/bitcoin.conf 4nk_node_bitcoin -``` - -**Output reçu :** -``` -166a88e6817ecd680a41cf4a0a34b654df19fdd15ed408a53338ebb5bf4bbb98 -``` - -```bash -sleep 10 && docker ps | grep bitcoin -``` - -**Output reçu :** -``` -166a88e6817e 4nk_node_bitcoin "bitcoind -conf=/hom…" 17 seconds ago Up 17 seconds 0.0.0.0:18443->18443/tcp, :::18443->18443/tcp, 0.0.0.0:29000->29000/tcp, :::29000->29000/tcp, 0.0.0.0:38333->38333/tcp, :::38333->38333/tcp, 38332/tcp bitcoin-signet -``` - ---- - -### **4.3 Blindbit Oracle** - -```bash -docker run -d --name blindbit-oracle --network 4nk_node_btcnet --network-alias blindbit -p 8000:8000 -v blindbit_data:/data -v /home/desk/Téléchargements/code/4NK/4NK_node/blindbit/blindbit.toml:/data/blindbit.toml -v bitcoin_data:/home/bitcoin/.bitcoin 4nk_node_blindbit -``` - -**Output reçu :** -``` -34e41782e0633b140be2c2c330a1a769a6d1359938e1e5ea71b63153ab518422 -``` - -```bash -sleep 10 && docker ps | grep blindbit -``` - -**Output reçu :** -``` -34e41782e063 4nk_node_blindbit "blindbit-oracle -da…" 17 seconds ago Up 16 seconds 0.0.0.0:8000->8000/tcp, :::8000->8000/tcp - blindbit-oracle -``` - ---- - -### **4.4 Construction de l'image sdk_relay** - -```bash -docker build -f sdk_relay/Dockerfile -t 4nk_node_sdk_relay_1 .. -``` - -**Output reçu :** -``` -Sending build context to Docker daemon 3.565GB -Step 1/18 : FROM rust:1.89 as builder - ---> 981f4ce4cc18 -Step 2/18 : WORKDIR /app - ---> Running in 573f36d06e36 -Removing intermediate container 573f36d06e36 - ---> aa59cfb8256c -Step 3/18 : RUN git clone --branch docker-support --depth 1 https://git.4nkweb.com/4nk/sdk_relay.git /app/sdk_relay - ---> Running in a2ccf06e69ad -Cloning into '/app/sdk_relay'... -Removing intermediate container a2ccf06e69ad - ---> 5f2a42297ff5 -Step 4/18 : RUN git clone --branch docker-support --depth 1 https://git.4nkweb.com/4nk/sdk_common.git /app/sdk_common - ---> Running in 8c005a625047 -Cloning into '/app/sdk_common'... -Removing intermediate container 8c005a625047 - ---> 69692c0f4cd8 -Step 5/18 : WORKDIR /app/sdk_relay - ---> Running in fca1b2a220ec -Removing intermediate container fca1b2a220ec - ---> 871a1bfc3172 -Step 6/18 : RUN sed -i 's|git = "https://git.4nkweb.com/4nk/sdk_common.git", branch = "dev"|path = "/app/sdk_common"|' Cargo.toml && cargo build --release - ---> Running in 6758cf72abe6 - Updating crates.io index - Updating git repository `https://git.4nkweb.com/4nk/sdk_common.git` - Updating git repository `https://github.com/Sosthene00/sp-client.git` - Updating git repository `https://github.com/Sosthene00/tsify` - Downloading crates ... - Downloaded aead v0.5.2 - Downloaded adler2 v2.0.1 - Downloaded untrusted v0.9.0 - Downloaded want v0.3.1 - Downloaded universal-hash v0.5.1 - Downloaded async-trait v0.1.89 - Downloaded asynchronous-codec v0.7.0 - Downloaded anyhow v1.0.99 - Downloaded version_check v0.9.5 - Downloaded utf8_iter v1.0.4 - Downloaded utf-8 v0.7.6 - Downloaded aes-gcm v0.10.3 - Downloaded base64 v0.13.1 - Downloaded uuid v1.18.0 - Downloaded bitcoin-internals v0.2.0 - Downloaded futures-core v0.3.31 - Downloaded futures-macro v0.3.31 - Downloaded futures-executor v0.3.31 - Downloaded ident_case v1.0.1 - Downloaded hex v0.4.3 - Downloaded aes v0.8.4 - Downloaded bech32 v0.9.1 - Downloaded num-traits v0.2.19 - Downloaded once_cell v1.21.3 - Downloaded proc-macro2 v1.0.101 - Downloaded quote v1.0.40 - Downloaded dyn-clone v1.0.20 - Downloaded gloo-utils v0.1.7 - Downloaded hex_lit v0.1.1 - Downloaded autocfg v1.5.0 - Downloaded cfg_aliases v0.2.1 - Downloaded equivalent v1.0.2 - Downloaded darling_macro v0.20.11 - Downloaded fnv v1.0.7 - Downloaded displaydoc v0.2.5 - Downloaded either v1.15.0 - Downloaded crossbeam-utils v0.8.21 - Downloaded rand_core v0.6.4 - Downloaded rand_chacha v0.3.1 - Downloaded futures-sink v0.3.31 - Downloaded futures-io v0.3.31 - Downloaded ghash v0.5.1 - Downloaded futures v0.3.31 - Downloaded http-body v1.0.1 - Downloaded getrandom v0.3.3 - Downloaded rustversion v1.0.22 - Downloaded inout v0.1.4 - Downloaded indexmap v1.9.3 - Downloaded scopeguard v1.2.0 - Downloaded ryu v1.0.20 - Downloaded bumpalo v3.19.0 - Downloaded byteorder v1.5.0 - Downloaded serde_derive v1.0.219 - Downloaded cipher v0.4.4 - Downloaded bitcoin_hashes v0.13.0 - Downloaded sha2 v0.10.9 - Downloaded shlex v1.3.0 - Downloaded crossbeam-epoch v0.9.18 - Downloaded sha1 v0.10.6 - Downloaded futures-task v0.3.31 - Downloaded env_logger v0.9.3 - Downloaded http-body-util v0.1.3 - Downloaded iana-time-zone v0.1.63 - Downloaded hyper-rustls v0.27.7 - Downloaded iri-string v0.7.8 - Downloaded jobserver v0.1.33 - Downloaded url v2.5.6 - Downloaded jsonrpc v0.14.1 - Downloaded polyval v0.6.2 - Downloaded zerofrom v0.1.6 - Downloaded zerofrom-derive v0.1.6 - Downloaded try-lock v0.2.5 - Downloaded humantime v2.2.0 - Downloaded form_urlencoded v1.2.2 - Downloaded wasm-bindgen-macro-support v0.2.100 - Downloaded hex-conservative v0.1.2 - Downloaded zeroize v1.8.1 - Downloaded wasm-bindgen-backend v0.2.100 - Downloaded crc32fast v1.5.0 - Downloaded zstd v0.13.3 - Downloaded zstd-safe v7.2.4 - Downloaded subtle v2.6.1 - Downloaded slab v0.4.11 - Downloaded tokio-macros v2.5.0 - Downloaded tinyvec v1.10.0 - Downloaded stable_deref_trait v1.2.0 - Downloaded thiserror-impl v1.0.69 - Downloaded num-conv v0.1.0 - Downloaded tokio-rustls v0.26.2 - Downloaded lru-slab v0.1.2 - Downloaded js-sys v0.3.77 - Downloaded zerovec-derive v0.11.1 - Downloaded futures-util v0.3.31 - Downloaded thiserror-impl v2.0.16 - Downloaded tokio-stream v0.1.17 - Downloaded socket2 v0.5.10 - Downloaded smallvec v1.15.1 - Downloaded flate2 v1.1.2 - Downloaded unicode-ident v1.0.18 - Downloaded rand_core v0.9.3 - Downloaded idna v1.1.0 - Downloaded rand_chacha v0.9.0 - Downloaded chrono v0.4.41 - Downloaded thiserror v1.0.69 - Downloaded hashbrown v0.14.5 - Downloaded rustls-pki-types v1.12.0 - Downloaded rustc-hash v2.1.1 - Downloaded icu_properties_data v2.0.1 - Downloaded strsim v0.11.1 - Downloaded tokio-tungstenite v0.21.0 - Downloaded indexmap v2.10.0 - Downloaded typenum v1.18.0 - Downloaded tower-http v0.6.6 - Downloaded bitcoin v0.31.2 - Downloaded writeable v0.6.1 - Downloaded itoa v1.0.15 - Downloaded lock_api v0.4.13 - Downloaded yoke v0.8.0 - Downloaded litemap v0.8.0 - Downloaded time v0.3.41 - Downloaded log v0.4.27 - Downloaded tower v0.5.2 - Downloaded pin-project-lite v0.2.16 - Downloaded parking_lot_core v0.9.11 - Downloaded serde_urlencoded v0.7.1 - Downloaded hyper v1.7.0 - Downloaded icu_normalizer_data v2.0.0 - Downloaded signal-hook-registry v1.4.6 - Downloaded opaque-debug v0.3.1 - Downloaded wasm-bindgen-macro v0.2.100 - Downloaded wasm-bindgen-shared v0.2.100 - Downloaded wasm-bindgen v0.2.100 - Downloaded icu_locale_core v2.0.0 - Downloaded icu_collections v2.0.0 - Downloaded icu_provider v2.0.0 - Downloaded icu_properties v2.0.1 - Downloaded icu_normalizer v2.0.0 - Downloaded futures-executor v0.3.31 - Downloaded asynchronous-codec v0.7.0 - Downloaded futures v0.3.31 - Downloaded idna_adapter v1.2.1 - Downloaded idna v1.1.0 - Downloaded web-sys v0.3.77 - Downloaded bitcoin_hashes v0.13.0 - Downloaded hyper v1.7.0 - Downloaded url v2.5.6 - Downloaded secp256k1 v0.28.2 - Downloaded rustls-webpki v0.103.4 - Downloaded hyper-util v0.1.16 - Downloaded tokio-util v0.7.16 - Downloaded tower v0.5.2 - Downloaded hex v0.4.3 - Downloaded silentpayments v0.4.1 - Downloaded async-compression v0.4.27 - Downloaded serde_urlencoded v0.7.1 - Downloaded tower-http v0.6.6 - Downloaded gloo-utils v0.1.7 - Downloaded tsify v0.4.5 (https://github.com/Sosthene00/tsify?branch=next#8a5a550d) - Downloaded jsonrpc v0.14.1 - Downloaded tungstenite v0.21.0 - Downloaded zeromq v0.4.1 - Downloaded tokio-stream v0.1.17 - Downloaded serde_with v3.14.0 - Downloaded tokio-tungstenite v0.21.0 - Downloaded tokio-rustls v0.26.2 - Downloaded hyper-rustls v0.27.7 - Downloaded reqwest v0.12.23 - Downloaded bitcoincore-rpc-json v0.18.0 - Downloaded zstd v0.13.3 - Downloaded backend-blindbit-native v0.1.0 (https://github.com/Sosthene00/sp-client.git?branch=dev#878228f6) - Downloaded bitcoincore-rpc v0.18.0 - Downloaded sdk_common v0.1.0 (https://git.4nkweb.com/4nk/sdk_common.git?branch=docker-support#a4c2fd20) - Downloaded sdk_relay v0.1.0 (/app/sdk_relay) -warning: unused imports: `OutPoint`, `Psbt`, `Sequence`, `TxIn`, `TxOut`, and `block` - --> src/daemon.rs:10:5 - | -10 | block, Address, Amount, Block, BlockHash, Network, OutPoint, Psbt, ScriptBuf, Sequence, - | ^^^^^ ^^^^^^^^ ^^^^ ^^^^^^^^ -11 | Transaction, TxIn, TxOut, Txid, - | ^^^^ ^^^^^ - | - = note: `#[warn(unused_imports)]` on by default - -warning: unused import: `collections::HashMap` - --> src/faucet.rs:1:11 - | -1 | use std::{collections::HashMap, str::FromStr}; - | ^^^^^^^^^^^^^^^^^ - -warning: unused import: `std::str::FromStr` - --> src/scan.rs:3:5 - | -3 | use std::str::FromStr; - | ^^^^^^^^^ - -warning: unused imports: `All`, `Scalar`, and `Secp256k1` - --> src/scan.rs:22:49 - | -22 | use sdk_common::sp_client::bitcoin::secp256k1::{All, PublicKey, Scalar, Secp256k1, SecretKey}; - | ^^^ ^^^^^^ ^^^^^^^^^ - -warning: unused imports: `OutPointMemberMap` and `OutPointProcessMap` - --> src/sync.rs:17:21 - | -17 | serialization::{OutPointMemberMap, OutPointProcessMap}, - | ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^ - -warning: unused import: `std::fs` - --> src/sync.rs:1043:13 - | -1043 | use std::fs; - | ^^^^^^^ - -warning: multiple methods are never used - --> src/daemon.rs:413:8 - | -406 | pub(crate) trait RpcCall: Send + Sync + std::fmt::Debug { - | ------- methods in this trait -... -413 | fn get_relay_fee(&self) -> Result; - | ^^^^^^^^^ -... -417 | fn get_block(&self, block_hash: BlockHash) -> Result; - | ^^^^^^^^^ -419 | -420 | fn get_filters(&self, block_height: u32) -> Result<(u32, BlockHash, BlockFilter)>; - | ^^^^^^^^^^^ -... -446 | fn get_transaction_info(&self, txid: &Txid, blockhash: Option) -> Result; - | ^^^^^^^^^ -... -448 | fn get_transaction_hex(&self, txid: &Txid, blockhash: Option) -> Result; - | ^^^^^^^^^ -... -452 | fn get_block_txids(&self, blockhash: BlockHash) -> Result>; - | ^^^^^^^^^ -... -454 | fn get_mempool_txids(&self) -> Result>; - | ^^^^^^^^^ -... -456 | fn get_mempool_entries( - | ^^^^^^^^^ -... -461 | fn get_mempool_transactions(&self, txids: &[Txid]) -> Result>>; - | ^^^^^^^^^ -... -463 | | - | = note: `#[warn(dead_code)]` on by default - -warning: function `check_block` is never used - --> src/scan.rs:105:4 - | -105 | fn check_block( - | ^^^^^^^^^ - -warning: function `scan_block_outputs` is never used - --> src/scan.rs:105:4 - | -125 | fn scan_block_outputs( - | ^^^^^^^^^^^ - -warning: function `scan_block_inputs` is never used - --> src/scan.rs:211:4 - | -211 | fn scan_block_inputs( - | ^^^^^^^^^ - -warning: associated items `new` and `to_string` are never used - --> src/sync.rs:212:12 - | -211 | impl SyncRequest { - | ---------------- associated items in this implementation -212 | pub fn new(request_id: String, relay_id: String, sync_types: Vec) -> Self { - | ^^^^^^^^^ -... -222 | pub fn to_string(&self) -> String { - | ^^^^^^^^^ - -warning: field `last_sync` is never read - --> src/sync.rs:261:5 - | -257 | pub struct SyncManager { - | ------------ field in this struct -... -261 | last_sync: Arc>>, - | ^^^^^^^^^ - | - | note: `SyncManager` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis - - -warning: fields `sync_requests` and `sync_responses` are never read - --> src/sync.rs:272:9 - | -269 | pub struct SyncMetrics { - | ------------ fields in this struct -... -272 | pub sync_requests: u64, - | ^^^^^^^^^ -273 | pub sync_responses: u64, - | ^^^^^^^^^^^ - | - | note: `SyncMetrics` has derived impls for the traits `Clone` and `Debug`, but these are intentionally ignored during dead code analysis - - -warning: methods `create_peer_sync`, `request_sync`, `get_known_relays`, and `get_network_topology` are never used - --> src/sync.rs:481:12 - | -293 | impl SyncManager { - | ---------------- methods in this implementation -... -481 | pub fn create_peer_sync(&self) -> Result { - | ^^^^^^^^^ -... -923 | pub fn request_sync(&self, sync_types: Vec, target_addr: SocketAddr) -> Result<()> { - | ^^^^^^^^^ -... -953 | pub fn get_known_relays(&self) -> Vec { - | ^^^^^^^^^ -... -958 | pub fn get_network_topology(&self) -> NetworkTopology { - | ^^^^^^^^^ -... -960 | | - | = note: `#[warn(dead_code)]` on by default - -warning: `sdk_relay` (bin "sdk_relay") generated 14 warnings (run `cargo fix --bin "sdk_relay"` to apply 6 suggestions) - Finished `release` profile [optimized] target(s) in 43.55s -Removing intermediate container 6758cf72abe6 - ---> ff00567ef787 -Step 7/18 : FROM debian:bookworm-slim - ---> f813b63f015b -Step 8/18 : RUN apt-get update && apt-get install -y ca-certificates curl strace net-tools procps && rm -rf /var/lib/apt/lists/* - - ---> Using cache - ---> a90ceb3ece09 -Step 9/18 : COPY --from=builder /app/sdk_relay/target/release/sdk_relay /usr/local/bin/sdk_relay - ---> d3f8fcd8d1aa -Step 10/18 : RUN groupadd -g 1000 bitcoin && useradd -m -d /home/bitcoin -g bitcoin bitcoin - ---> Running in a44a5d1a164b -Removing intermediate container a44a5d1a164b - ---> c03f33299aa3 -Step 11/18 : WORKDIR /home/bitcoin - ---> Running in 3e59a64e6564 -Removing intermediate container 3e59a64e6564 - ---> 1ec4365679c4 -Step 12/18 : RUN mkdir -p /home/bitcoin/.4nk - ---> Running in 62f7f23623a3 -Removing intermediate container 62f7f23623a3 - ---> 33b4878b4736 -Step 13/18 : COPY 4NK_node/sdk_relay/.conf /home/bitcoin/.conf - ---> 094a575cb271 -Step 14/18 : COPY 4NK_node/sdk_relay/healthcheck.sh /usr/local/bin/healthcheck.sh - ---> ff2a9e65d8ac -Step 15/18 : RUN chown -R bitcoin:bitcoin /home/bitcoin - ---> Running in 4b7bb423717d -Removing intermediate container 4b7bb423717d - ---> 7bd220b71d06 -Step 16/18 : USER bitcoin - ---> Running in 292ab8a8bbb0 -Removing intermediate container 292ab8a8bbb0 - ---> 7d840368144b -Step 17/18 : EXPOSE 8090 8091 - ---> Running in da20b09606c4 -Removing intermediate container da20b09606c4 - ---> 3539f4c41a52 -Step 18/18 : CMD ["/bin/bash"] - ---> Running in 2adcdd633e62 -Removing intermediate container 2adcdd633e62 - ---> 70c4624704d3 -Successfully built 70c4624704d3 -Successfully tagged 4nk_node_sdk_relay_1:latest -``` - ---- - -### **4.5 Relay 1** - -```bash -docker run -d --name sdk_relay_1 --network 4nk_node_btcnet --network-alias sdk_relay_1 -p 8090:8090 -p 8091:8091 -v bitcoin_data:/home/bitcoin/.bitcoin -v /home/desk/Téléchargements/code/4NK/4NK_node/bitcoin/bitcoin.conf:/home/bitcoin/.bitcoin/bitcoin.conf -v sdk_relay_1_data:/home/bitcoin/.4nk -v /home/desk/Téléchargements/code/4NK/4NK_node/sdk_relay/.conf.docker.relay1:/home/bitcoin/.conf.docker -e RUST_LOG=debug,bitcoincore_rpc=trace -e HOME=/home/bitcoin -e BITCOIN_COOKIE_PATH=/home/bitcoin/.bitcoin/signet/.cookie -e ENABLE_SYNC_TEST=1 4nk_node_sdk_relay_1 /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" -``` - -**Output reçu :** -``` -2f8b0dd684e18cc2850a74238d673b012b29d875106ba5c94d08d8d17ea7d933 -``` - -```bash -sleep 10 && docker ps | grep sdk_relay_1 -``` - -**Output reçu :** -``` -2f8b0dd684e1 4nk_node_sdk_relay_1 "/bin/sh -c 'cp /hom…" 19 seconds ago Up 18 seconds 0.0.0.0:8090-8091->8090-8091/tcp, :::8090-8091->8090-8091/tcp - sdk_relay_1 -``` - ---- - -### **4.6 Relay 2** - -```bash -docker run -d --name sdk_relay_2 --network 4nk_node_btcnet --network-alias sdk_relay_2 -p 8092:8090 -p 8093:8091 -v bitcoin_data:/home/bitcoin/.bitcoin -v /home/desk/Téléchargements/code/4NK/4NK_node/bitcoin/bitcoin.conf:/home/bitcoin/.bitcoin/bitcoin.conf -v sdk_relay_2_data:/home/bitcoin/.4nk -v /home/desk/Téléchargements/code/4NK/4NK_node/sdk_relay/.conf.docker.relay2:/home/bitcoin/.conf.docker -e RUST_LOG=debug,bitcoincore_rpc=trace -e HOME=/home/bitcoin -e BITCOIN_COOKIE_PATH=/home/bitcoin/.bitcoin/signet/.cookie -e ENABLE_SYNC_TEST=1 4nk_node_sdk_relay_1 /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" -``` - -**Output reçu :** -``` -e8f2907a4ba38424787fd90427aa7f1ccf0d6fb5eb0f7dc434a0d6a0d9d1494f -``` - -```bash -sleep 10 && docker ps | grep sdk_relay_2 -``` - -**Output reçu :** -``` -e8f2907a4ba3 4nk_node_sdk_relay_1 "/bin/sh -c 'cp /hom…" 17 seconds ago Up 16 seconds 0.0.0.0:8092->8090/tcp, :::8092->8090/tcp, 0.0.0.0:8093->8091/tcp, :::8093->8091/tcp - sdk_relay_2 -``` - ---- - -### **4.7 Relay 3** - -```bash -docker run -d --name sdk_relay_3 --network 4nk_node_btcnet --network-alias sdk_relay_3 -p 8094:8090 -p 8095:8091 -v bitcoin_data:/home/bitcoin/.bitcoin -v /home/desk/Téléchargements/code/4NK/4NK_node/bitcoin/bitcoin.conf:/home/bitcoin/.bitcoin/bitcoin.conf -v sdk_relay_3_data:/home/bitcoin/.4nk -v /home/desk/Téléchargements/code/4NK/4NK_node/sdk_relay/.conf.docker.relay3:/home/bitcoin/.conf.docker -e RUST_LOG=debug,bitcoincore_rpc=trace -e HOME=/home/bitcoin -e BITCOIN_COOKIE_PATH=/home/bitcoin/.bitcoin/signet/.cookie -e ENABLE_SYNC_TEST=1 4nk_node_sdk_relay_1 /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" -``` - -**Output reçu :** -``` -e969cb2ead8151e74dfd3cd8eabddcedac551c2a52f0377a182c3ffe15305b90 -``` - -```bash -sleep 10 && docker ps | grep sdk_relay_3 -``` - -**Output reçu :** -``` -e969cb2ead81 4nk_node_sdk_relay_1 "/bin/sh -c 'cp /hom…" 16 seconds ago Up 15 seconds 0.0.0.0:8094->8090/tcp, :::8094->8090/tcp, 0.0.0.0:8095->8091/tcp, :::8095->8091/tcp - sdk_relay_3 -``` - ---- - -## 🎯 **5. VÉRIFICATION FINALE** - -```bash -docker ps -``` - -**Output reçu :** -``` -CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES -e969cb2ead81 4nk_node_sdk_relay_1 "/bin/sh -c 'cp /hom…" 21 seconds ago Up 20 seconds 0.0.0.0:8094->8090/tcp, :::8094->8090/tcp, 0.0.0.0:8095->8091/tcp, :::8095->8091/tcp sdk_relay_3 -e8f2907a4ba3 4nk_node_sdk_relay_1 "/bin/sh -c 'cp /hom…" 46 seconds ago Up 45 seconds 0.0.0.0:8092->8090/tcp, :::8092->8090/tcp, 0.0.0.0:8093->8091/tcp, :::8093->8091/tcp sdk_relay_2 -2f8b0dd684e1 4nk_node_sdk_relay_1 "/bin/sh -c 'cp /hom…" About a minute ago Up About a minute 0.0.0.0:8090-8091->8090-8091/tcp, :::8090-8091->8090-8091/tcp sdk_relay_1 -34e41782e063 4nk_node_blindbit "blindbit-oracle -da…" 3 minutes ago Up 3 minutes 0.0.0.0:8000->8000/tcp, :::8000->8000/tcp blindbit-oracle -166a88e6817e 4nk_node_bitcoin "bitcoind -conf=/hom…" 3 minutes ago Up 3 minutes 0.0.0.0:18443->18443/tcp, :::18443->18443/tcp, 0.0.0.0:29000->29000/tcp, :::29000->29000/tcp, 0.0.0.0:38333->38333/tcp, :::38333->38333/tcp, 38332/tcp bitcoin-signet -b2ae583570d4 dperson/torproxy:latest "/sbin/tini -- /usr/…" 3 minutes ago Up 3 minutes (healthy) 8118/tcp, 0.0.0.0:9050-9051->9050-9051/tcp, :::9050-9051->9050-9051/tcp tor-proxy -``` - ---- - -## 📊 **RÉSUMÉ DES SERVICES ACTIFS** - -| Service | Conteneur | Ports | Statut | -|---------|-----------|-------|---------| -| **Tor Proxy** | `tor-proxy` | 9050, 9051 | ✅ Healthy | -| **Bitcoin Core** | `bitcoin-signet` | 38333, 18443, 29000 | ✅ Running | -| **Blindbit Oracle** | `blindbit-oracle` | 8000 | ✅ Running | -| **Relay 1** | `sdk_relay_1` | 8090, 8091 | ✅ Running | -| **Relay 2** | `sdk_relay_2` | 8092, 8093 | ✅ Running | -| **Relay 3** | `sdk_relay_3` | 8094, 8095 | ✅ Running | - ---- - -## 🎉 **RÉSULTAT FINAL** - -✅ **6 services** en cours d'exécution -✅ **3 relais** configurés pour la synchronisation -✅ **Configuration externe** prête pour dev3.4nkweb.com -✅ **Tous les ports** correctement exposés -✅ **Volumes persistants** préservés - -**L'infrastructure 4NK Node est maintenant complètement opérationnelle !** - - diff --git a/archive/docs/CONFIGURATION_DEV3.md b/archive/docs/CONFIGURATION_DEV3.md deleted file mode 100644 index 60d41cd9..00000000 --- a/archive/docs/CONFIGURATION_DEV3.md +++ /dev/null @@ -1,218 +0,0 @@ -# Configuration du Relais dev3.4nkweb.com - -## 📋 Informations du Relais - -- **Nom** : dev3-relay -- **URL** : dev3.4nkweb.com -- **Port** : 443 (HTTPS/WSS) -- **Chemin WebSocket** : `/ws/` -- **URL complète** : `wss://dev3.4nkweb.com:443/ws/` -- **Version** : Ancienne version (sans synchronisation) -- **SSL/TLS** : Activé (Let's Encrypt) - -## 🔧 Configuration Actuelle - -### Fichier de configuration externe - -```toml -# external_nodes.conf -[relays] -dev3-relay = "dev3.4nkweb.com:443" -``` - -### Configuration spéciale requise - -Le relais dev3.4nkweb.com nécessite une configuration spéciale car : - -1. **WSS au lieu de WS** : Utilise WebSocket Secure sur le port 443 -2. **Chemin spécifique** : `/ws/` au lieu de la racine -3. **Limitations de message** : Messages limités en taille -4. **Ancienne version** : Ne supporte pas la synchronisation entre relais - -## 🧪 Tests de Connectivité - -### Test de base - -```bash -# Test de connectivité HTTPS -curl -v https://dev3.4nkweb.com:443 - -# Test de connectivité WebSocket -curl -v -H "Connection: Upgrade" \ - -H "Upgrade: websocket" \ - -H "Sec-WebSocket-Key: test" \ - -H "Sec-WebSocket-Version: 13" \ - https://dev3.4nkweb.com:443/ws/ -``` - -### Test avec Python - -```bash -# Test simple -python3 test_dev3_simple.py - -# Test complet -python3 test_dev3_connectivity.py -``` - -## 📊 Résultats des Tests - -### ✅ Connectivité -- **HTTPS** : ✅ Accessible -- **WSS** : ✅ Accessible sur `/ws/` -- **SSL** : ✅ Certificat Let's Encrypt valide - -### ⚠️ Limitations -- **Taille des messages** : Limitée (erreur "message too big") -- **Synchronisation** : Non supportée (ancienne version) -- **Handshake** : Format ancien uniquement - -### 🔧 Compatibilité -- **Ancienne version** : ✅ Compatible -- **Nouvelle version** : ❌ Messages trop gros -- **Synchronisation** : ❌ Non supportée - -## 🚀 Utilisation - -### Connexion WebSocket - -```javascript -// Connexion JavaScript -const ws = new WebSocket('wss://dev3.4nkweb.com:443/ws/'); - -ws.onopen = function() { - console.log('Connecté à dev3.4nkweb.com'); - - // Handshake simple (ancienne version) - const handshake = { - type: 'handshake', - client_id: 'test-client', - version: '0.9.0' - }; - ws.send(JSON.stringify(handshake)); -}; -``` - -### Connexion Python - -```python -import asyncio -import websockets -import json -import ssl - -async def connect_to_dev3(): - uri = "wss://dev3.4nkweb.com:443/ws/" - - # Configuration SSL - ssl_context = ssl.create_default_context() - ssl_context.check_hostname = False - ssl_context.verify_mode = ssl.CERT_NONE - - async with websockets.connect(uri, ssl=ssl_context) as websocket: - # Handshake simple - handshake = { - "type": "handshake", - "client_id": "python-client", - "version": "0.9.0" - } - await websocket.send(json.dumps(handshake)) - - # Écouter les réponses - async for message in websocket: - data = json.loads(message) - print(f"Message reçu: {data}") - -asyncio.run(connect_to_dev3()) -``` - -## 🔒 Sécurité - -### Certificat SSL -- **Émetteur** : Let's Encrypt -- **Validité** : 17 août 2025 - 15 novembre 2025 -- **Domaine** : dev3.4nkweb.com -- **Protocole** : TLSv1.3 - -### Recommandations -- ✅ Utiliser WSS pour les connexions -- ✅ Vérifier le certificat SSL -- ⚠️ Limiter la taille des messages -- ⚠️ Gérer les timeouts - -## 📈 Monitoring - -### Scripts de monitoring - -```bash -# Test de connectivité -./add_external_node.sh test dev3-relay - -# Monitoring en continu -while true; do - python3 test_dev3_simple.py - sleep 300 # Test toutes les 5 minutes -done -``` - -### Métriques à surveiller -- **Connectivité** : WSS accessible -- **Latence** : Temps de réponse -- **Erreurs** : Messages trop gros -- **Disponibilité** : Uptime du service - -## 🔄 Mise à Jour - -### Pour la synchronisation - -Le relais dev3.4nkweb.com nécessite une mise à jour pour supporter : - -1. **Messages plus gros** : Supprimer la limitation de taille -2. **Synchronisation** : Implémenter le protocole de sync -3. **Nouveau format** : Support des messages `Sync` - -### Plan de migration - -```bash -# 1. Tester la compatibilité -python3 test_dev3_connectivity.py - -# 2. Mettre à jour le relais (si possible) -# Contact: admin@4nkweb.com - -# 3. Tester la nouvelle version -python3 test_websocket_messages.py - -# 4. Activer la synchronisation -docker-compose restart sdk_relay_1 sdk_relay_2 sdk_relay_3 -``` - -## 📝 Notes - -- Le relais dev3.4nkweb.com est fonctionnel mais limité -- Utiliser des messages courts pour éviter les erreurs -- La synchronisation n'est pas encore supportée -- Surveiller les logs pour détecter les problèmes -- Considérer une mise à jour pour la compatibilité complète - -## 🆘 Dépannage - -### Problèmes courants - -1. **"message too big"** - - Solution : Réduire la taille des messages - - Alternative : Utiliser des messages simples - -2. **Timeout de connexion** - - Vérifier la connectivité réseau - - Tester avec curl en premier - -3. **Erreur SSL** - - Vérifier le certificat - - Utiliser `ssl_context.verify_mode = ssl.CERT_NONE` pour les tests - -4. **Pas de réponse** - - Le relais peut être en maintenance - - Vérifier l'uptime du service - - diff --git a/archive/docs/EXEMPLES_PRATIQUES.md b/archive/docs/EXEMPLES_PRATIQUES.md deleted file mode 100644 index baee28f0..00000000 --- a/archive/docs/EXEMPLES_PRATIQUES.md +++ /dev/null @@ -1,441 +0,0 @@ -# Exemples Pratiques - 4NK Node - -Ce document contient des exemples pratiques pour utiliser l'infrastructure 4NK Node. - -## 🚀 Exemples de Démarrage - -### 1. Démarrage complet de l'infrastructure - -```bash -# Cloner et configurer -git clone git@git.4nkweb.com:4nk/4NK_node.git -cd 4NK_node - -# Démarrer tous les services -docker-compose up -d - -# Vérifier le statut -docker-compose ps - -# Suivre les logs -docker-compose logs -f -``` - -### 2. Démarrage avec 3 relais pour tests - -```bash -# Utiliser le script de démarrage spécialisé -./start_3_relays_docker.sh - -# Ou manuellement -docker-compose up -d tor bitcoin blindbit -sleep 30 # Attendre la synchronisation Bitcoin -docker-compose up -d sdk_relay_1 sdk_relay_2 sdk_relay_3 -``` - -### 3. Démarrage séquentiel pour debug - -```bash -# 1. Démarrer Tor -docker-compose up -d tor -sleep 5 - -# 2. Démarrer Bitcoin Core -docker-compose up -d bitcoin -echo "Attendre la synchronisation Bitcoin (peut prendre 10-30 minutes)" -echo "Vérifier avec: docker exec bitcoin-signet bitcoin-cli -signet getblockchaininfo" - -# 3. Démarrer Blindbit -docker-compose up -d blindbit -sleep 10 - -# 4. Démarrer les relais -docker-compose up -d sdk_relay_1 sdk_relay_2 sdk_relay_3 -``` - -## 🧪 Exemples de Tests - -### 1. Test de connectivité basique - -```bash -# Vérifier que tous les services répondent -./test_final_sync.sh status - -# Test de connectivité WebSocket -python3 test_websocket_messages.py - -# Test des messages de synchronisation -./test_sync_logs.sh test -``` - -### 2. Test de synchronisation entre relais - -```bash -# Test en continu -./test_sync_logs.sh continuous - -# Test forcé avec redémarrage -./test_sync_logs.sh force - -# Surveillance des logs de synchronisation -./monitor_sync.sh -``` - -### 3. Test de performance - -```bash -# Test de charge WebSocket -for i in {1..10}; do - python3 test_websocket_messages.py & -done -wait - -# Test de connectivité multiple -netstat -tlnp | grep -E "(8090|8092|8094)" -``` - -## 🌐 Exemples d'Ajout de Nœuds Externes - -### 1. Ajouter un nœud externe simple - -```bash -# Ajouter un nœud externe -./add_external_node.sh add external-relay-1 external-relay-1.example.com:8090 - -# Vérifier la configuration -./add_external_node.sh list - -# Tester la connectivité -./add_external_node.sh test external-relay-1 - -# Redémarrer les relais pour appliquer -docker-compose restart sdk_relay_1 sdk_relay_2 sdk_relay_3 -``` - -### 2. Configuration d'un réseau multi-sites - -```bash -# Site principal (4NK_node) -./add_external_node.sh add site-paris-1 paris-relay-1.4nk.net:8090 -./add_external_node.sh add site-paris-2 paris-relay-2.4nk.net:8090 - -# Site secondaire -./add_external_node.sh add site-lyon-1 lyon-relay-1.4nk.net:8090 -./add_external_node.sh add site-lyon-2 lyon-relay-2.4nk.net:8090 - -# Site de backup -./add_external_node.sh add backup-1 backup-relay-1.4nk.net:8090 - -# Vérifier la configuration complète -./add_external_node.sh list -``` - -### 3. Gestion des nœuds externes - -```bash -# Supprimer un nœud problématique -./add_external_node.sh remove external-relay-1 - -# Valider une nouvelle adresse avant ajout -./add_external_node.sh validate 192.168.1.100:8090 - -# Tester tous les nœuds configurés -for relay in $(./add_external_node.sh list | grep "🔸" | cut -d' ' -f3); do - echo "Testing $relay..." - ./add_external_node.sh test $relay -done -``` - -## 🔧 Exemples de Configuration - -### 1. Configuration Bitcoin Core personnalisée - -```bash -# Modifier la configuration Bitcoin -cat > bitcoin/bitcoin.conf << EOF -signet=1 -rpcuser=bitcoin -rpcpassword=your_secure_password -rpcbind=0.0.0.0 -rpcallowip=172.19.0.0/16 -zmqpubrawblock=tcp://0.0.0.0:29000 -zmqpubrawtx=tcp://0.0.0.0:29000 -txindex=1 -server=1 -listen=1 -EOF - -# Redémarrer Bitcoin Core -docker-compose restart bitcoin -``` - -### 2. Configuration sdk_relay personnalisée - -```bash -# Créer une configuration personnalisée pour relay-1 -cat > sdk_relay/.conf.docker.relay1 << EOF -core_url=http://bitcoin:18443 -core_wallet=relay_wallet -ws_url=0.0.0.0:8090 -wallet_name=relay_wallet.json -network=signet -blindbit_url=http://blindbit:8000 -zmq_url=tcp://bitcoin:29000 -data_dir=.4nk -cookie_path=/home/bitcoin/.4nk/bitcoin.cookie -dev_mode=true -standalone=false -relay_id=relay-1 -EOF - -# Redémarrer le relais -docker-compose restart sdk_relay_1 -``` - -### 3. Configuration réseau personnalisée - -```bash -# Créer un réseau Docker personnalisé -docker network create 4nk-network --subnet=172.20.0.0/16 - -# Modifier docker-compose.yml pour utiliser le réseau personnalisé -sed -i 's/4nk_default/4nk-network/g' docker-compose.yml - -# Redémarrer tous les services -docker-compose down -docker-compose up -d -``` - -## 📊 Exemples de Monitoring - -### 1. Monitoring en temps réel - -```bash -# Suivre tous les logs -docker-compose logs -f --tail=100 - -# Suivre un service spécifique -docker logs -f sdk_relay_1 - -# Monitoring des ressources -docker stats - -# Vérifier l'espace disque -docker system df -``` - -### 2. Monitoring de la synchronisation Bitcoin - -```bash -# Vérifier la progression de synchronisation -docker exec bitcoin-signet bitcoin-cli -signet getblockchaininfo | jq '.verificationprogress' - -# Vérifier les connexions -docker exec bitcoin-signet bitcoin-cli -signet getconnectioncount - -# Vérifier l'utilisation mémoire -docker exec bitcoin-signet bitcoin-cli -signet getmemoryinfo -``` - -### 3. Monitoring des relais - -```bash -# Vérifier l'état des relais -docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}" | grep sdk_relay - -# Vérifier les ports WebSocket -netstat -tlnp | grep -E "(8090|8092|8094)" - -# Vérifier les logs de synchronisation -for i in {1..3}; do - echo "=== Relay $i ===" - docker logs sdk_relay_$i --tail=5 | grep -E "(Sync|Relay|Mesh)" -done -``` - -## 🛠️ Exemples de Debug - -### 1. Debug de connexion Bitcoin Core - -```bash -# Vérifier la connectivité RPC -curl -u bitcoin:your_password --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getblockchaininfo", "params": []}' -H 'content-type: text/plain;' http://localhost:18443/ - -# Vérifier le cookie d'authentification -docker exec bitcoin-signet ls -la /home/bitcoin/.bitcoin/signet/.cookie - -# Tester la connexion depuis un relais -docker exec sdk_relay_1 curl -s http://bitcoin:18443/ -``` - -### 2. Debug de connectivité WebSocket - -```bash -# Test de connectivité WebSocket basique -curl -v -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Sec-WebSocket-Key: test" http://localhost:8090/ - -# Test avec wscat (si installé) -wscat -c ws://localhost:8090 - -# Test de connectivité depuis un autre conteneur -docker run --rm --network 4nk_default curlimages/curl curl -s http://sdk_relay_1:8090/ -``` - -### 3. Debug de synchronisation - -```bash -# Vérifier les logs de synchronisation -docker logs sdk_relay_1 | grep -E "(discover|sync|relay)" | tail -10 - -# Vérifier l'état du SyncManager -docker exec sdk_relay_1 ps aux | grep sdk_relay - -# Vérifier les fichiers de données -docker exec sdk_relay_1 ls -la /home/bitcoin/.4nk/ -``` - -## 🔒 Exemples de Sécurité - -### 1. Configuration de pare-feu - -```bash -# Autoriser seulement les ports nécessaires -sudo ufw allow 18443/tcp # Bitcoin Core RPC -sudo ufw allow 8090/tcp # sdk_relay WebSocket -sudo ufw allow 8000/tcp # Blindbit API -sudo ufw enable - -# Vérifier les règles -sudo ufw status numbered -``` - -### 2. Configuration SSL/TLS - -```bash -# Générer un certificat auto-signé -openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes - -# Configurer nginx comme proxy SSL -cat > nginx.conf << EOF -server { - listen 443 ssl; - server_name your-domain.com; - - ssl_certificate cert.pem; - ssl_certificate_key key.pem; - - location / { - proxy_pass http://localhost:8090; - proxy_http_version 1.1; - proxy_set_header Upgrade \$http_upgrade; - proxy_set_header Connection "upgrade"; - proxy_set_header Host \$host; - } -} -EOF -``` - -### 3. Monitoring de sécurité - -```bash -# Vérifier les connexions suspectes -netstat -tuln | grep -E "(8090|8092|8094)" - -# Vérifier les logs d'accès -docker logs sdk_relay_1 | grep -E "(ERROR|WARN)" | tail -20 - -# Vérifier l'utilisation des ressources -docker stats --no-stream | grep sdk_relay -``` - -## 📈 Exemples de Performance - -### 1. Test de charge - -```bash -# Script de test de charge simple -for i in {1..50}; do - python3 test_websocket_messages.py & - sleep 0.1 -done -wait - -# Vérifier les performances -docker stats --no-stream -``` - -### 2. Optimisation mémoire - -```bash -# Limiter la mémoire des conteneurs -docker-compose down -sed -i 's/- memory: 2g/- memory: 1g/g' docker-compose.yml -docker-compose up -d - -# Vérifier l'utilisation mémoire -docker stats --no-stream | grep sdk_relay -``` - -### 3. Monitoring des performances - -```bash -# Script de monitoring continu -while true; do - echo "=== $(date) ===" - docker stats --no-stream | grep -E "(sdk_relay|bitcoin)" - echo "WebSocket connections:" - netstat -an | grep :8090 | wc -l - sleep 30 -done -``` - -## 🚀 Exemples de Déploiement - -### 1. Déploiement en production - -```bash -# Configuration production -export NODE_ENV=production -export RUST_LOG=info - -# Démarrer avec restart automatique -docker-compose up -d --restart unless-stopped - -# Vérifier la configuration -docker-compose config - -# Monitoring de production -./monitor_sync.sh -``` - -### 2. Déploiement multi-environnements - -```bash -# Environnement de développement -docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d - -# Environnement de staging -docker-compose -f docker-compose.yml -f docker-compose.staging.yml up -d - -# Environnement de production -docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d -``` - -### 3. Backup et restauration - -```bash -# Backup des données -docker exec bitcoin-signet tar czf /tmp/bitcoin-backup.tar.gz /home/bitcoin/.bitcoin -docker cp bitcoin-signet:/tmp/bitcoin-backup.tar.gz ./backup/ - -# Backup des configurations -tar czf config-backup.tar.gz sdk_relay/.conf* external_nodes.conf - -# Restauration -docker cp ./backup/bitcoin-backup.tar.gz bitcoin-signet:/tmp/ -docker exec bitcoin-signet tar xzf /tmp/bitcoin-backup.tar.gz -C / -``` - -Ces exemples couvrent les cas d'usage les plus courants pour l'infrastructure 4NK Node. Adaptez-les selon vos besoins spécifiques ! - - diff --git a/archive/docs/INTEGRATION_DEV3_FINAL.md b/archive/docs/INTEGRATION_DEV3_FINAL.md deleted file mode 100644 index 72e5fdcc..00000000 --- a/archive/docs/INTEGRATION_DEV3_FINAL.md +++ /dev/null @@ -1,125 +0,0 @@ -# 🎯 Intégration dev3.4nkweb.com - Configuration Finale - -## 📋 **Résumé** -Intégration réussie du relais externe dev3.4nkweb.com dans l'infrastructure 4NK Node. - -**Date** : $(date) -**Status** : ✅ Configuration terminée, en attente du démarrage du service relay - ---- - -## 🔧 **Configuration Finale** - -### **URL WebSocket** -``` -wss://dev3.4nkweb.com/ws/ -``` - -### **Configuration dans external_nodes.conf** -```toml -[relays] -dev3-relay = "dev3.4nkweb.com:443" -``` - -### **Caractéristiques** -- **Port** : 443 (HTTPS/WSS) -- **Chemin** : `/ws/` (avec slash final obligatoire) -- **Protocole** : WebSocket Secure (WSS) -- **Version** : 0.9.0 (ancienne version sans synchronisation) -- **SSL/TLS** : Oui (certificat Let's Encrypt valide) - ---- - -## ✅ **Tests de Connectivité** - -### **Résultats** -- ✅ **Connexion WSS** : Établie avec succès -- ✅ **Certificat SSL** : Valide (Let's Encrypt) -- ✅ **Redirection** : `/ws` → `/ws/` correctement gérée -- ⚠️ **Messages** : Limitation de taille détectée -- ⚠️ **Service Relay** : En attente du démarrage - -### **Commande de Test** -```bash -python3 test_dev3_simple.py -``` - ---- - -## 📁 **Fichiers Modifiés** - -### **Configuration** -- `sdk_relay/external_nodes.conf` : Ajout de dev3-relay -- `restart_4nk_node.sh` : Montage du fichier externe - -### **Tests** -- `test_dev3_simple.py` : Test de connectivité WSS -- `test_dev3_connectivity.py` : Test avancé -- `test_integration_dev3.sh` : Test d'intégration - -### **Documentation** -- `CONFIGURATION_DEV3.md` : Configuration spécifique -- `RESUME_AJOUT_DEV3.md` : Journal d'intégration -- `INTEGRATION_DEV3_FINAL.md` : Ce fichier - ---- - -## 🚀 **Démarrage** - -### **Commandes** -```bash -# Redémarrage complet avec dev3 configuré -./restart_4nk_node.sh - -# Test d'intégration -./test_integration_dev3.sh - -# Test de connectivité dev3 -python3 test_dev3_simple.py -``` - ---- - -## 📊 **État Actuel** - -### ✅ **Fonctionnel** -1. **Connectivité WSS** : wss://dev3.4nkweb.com/ws/ -2. **Configuration externe** : external_nodes.conf monté -3. **Tests** : Scripts de test opérationnels -4. **Documentation** : Complète et à jour - -### ⏳ **En Attente** -1. **Service Relay** : Démarrage sur dev3.4nkweb.com -2. **Découverte automatique** : Chargement du fichier externe par les relais -3. **Synchronisation** : Communication avec dev3 (version limitée) - ---- - -## 🔄 **Prochaines Étapes** - -1. **Admin dev3.4nkweb.com** : Démarrer le service relay -2. **Vérification** : Test de connectivité réussie -3. **Intégration** : Validation de la découverte automatique -4. **Monitoring** : Surveillance des logs de synchronisation - ---- - -## 📞 **Support** - -En cas de problème : -```bash -# Vérifier les logs des relais -docker logs sdk_relay_1 | grep -i "external\|dev3" - -# Tester la connectivité -python3 test_dev3_simple.py - -# Réinitialiser l'infrastructure -./restart_4nk_node.sh -``` - ---- - -**✨ Configuration terminée avec succès !** - - diff --git a/archive/docs/README_RESTART_SCRIPT.md b/archive/docs/README_RESTART_SCRIPT.md deleted file mode 100644 index b2ae189f..00000000 --- a/archive/docs/README_RESTART_SCRIPT.md +++ /dev/null @@ -1,263 +0,0 @@ -# Script de Redémarrage 4NK Node - -## 📋 Description - -Le script `restart_4nk_node.sh` est un outil automatisé pour redémarrer complètement l'infrastructure 4NK Node. Il transforme les commandes manuelles en un processus automatisé avec gestion d'erreurs et vérifications. - -## 🚀 Utilisation - -### Redémarrage complet (par défaut) -```bash -./restart_4nk_node.sh -``` - -### Options disponibles -```bash -./restart_4nk_node.sh [OPTIONS] -``` - -## 📖 Options - -| Option | Description | Exemple | -|--------|-------------|---------| -| `-h, --help` | Afficher l'aide | `./restart_4nk_node.sh -h` | -| `-s, --stop` | Arrêter tous les services | `./restart_4nk_node.sh -s` | -| `-c, --clean` | Nettoyer les conteneurs | `./restart_4nk_node.sh -c` | -| `-n, --network` | Créer le réseau | `./restart_4nk_node.sh -n` | -| `-t, --tor` | Démarrer Tor | `./restart_4nk_node.sh -t` | -| `-b, --bitcoin` | Démarrer Bitcoin | `./restart_4nk_node.sh -b` | -| `-l, --blindbit` | Démarrer Blindbit | `./restart_4nk_node.sh -l` | -| `-r, --relays` | Démarrer les relais | `./restart_4nk_node.sh -r` | -| `-v, --verify` | Vérifier le statut | `./restart_4nk_node.sh -v` | - -## 🎯 Exemples d'utilisation - -### 1. Redémarrage complet -```bash -./restart_4nk_node.sh -``` -**Résultat :** Arrêt → Nettoyage → Réseau → Tor → Bitcoin → Blindbit → Construction → Relays → Vérification - -### 2. Arrêter uniquement -```bash -./restart_4nk_node.sh -s -``` -**Résultat :** Arrêt de tous les services et conteneurs - -### 3. Démarrer uniquement les relais -```bash -./restart_4nk_node.sh -r -``` -**Résultat :** Construction de l'image + démarrage des 3 relais - -### 4. Vérifier le statut -```bash -./restart_4nk_node.sh -v -``` -**Résultat :** Affichage de l'état de tous les services - -## 🔧 Configuration - -### Variables principales - -```bash -# Images Docker -TOR_IMAGE="dperson/torproxy:latest" -BITCOIN_IMAGE="4nk_node_bitcoin" -BLINDBIT_IMAGE="4nk_node_blindbit" -RELAY_IMAGE="4nk_node_sdk_relay_1" - -# Réseau -NETWORK_NAME="4nk_node_btcnet" - -# Volumes -BITCOIN_VOLUME="bitcoin_data" -BLINDBIT_VOLUME="blindbit_data" -RELAY_1_VOLUME="sdk_relay_1_data" -RELAY_2_VOLUME="sdk_relay_2_data" -RELAY_3_VOLUME="sdk_relay_3_data" -``` - -### Ports exposés - -| Service | Ports Internes | Ports Externes | -|---------|----------------|----------------| -| **Tor** | 9050, 9051 | 9050, 9051 | -| **Bitcoin** | 38333, 18443, 29000 | 38333, 18443, 29000 | -| **Blindbit** | 8000 | 8000 | -| **Relay 1** | 8090, 8091 | 8090, 8091 | -| **Relay 2** | 8090, 8091 | 8092, 8093 | -| **Relay 3** | 8090, 8091 | 8094, 8095 | - -### Fichiers de configuration - -```bash -BITCOIN_CONF="$PROJECT_DIR/bitcoin/bitcoin.conf" -BLINDBIT_CONF="$PROJECT_DIR/blindbit/blindbit.toml" -RELAY_1_CONF="$PROJECT_DIR/sdk_relay/.conf.docker.relay1" -RELAY_2_CONF="$PROJECT_DIR/sdk_relay/.conf.docker.relay2" -RELAY_3_CONF="$PROJECT_DIR/sdk_relay/.conf.docker.relay3" -``` - -## 🛠️ Fonctionnalités - -### 1. Gestion d'erreurs -- **Vérification de Docker** : S'assure que Docker est installé et en cours d'exécution -- **Vérification des fichiers** : Contrôle l'existence des fichiers de configuration -- **Timeouts** : Gestion des timeouts pour le démarrage des conteneurs -- **Arrêt en cas d'erreur** : `set -e` pour arrêter le script en cas d'erreur - -### 2. Affichage coloré -- **Vert** : Succès ✅ -- **Rouge** : Erreurs ❌ -- **Jaune** : Avertissements ⚠️ -- **Bleu** : En-têtes 🔄 -- **Cyan** : Étapes 🔄 -- **Violet** : Informations ℹ️ - -### 3. Vérifications automatiques -- **Attente des conteneurs** : Vérifie que chaque conteneur démarre correctement -- **Vérification des ports** : Contrôle que les ports sont correctement exposés -- **Statut final** : Affiche un résumé de tous les services - -### 4. Modularité -- **Fonctions séparées** : Chaque service a sa propre fonction de démarrage -- **Options flexibles** : Possibilité de démarrer des services individuels -- **Réutilisabilité** : Fonctions utilitaires réutilisables - -## 📊 Sortie du script - -### Exemple de sortie réussie -``` -============================================================================= -SCRIPT DE REDÉMARRAGE COMPLET 4NK Node -============================================================================= -ℹ️ Répertoire de travail: /home/desk/Téléchargements/code/4NK/4NK_node -ℹ️ Date: Mon Dec 16 10:30:00 CET 2024 - -============================================================================= -ARRÊT DE TOUS LES SERVICES -============================================================================= -🔄 Arrêt de tous les conteneurs -🔄 Arrêt de docker-compose -🔄 Vérification qu'aucun conteneur ne tourne -✅ Aucun conteneur en cours d'exécution - -============================================================================= -NETTOYAGE COMPLET -============================================================================= -🔄 Suppression de tous les conteneurs -ℹ️ Conteneurs supprimés: abc123 def456 ghi789 -🔄 Nettoyage des réseaux -ℹ️ Réseaux supprimés: 4nk_node_btcnet - -[... autres étapes ...] - -============================================================================= -VÉRIFICATION FINALE -============================================================================= -🔄 État de tous les services -CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES -e969cb2ead81 4nk_node_sdk_relay_1 "/bin/sh -c 'cp /hom…" 21 seconds ago Up 20 seconds 0.0.0.0:8094->8090/tcp, :::8094->8090/tcp, 0.0.0.0:8095->8091/tcp, :::8095->8091/tcp sdk_relay_3 -[... autres conteneurs ...] - -🔄 Résumé des services actifs -Services en cours d'exécution: -tor-proxy Up 3 minutes (healthy) 8118/tcp, 0.0.0.0:9050-9051->9050-9051/tcp, :::9050-9051->9050-9051/tcp -bitcoin-signet Up 3 minutes 0.0.0.0:18443->18443/tcp, :::18443->18443/tcp, 0.0.0.0:29000->29000/tcp, :::29000->29000/tcp, 0.0.0.0:38333->38333/tcp, :::38333->38333/tcp, 38332/tcp -[... autres services ...] - -🔄 Vérification des ports -✅ tor-proxy: ✅ En cours d'exécution -✅ bitcoin-signet: ✅ En cours d'exécution -✅ blindbit-oracle: ✅ En cours d'exécution -✅ sdk_relay_1: ✅ En cours d'exécution -✅ sdk_relay_2: ✅ En cours d'exécution -✅ sdk_relay_3: ✅ En cours d'exécution -ℹ️ Services actifs: 6/6 -✅ Tous les services sont opérationnels ! - -============================================================================= -REDÉMARRAGE TERMINÉ -============================================================================= -✅ L'infrastructure 4NK Node est maintenant opérationnelle ! -ℹ️ Services actifs: 6 -ℹ️ Ports exposés: 12 -``` - -## ⚠️ Dépannage - -### Erreurs courantes - -#### 1. Docker non installé -``` -❌ Docker n'est pas installé ou n'est pas dans le PATH -``` -**Solution :** Installer Docker et s'assurer qu'il est dans le PATH - -#### 2. Docker daemon non démarré -``` -❌ Docker daemon n'est pas en cours d'exécution -``` -**Solution :** Démarrer le service Docker : `sudo systemctl start docker` - -#### 3. Fichier de configuration manquant -``` -❌ Fichier manquant: Configuration Bitcoin (/path/to/bitcoin.conf) -``` -**Solution :** Vérifier que tous les fichiers de configuration existent - -#### 4. Timeout de démarrage -``` -❌ Timeout: bitcoin-signet n'a pas démarré dans les temps -``` -**Solution :** Vérifier les logs : `docker logs bitcoin-signet` - -### Logs utiles - -```bash -# Logs d'un service spécifique -docker logs tor-proxy -docker logs bitcoin-signet -docker logs blindbit-oracle -docker logs sdk_relay_1 - -# Logs de tous les services -docker logs $(docker ps --format "{{.Names}}") - -# Statut des conteneurs -docker ps -a - -# Utilisation des ressources -docker stats -``` - -## 🔄 Maintenance - -### Mise à jour du script -1. Modifier les variables de configuration si nécessaire -2. Tester avec `./restart_4nk_node.sh -v` -3. Documenter les changements - -### Ajout de nouveaux services -1. Ajouter les variables de configuration -2. Créer une fonction de démarrage -3. Ajouter l'option correspondante -4. Mettre à jour la fonction de vérification - -## 📝 Historique - -- **v1.0** : Script initial basé sur les commandes manuelles -- **Fonctionnalités** : Redémarrage complet, options modulaires, gestion d'erreurs -- **Compatibilité** : Bash 4.0+, Docker 20.0+ - -## 🎯 Avantages - -1. **Automatisation** : Élimine les erreurs manuelles -2. **Reproductibilité** : Processus identique à chaque exécution -3. **Modularité** : Possibilité de démarrer des services individuels -4. **Robustesse** : Gestion d'erreurs et vérifications -5. **Visibilité** : Affichage coloré et informatif -6. **Maintenance** : Code structuré et documenté - - diff --git a/archive/docs/RESUME_AJOUT_DEV3.md b/archive/docs/RESUME_AJOUT_DEV3.md deleted file mode 100644 index 38cd78f5..00000000 --- a/archive/docs/RESUME_AJOUT_DEV3.md +++ /dev/null @@ -1,425 +0,0 @@ -# Résumé : Ajout du Relais dev3.4nkweb.com - -## 🎯 Objectif - -Ajouter le relais externe `dev3.4nkweb.com` à l'infrastructure 4NK Node pour étendre le réseau de relais. - -## ✅ Actions Réalisées - -### 1. Découverte du relais - -- **URL** : dev3.4nkweb.com -- **Port** : 443 (HTTPS/WSS) -- **Chemin WebSocket** : `/ws/` -- **URL complète** : `wss://dev3.4nkweb.com:443/ws/` - -### 2. Tests de connectivité - -```bash -# Test HTTPS de base -curl -v https://dev3.4nkweb.com:443 -# ✅ Réponse : Page HTML 4NK Web5 - -# Test WebSocket -curl -v -H "Connection: Upgrade" -H "Upgrade: websocket" \ - -H "Sec-WebSocket-Key: test" -H "Sec-WebSocket-Version: 13" \ - https://dev3.4nkweb.com:443/ws/ -# ✅ Réponse : 101 Switching Protocols -``` - -### 3. Tests Python - -```bash -# Test simple -python3 test_dev3_simple.py -# ✅ Connexion WSS établie -# ⚠️ Limitations de taille de message - -# Test complet -python3 test_dev3_connectivity.py -# ✅ Connexion WSS établie -# ❌ Messages trop gros pour la synchronisation -``` - -### 4. Configuration - -```toml -# external_nodes.conf -[relays] -dev3-relay = "dev3.4nkweb.com:443" -``` - -## 🚀 **ARRÊT ET REDÉMARRAGE COMPLET DE 4NK_NODE** - -### **Date** : $(date) -### **Motif** : Redémarrage propre pour intégrer dev3.4nkweb.com - -### **1. Arrêt de tous les services** - -```bash -# Arrêt de tous les conteneurs -docker stop $(docker ps -q) 2>/dev/null || true - -# Arrêt de docker-compose -docker-compose down -v 2>/dev/null || true - -# Vérification qu'aucun conteneur ne tourne -docker ps -# Output: (vide - aucun conteneur en cours) -``` - -### **2. Nettoyage complet** - -```bash -# Suppression de tous les conteneurs -docker rm -f $(docker ps -aq) 2>/dev/null || true -# Output: 38b00bb9a73d, 82832dff9e65, 27eb26cf34de, dcc0733ff65a, cf89e4d5d99a, 8f5815486a1d - -# Nettoyage des réseaux -docker network prune -f -# Output: Deleted Networks: 4nk_node_btcnet -``` - -### **3. Création du réseau** - -```bash -# Création du réseau Docker -docker network create 4nk_node_btcnet -# Output: 5242f77defc3539b050defd7e1a144e1e066b28010ae97ad6b4e4a1eb553bfe7 -``` - -### **4. Démarrage dans l'ordre logique** - -#### **4.1 Tor Proxy** -```bash -docker run -d --name tor-proxy --network 4nk_node_btcnet --network-alias tor \ - -p 9050:9050 -p 9051:9051 dperson/torproxy:latest -# Output: b2ae583570d4435cd5dcc41f44df8ff33445d4bf2bcbbfcdee0e0a239e7c3a28 -# Status: Up 9 seconds (health: starting) -``` - -#### **4.2 Bitcoin Core** -```bash -docker run -d --name bitcoin-signet --network 4nk_node_btcnet --network-alias bitcoin \ - -p 38333:38333 -p 18443:18443 -p 29000:29000 \ - -v bitcoin_data:/home/bitcoin/.bitcoin \ - -v /home/desk/Téléchargements/code/4NK/4NK_node/bitcoin/bitcoin.conf:/home/bitcoin/.bitcoin/bitcoin.conf \ - 4nk_node_bitcoin -# Output: 166a88e6817ecd680a41cf4a0a34b654df19fdd15ed408a53338ebb5bf4bbb98 -# Status: Up 17 seconds -``` - -#### **4.3 Blindbit Oracle** -```bash -docker run -d --name blindbit-oracle --network 4nk_node_btcnet --network-alias blindbit \ - -p 8000:8000 \ - -v blindbit_data:/data \ - -v /home/desk/Téléchargements/code/4NK/4NK_node/blindbit/blindbit.toml:/data/blindbit.toml \ - -v bitcoin_data:/home/bitcoin/.bitcoin \ - 4nk_node_blindbit -# Output: 34e41782e0633b140be2c2c330a1a769a6d1359938e1e5ea71b63153ab518422 -# Status: Up 16 seconds -``` - -#### **4.4 Construction de l'image sdk_relay** -```bash -# Construction de l'image avec les dernières modifications -docker build -f sdk_relay/Dockerfile -t 4nk_node_sdk_relay_1 .. -# Output: Successfully built 70c4624704d3 -# Output: Successfully tagged 4nk_node_sdk_relay_1:latest -# Temps: 43.55s (compilation Rust) -``` - -#### **4.5 Relay 1** -```bash -docker run -d --name sdk_relay_1 --network 4nk_node_btcnet --network-alias sdk_relay_1 \ - -p 8090:8090 -p 8091:8091 \ - -v bitcoin_data:/home/bitcoin/.bitcoin \ - -v /home/desk/Téléchargements/code/4NK/4NK_node/bitcoin/bitcoin.conf:/home/bitcoin/.bitcoin/bitcoin.conf \ - -v sdk_relay_1_data:/home/bitcoin/.4nk \ - -v /home/desk/Téléchargements/code/4NK/4NK_node/sdk_relay/.conf.docker.relay1:/home/bitcoin/.conf.docker \ - -e RUST_LOG=debug,bitcoincore_rpc=trace \ - -e HOME=/home/bitcoin \ - -e BITCOIN_COOKIE_PATH=/home/bitcoin/.bitcoin/signet/.cookie \ - -e ENABLE_SYNC_TEST=1 \ - 4nk_node_sdk_relay_1 \ - /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" -# Output: 2f8b0dd684e18cc2850a74238d673b012b29d875106ba5c94d08d8d17ea7d933 -# Status: Up 18 seconds -``` - -#### **4.6 Relay 2** -```bash -docker run -d --name sdk_relay_2 --network 4nk_node_btcnet --network-alias sdk_relay_2 \ - -p 8092:8090 -p 8093:8091 \ - -v bitcoin_data:/home/bitcoin/.bitcoin \ - -v /home/desk/Téléchargements/code/4NK/4NK_node/bitcoin/bitcoin.conf:/home/bitcoin/.bitcoin/bitcoin.conf \ - -v sdk_relay_2_data:/home/bitcoin/.4nk \ - -v /home/desk/Téléchargements/code/4NK/4NK_node/sdk_relay/.conf.docker.relay2:/home/bitcoin/.conf.docker \ - -e RUST_LOG=debug,bitcoincore_rpc=trace \ - -e HOME=/home/bitcoin \ - -e BITCOIN_COOKIE_PATH=/home/bitcoin/.bitcoin/signet/.cookie \ - -e ENABLE_SYNC_TEST=1 \ - 4nk_node_sdk_relay_1 \ - /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" -# Output: e8f2907a4ba38424787fd90427aa7f1ccf0d6fb5eb0f7dc434a0d6a0d9d1494f -# Status: Up 16 seconds -``` - -#### **4.7 Relay 3** -```bash -docker run -d --name sdk_relay_3 --network 4nk_node_btcnet --network-alias sdk_relay_3 \ - -p 8094:8090 -p 8095:8091 \ - -v bitcoin_data:/home/bitcoin/.bitcoin \ - -v /home/desk/Téléchargements/code/4NK/4NK_node/bitcoin/bitcoin.conf:/home/bitcoin/.bitcoin/bitcoin.conf \ - -v sdk_relay_3_data:/home/bitcoin/.4nk \ - -v /home/desk/Téléchargements/code/4NK/4NK_node/sdk_relay/.conf.docker.relay3:/home/bitcoin/.conf.docker \ - -e RUST_LOG=debug,bitcoincore_rpc=trace \ - -e HOME=/home/bitcoin \ - -e BITCOIN_COOKIE_PATH=/home/bitcoin/.bitcoin/signet/.cookie \ - -e ENABLE_SYNC_TEST=1 \ - 4nk_node_sdk_relay_1 \ - /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" -# Output: e969cb2ead8151e74dfd3cd8eabddcedac551c2a52f0377a182c3ffe15305b90 -# Status: Up 15 seconds -``` - -### **5. État final des services** - -```bash -docker ps -# Output: -# CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES -# e969cb2ead81 4nk_node_sdk_relay_1 "/bin/sh -c 'cp /hom…" 21 seconds ago Up 20 seconds 0.0.0.0:8094->8090/tcp, :::8094->8090/tcp, 0.0.0.0:8095->8091/tcp, :::8095->8091/tcp sdk_relay_3 -# e8f2907a4ba3 4nk_node_sdk_relay_1 "/bin/sh -c 'cp /hom…" 46 seconds ago Up 45 seconds 0.0.0.0:8092->8090/tcp, :::8092->8090/tcp, 0.0.0.0:8093->8091/tcp, :::8093->8091/tcp sdk_relay_2 -# 2f8b0dd684e1 4nk_node_sdk_relay_1 "/bin/sh -c 'cp /hom…" About a minute ago Up About a minute 0.0.0.0:8090-8091->8090-8091/tcp, :::8090-8091->8090-8091/tcp sdk_relay_1 -# 34e41782e063 4nk_node_blindbit "blindbit-oracle -da…" 3 minutes ago Up 3 minutes 0.0.0.0:8000->8000/tcp, :::8000->8000/tcp blindbit-oracle -# 166a88e6817e 4nk_node_bitcoin "bitcoind -conf=/hom…" 3 minutes ago Up 3 minutes 0.0.0.0:18443->18443/tcp, :::18443->18443/tcp, 0.0.0.0:29000->29000/tcp, :::29000->29000/tcp, 0.0.0.0:38333->38333/tcp, :::38333->38333/tcp, 38332/tcp bitcoin-signet -# b2ae583570d4 dperson/torproxy:latest "/sbin/tini -- /usr/…" 3 minutes ago Up 3 minutes (healthy) 8118/tcp, 0.0.0.0:9050-9051->9050-9051/tcp, :::9050-9051->9050-9051/tcp tor-proxy -``` - -### **6. Ports exposés** - -| Service | Ports Internes | Ports Externes | Statut | -|---------|----------------|----------------|---------| -| **Tor** | 9050, 9051 | 9050, 9051 | ✅ Healthy | -| **Bitcoin** | 38333, 18443, 29000 | 38333, 18443, 29000 | ✅ Running | -| **Blindbit** | 8000 | 8000 | ✅ Running | -| **Relay 1** | 8090, 8091 | 8090, 8091 | ✅ Running | -| **Relay 2** | 8090, 8091 | 8092, 8093 | ✅ Running | -| **Relay 3** | 8090, 8091 | 8094, 8095 | ✅ Running | - -### **7. Volumes persistants** - -| Volume | Contenu | Utilisé par | -|--------|---------|-------------| -| `bitcoin_data` | Données Bitcoin Core | Bitcoin, Blindbit, Relays | -| `blindbit_data` | Données Blindbit | Blindbit | -| `sdk_relay_1_data` | Données Relay 1 | Relay 1 | -| `sdk_relay_2_data` | Données Relay 2 | Relay 2 | -| `sdk_relay_3_data` | Données Relay 3 | Relay 3 | - -### **8. Configuration des relais** - -Chaque relay utilise sa propre configuration : -- **Relay 1** : `.conf.docker.relay1` → `relay_id = "relay-1"` -- **Relay 2** : `.conf.docker.relay2` → `relay_id = "relay-2"` -- **Relay 3** : `.conf.docker.relay3` → `relay_id = "relay-3"` - -### **9. Variables d'environnement communes** - -```bash -RUST_LOG=debug,bitcoincore_rpc=trace -HOME=/home/bitcoin -BITCOIN_COOKIE_PATH=/home/bitcoin/.bitcoin/signet/.cookie -ENABLE_SYNC_TEST=1 -``` - -### **10. Commandes de démarrage automatiques** - -Chaque relay exécute automatiquement : -```bash -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 -``` - -## 📊 Résultats des Tests - -### ✅ Connectivité -- **HTTPS** : ✅ Accessible -- **WSS** : ✅ Accessible sur `/ws/` -- **SSL** : ✅ Certificat Let's Encrypt valide -- **Protocole** : TLSv1.3 - -### ⚠️ Limitations Découvertes -- **Taille des messages** : Limitée (erreur "message too big") -- **Synchronisation** : Non supportée (ancienne version) -- **Handshake** : Format ancien uniquement - -### 🔧 Compatibilité -- **Ancienne version** : ✅ Compatible -- **Nouvelle version** : ❌ Messages trop gros -- **Synchronisation** : ❌ Non supportée - -## 🛠️ Outils Créés - -### 1. Script de test simple -- **Fichier** : `test_dev3_simple.py` -- **Fonction** : Test de connectivité avec messages courts -- **Usage** : `python3 test_dev3_simple.py` - -### 2. Script de test complet -- **Fichier** : `test_dev3_connectivity.py` -- **Fonction** : Test de compatibilité ancienne/nouvelle version -- **Usage** : `python3 test_dev3_connectivity.py` - -### 3. Documentation de configuration -- **Fichier** : `CONFIGURATION_DEV3.md` -- **Contenu** : Guide complet d'utilisation et de dépannage - -## 🚀 Utilisation - -### Connexion WebSocket - -```javascript -// Connexion JavaScript -const ws = new WebSocket('wss://dev3.4nkweb.com:443/ws/'); - -ws.onopen = function() { - // Handshake simple (ancienne version) - const handshake = { - type: 'handshake', - client_id: 'test-client', - version: '0.9.0' - }; - ws.send(JSON.stringify(handshake)); -}; -``` - -### Connexion Python - -```python -import asyncio -import websockets -import json -import ssl - -async def connect_to_dev3(): - uri = "wss://dev3.4nkweb.com:443/ws/" - - ssl_context = ssl.create_default_context() - ssl_context.check_hostname = False - ssl_context.verify_mode = ssl.CERT_NONE - - async with websockets.connect(uri, ssl=ssl_context) as websocket: - handshake = { - "type": "handshake", - "client_id": "python-client", - "version": "0.9.0" - } - await websocket.send(json.dumps(handshake)) - -asyncio.run(connect_to_dev3()) -``` - -## 📈 État Actuel - -### Configuration Active -```bash -# Liste des nœuds externes -./add_external_node.sh list -# Output: -# 🔸 external-relay-2 -> localhost:8090 -# 🔸 dev3-relay -> dev3.4nkweb.com:443 -``` - -### Tests de Validation -```bash -# Test de connectivité -./add_external_node.sh test dev3-relay -# ✅ Port 443 accessible sur dev3.4nkweb.com -# ✅ WebSocket répond -# ✅ Connectivité OK -``` - -## 🔄 Prochaines Étapes - -### 1. Intégration dans le code -Pour que les relais locaux utilisent dev3.4nkweb.com, il faut : - -```rust -// Modifier sync.rs pour charger external_nodes.conf -impl SyncManager { - pub fn load_external_config(&self) -> Result { - let config_content = fs::read_to_string("external_nodes.conf")?; - let config: ExternalConfig = toml::from_str(&config_content)?; - Ok(config) - } -} -``` - -### 2. Redémarrage des relais -```bash -# Appliquer la configuration -docker-compose restart sdk_relay_1 sdk_relay_2 sdk_relay_3 -``` - -### 3. Tests de synchronisation -```bash -# Tester la synchronisation avec dev3 -./test_sync_logs.sh test -``` - -## ⚠️ Limitations Actuelles - -### 1. Synchronisation -- Le relais dev3.4nkweb.com ne supporte pas la synchronisation -- Messages de sync trop gros pour l'ancienne version -- Nécessite une mise à jour du relais - -### 2. Messages -- Limitation de taille des messages -- Format ancien uniquement -- Pas de support des nouveaux protocoles - -### 3. Compatibilité -- Compatible avec l'ancienne version -- Incompatible avec la nouvelle version -- Nécessite adaptation des messages - -## 🎯 Recommandations - -### 1. Utilisation immédiate -- ✅ Utiliser pour les connexions basiques -- ✅ Compatible avec l'ancienne version -- ⚠️ Éviter les messages de synchronisation - -### 2. Amélioration future -- 🔄 Mettre à jour le relais dev3.4nkweb.com -- 🔄 Supprimer les limitations de taille -- 🔄 Ajouter le support de la synchronisation - -### 3. Monitoring -- 📊 Surveiller la connectivité -- 📊 Tester régulièrement -- 📊 Documenter les changements - -## 📝 Conclusion - -Le relais `dev3.4nkweb.com` a été **ajouté avec succès** à la configuration externe. Il est : - -- ✅ **Accessible** en WSS sur le port 443 -- ✅ **Fonctionnel** pour les connexions basiques -- ⚠️ **Limité** par l'ancienne version -- 🔄 **Prêt** pour une future mise à jour - -La configuration est maintenant prête pour l'intégration dans le code et les tests de synchronisation ! - -**L'infrastructure 4NK Node est maintenant complètement redémarrée et opérationnelle avec :** -- ✅ **6 services** en cours d'exécution -- ✅ **3 relais** configurés pour la synchronisation -- ✅ **Configuration externe** prête pour dev3.4nkweb.com -- ✅ **Tous les ports** correctement exposés -- ✅ **Volumes persistants** préservés diff --git a/archive/docs/RESUME_DECOUVERTE_NOEUDS.md b/archive/docs/RESUME_DECOUVERTE_NOEUDS.md deleted file mode 100644 index 65631bda..00000000 --- a/archive/docs/RESUME_DECOUVERTE_NOEUDS.md +++ /dev/null @@ -1,208 +0,0 @@ -# Résumé : Découverte des Nœuds et Ajout de Nœuds Externes - -## 🔍 Comment les relais découvrent-ils initialement les autres nœuds ? - -### Mécanisme actuel (Découverte statique) - -Les relais `sdk_relay` utilisent actuellement une **découverte statique** basée sur les noms de conteneurs Docker : - -```rust -// Dans sync.rs - discover_relays() -let relay_hosts = vec![ - "sdk_relay_1", - "sdk_relay_2", - "sdk_relay_3", -]; -``` - -**Processus de découverte :** -1. ✅ **Liste prédéfinie** : Chaque relais a une liste codée en dur des autres relais -2. ✅ **Auto-exclusion** : Il ignore son propre `relay_id` -3. ✅ **Connexion automatique** : Il tente de se connecter à chaque relais de la liste -4. ✅ **Partage de liste** : Une fois connectés, ils partagent leur liste via des messages `RelaySync` - -### Configuration par relay_id - -Chaque relais a un identifiant unique : -```toml -# .conf.docker.relay1 -relay_id=relay-1 - -# .conf.docker.relay2 -relay_id=relay-2 - -# .conf.docker.relay3 -relay_id=relay-3 -``` - -## 🌐 Comment ajouter un nœud externe ? - -### ✅ Solution implémentée : Configuration externe - -Nous avons créé un **système de configuration externe** qui permet d'ajouter des nœuds sans modifier le code : - -#### 1. Fichier de configuration `external_nodes.conf` - -```toml -[relays] -external-relay-1 = "external-relay-1.example.com:8090" -external-relay-2 = "192.168.1.100:8090" - -[discovery] -auto_discover = true -bootstrap_nodes = [] - -[security] -allowed_domains = [ - "*.4nk.net", - "*.example.com", - "localhost", - "127.0.0.1" -] -``` - -#### 2. Script d'administration `add_external_node.sh` - -**Commandes disponibles :** -```bash -# Ajouter un nœud externe -./add_external_node.sh add external-relay-1 external-relay-1.example.com:8090 - -# Supprimer un nœud externe -./add_external_node.sh remove external-relay-1 - -# Lister tous les nœuds externes -./add_external_node.sh list - -# Tester la connectivité -./add_external_node.sh test external-relay-1 - -# Valider une adresse -./add_external_node.sh validate 192.168.1.100:8090 -``` - -#### 3. Exemple d'utilisation - -```bash -# Ajouter un nœud externe -./add_external_node.sh add external-relay-1 external-relay-1.example.com:8090 - -# Vérifier la liste -./add_external_node.sh list -# Output: -# ℹ️ Nœuds externes configurés: -# 🔸 external-relay-1 -> external-relay-1.example.com:8090 - -# Redémarrer les relais pour appliquer -docker-compose restart sdk_relay_1 sdk_relay_2 sdk_relay_3 -``` - -## 🔧 Modifications nécessaires dans le code - -### Pour supporter les nœuds externes, il faut modifier `sync.rs` : - -```rust -impl SyncManager { - pub fn load_external_config(&self) -> Result { - let config_content = fs::read_to_string("external_nodes.conf")?; - let config: ExternalConfig = toml::from_str(&config_content)?; - Ok(config) - } - - pub async fn discover_relays(&self) -> Result<()> { - // Découverte locale (existante) - let local_hosts = vec!["sdk_relay_1", "sdk_relay_2", "sdk_relay_3"]; - for host in local_hosts { - // ... logique existante - } - - // Découverte externe (nouvelle) - if let Ok(config) = self.load_external_config() { - for (relay_id, address) in &config.relays { - let relay_info = RelayInfo { - relay_id: relay_id.clone(), - address: address.clone(), - // ... autres champs - }; - self.add_relay(relay_info)?; - } - } - - Ok(()) - } -} -``` - -## 🛡️ Sécurité et validation - -### Validation des nœuds externes - -Le script inclut des validations : -- ✅ **Format d'adresse** : `hostname:port` ou `ip:port` -- ✅ **Port valide** : Entre 1 et 65535 -- ✅ **Connectivité** : Test de connexion TCP -- ✅ **WebSocket** : Test de réponse WebSocket -- ✅ **Domaines autorisés** : Contrôle des domaines autorisés - -### Gestion des erreurs - -```bash -# Test de connectivité échoué -❌ Impossible de se connecter à external-relay-1.example.com:8090 -⚠️ Connectivité échouée - le nœud sera testé au prochain redémarrage - -# Test de connectivité réussi -✅ Port 8090 accessible sur localhost -✅ WebSocket répond -``` - -## 📊 Avantages de cette approche - -### ✅ **Flexibilité** -- Ajout de nœuds sans recompilation -- Configuration par fichier -- Gestion dynamique - -### ✅ **Sécurité** -- Contrôle des domaines autorisés -- Validation des adresses -- Tests de connectivité - -### ✅ **Simplicité** -- Script d'administration simple -- Configuration TOML lisible -- Commandes intuitives - -### ✅ **Évolutivité** -- Support pour la découverte automatique -- Architecture extensible -- Compatible avec les futures améliorations - -## 🚀 Prochaines étapes - -### 1. Implémentation dans le code -- [ ] Modifier `sync.rs` pour charger `external_nodes.conf` -- [ ] Ajouter la validation des nœuds externes -- [ ] Tester avec des nœuds externes réels - -### 2. Améliorations futures -- [ ] Découverte via DNS (enregistrements SRV) -- [ ] API REST pour l'enregistrement -- [ ] Découverte automatique via bootstrap nodes -- [ ] Chiffrement des communications - -### 3. Tests et validation -- [ ] Tests avec des nœuds externes -- [ ] Validation de la synchronisation -- [ ] Tests de sécurité - -## 📝 Conclusion - -1. **Découverte initiale** : Les relais utilisent une liste prédéfinie de noms de conteneurs Docker -2. **Ajout de nœuds externes** : Nous avons créé un système de configuration externe avec un script d'administration - -**Solution recommandée :** Utiliser le script `add_external_node.sh` pour gérer les nœuds externes de manière flexible et sécurisée, sans modifier le code source. - -Le système est maintenant prêt pour l'ajout de nœuds externes ! 🎉 - - diff --git a/archive/docs/RESUME_SCRIPT_RESTART.md b/archive/docs/RESUME_SCRIPT_RESTART.md deleted file mode 100644 index b930239b..00000000 --- a/archive/docs/RESUME_SCRIPT_RESTART.md +++ /dev/null @@ -1,226 +0,0 @@ -# Résumé : Transformation des Commandes en Script Automatisé - -## 🎯 Objectif - -Transformer les commandes manuelles de redémarrage de 4NK Node en un script automatisé robuste et réutilisable. - -## ✅ Réalisations - -### 1. **Script de redémarrage automatisé** - -**Fichier créé :** `restart_4nk_node.sh` - -#### Fonctionnalités principales : -- ✅ **Redémarrage complet** en une seule commande -- ✅ **Options modulaires** pour démarrer des services individuels -- ✅ **Gestion d'erreurs** robuste avec vérifications -- ✅ **Affichage coloré** pour une meilleure lisibilité -- ✅ **Vérifications automatiques** de l'état des services -- ✅ **Documentation intégrée** avec aide contextuelle - -### 2. **Variables et configuration** - -#### Images Docker -```bash -TOR_IMAGE="dperson/torproxy:latest" -BITCOIN_IMAGE="4nk_node_bitcoin" -BLINDBIT_IMAGE="4nk_node_blindbit" -RELAY_IMAGE="4nk_node_sdk_relay_1" -``` - -#### Réseau et volumes -```bash -NETWORK_NAME="4nk_node_btcnet" -BITCOIN_VOLUME="bitcoin_data" -BLINDBIT_VOLUME="blindbit_data" -RELAY_1_VOLUME="sdk_relay_1_data" -RELAY_2_VOLUME="sdk_relay_2_data" -RELAY_3_VOLUME="sdk_relay_3_data" -``` - -#### Ports exposés -```bash -TOR_PORTS=("9050:9050" "9051:9051") -BITCOIN_PORTS=("38333:38333" "18443:18443" "29000:29000") -BLINDBIT_PORTS=("8000:8000") -RELAY_1_PORTS=("8090:8090" "8091:8091") -RELAY_2_PORTS=("8092:8090" "8093:8091") -RELAY_3_PORTS=("8094:8090" "8095:8091") -``` - -### 3. **Fonctions utilitaires** - -#### Gestion de l'affichage -- `print_header()` : En-têtes colorés -- `print_step()` : Étapes en cours -- `print_success()` : Succès en vert -- `print_error()` : Erreurs en rouge -- `print_warning()` : Avertissements en jaune -- `print_info()` : Informations en violet - -#### Vérifications automatiques -- `wait_for_container()` : Attente du démarrage des conteneurs -- `check_file_exists()` : Vérification des fichiers de configuration -- `build_port_mapping()` : Construction des mappings de ports -- `build_env_vars()` : Construction des variables d'environnement - -### 4. **Fonctions principales** - -#### Gestion des services -- `stop_all_services()` : Arrêt de tous les services -- `cleanup_containers()` : Nettoyage des conteneurs -- `create_network()` : Création du réseau Docker -- `start_tor()` : Démarrage de Tor Proxy -- `start_bitcoin()` : Démarrage de Bitcoin Core -- `start_blindbit()` : Démarrage de Blindbit Oracle -- `build_relay_image()` : Construction de l'image sdk_relay -- `start_relay()` : Démarrage d'un relay spécifique -- `start_all_relays()` : Démarrage de tous les relais -- `verify_final_status()` : Vérification finale - -## 🚀 Utilisation - -### Redémarrage complet -```bash -./restart_4nk_node.sh -``` - -### Options disponibles -```bash -./restart_4nk_node.sh -h # Aide -./restart_4nk_node.sh -s # Arrêter -./restart_4nk_node.sh -c # Nettoyer -./restart_4nk_node.sh -n # Créer réseau -./restart_4nk_node.sh -t # Démarrer Tor -./restart_4nk_node.sh -b # Démarrer Bitcoin -./restart_4nk_node.sh -l # Démarrer Blindbit -./restart_4nk_node.sh -r # Démarrer relais -./restart_4nk_node.sh -v # Vérifier statut -``` - -## 📊 Avantages de l'automatisation - -### 1. **Réduction des erreurs** -- ❌ **Avant** : Commandes manuelles sujettes aux erreurs -- ✅ **Après** : Processus automatisé et reproductible - -### 2. **Gain de temps** -- ❌ **Avant** : 10-15 minutes de commandes manuelles -- ✅ **Après** : 1 commande, processus automatisé - -### 3. **Visibilité améliorée** -- ❌ **Avant** : Sortie brute des commandes -- ✅ **Après** : Affichage coloré et structuré - -### 4. **Gestion d'erreurs** -- ❌ **Avant** : Erreurs difficiles à diagnostiquer -- ✅ **Après** : Vérifications automatiques et messages d'erreur clairs - -### 5. **Flexibilité** -- ❌ **Avant** : Processus tout ou rien -- ✅ **Après** : Options modulaires pour des opérations partielles - -## 🔧 Fonctionnalités avancées - -### 1. **Gestion des timeouts** -```bash -wait_for_container "bitcoin-signet" 15 # Attendre 15 tentatives -``` - -### 2. **Vérification des fichiers** -```bash -check_file_exists "$BITCOIN_CONF" "Configuration Bitcoin" -``` - -### 3. **Construction dynamique des commandes** -```bash -local ports_mapping=$(build_port_mapping "${BITCOIN_PORTS[@]}") -local env_vars=$(build_env_vars) -``` - -### 4. **Statut en temps réel** -```bash -docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}" -``` - -## 📝 Documentation créée - -### 1. **Script principal** -- `restart_4nk_node.sh` : Script automatisé complet - -### 2. **Documentation utilisateur** -- `README_RESTART_SCRIPT.md` : Guide complet d'utilisation - -### 3. **Documentation technique** -- `COMMANDES_REDEMARRAGE.md` : Commandes exactes utilisées - -### 4. **Résumé des actions** -- `RESUME_AJOUT_DEV3.md` : Documentation du redémarrage manuel - -## 🎯 Résultats des tests - -### Test de l'aide -```bash -./restart_4nk_node.sh -h -# ✅ Affichage correct de l'aide avec toutes les options -``` - -### Test de vérification -```bash -./restart_4nk_node.sh -v -# ✅ Vérification correcte de tous les services -# ✅ Affichage du statut de 6/6 services actifs -``` - -## 🔄 Maintenance et évolution - -### 1. **Ajout de nouveaux services** -1. Ajouter les variables de configuration -2. Créer une fonction de démarrage -3. Ajouter l'option correspondante -4. Mettre à jour la fonction de vérification - -### 2. **Modification de la configuration** -1. Modifier les variables en haut du script -2. Tester avec `./restart_4nk_node.sh -v` -3. Documenter les changements - -### 3. **Débogage** -```bash -# Logs détaillés -docker logs - -# Statut des conteneurs -docker ps -a - -# Utilisation des ressources -docker stats -``` - -## 📈 Métriques - -### Avant l'automatisation -- **Temps de redémarrage** : 10-15 minutes -- **Commandes manuelles** : 15+ commandes -- **Risque d'erreur** : Élevé -- **Documentation** : Manuelle - -### Après l'automatisation -- **Temps de redémarrage** : 1 commande -- **Commandes manuelles** : 0 -- **Risque d'erreur** : Faible -- **Documentation** : Intégrée - -## 🎉 Conclusion - -La transformation des commandes manuelles en script automatisé a été un **succès complet** : - -✅ **Script fonctionnel** avec toutes les fonctionnalités -✅ **Documentation complète** pour l'utilisation et la maintenance -✅ **Gestion d'erreurs robuste** avec vérifications automatiques -✅ **Interface utilisateur intuitive** avec options modulaires -✅ **Code maintenable** et extensible - -L'infrastructure 4NK Node dispose maintenant d'un outil de redémarrage **professionnel, robuste et facile à utiliser** ! - - diff --git a/archive/docs/RESUME_TEST_3_RELAIS.md b/archive/docs/RESUME_TEST_3_RELAIS.md deleted file mode 100644 index d0bf5bc0..00000000 --- a/archive/docs/RESUME_TEST_3_RELAIS.md +++ /dev/null @@ -1,161 +0,0 @@ -# Résumé - Test de Synchronisation avec 3 Relais - -## 🎯 Objectif Atteint - -✅ **Implémentation réussie de la synchronisation entre 3 relais** dans le réseau 4NK avec architecture mesh. - -## 🏗️ Architecture Implémentée - -### 1. **Infrastructure Docker** -- **3 relais** : `sdk_relay_1`, `sdk_relay_2`, `sdk_relay_3` -- **Services de base** : Tor, Bitcoin Core (signet), Blindbit -- **Réseau** : `4nk_node_btcnet` (Docker network) -- **Ports** : 8090, 8091, 8092 (WebSocket) - -### 2. **Configuration des Relais** -- **Relais 1** : `relay-1` (port 8090) -- **Relais 2** : `relay-2` (port 8091) -- **Relais 3** : `relay-3` (port 8092) -- **Configurations** : `.conf.docker.relay1/2/3` - -### 3. **Système de Synchronisation** -- **SyncManager** : Gestionnaire central de synchronisation -- **Types de sync** : 11 types (State, Process, Member, Tx, Block, Peer, Relay, Health, Metrics, Config, Capability) -- **Cache de déduplication** : Évite les doublons de messages -- **Découverte automatique** : Les relais se découvrent mutuellement - -## 📁 Fichiers Créés/Modifiés - -### Scripts de Démarrage -- `start_3_relays_docker.sh` : Démarrage des 3 relais avec Docker -- `monitor_sync.sh` : Surveillance de la synchronisation -- `test_3_relays.sh` : Script de test complet - -### Configurations -- `.conf.docker.relay1` : Configuration relais 1 -- `.conf.docker.relay2` : Configuration relais 2 -- `.conf.docker.relay3` : Configuration relais 3 - -### Documentation -- `specs/spec-technique.md` : Spécification technique complète -- `RESUME_TEST_3_RELAIS.md` : Ce résumé - -## 🔧 Fonctionnalités Implémentées - -### 1. **Synchronisation Périodique** -- **État** : Toutes les 30 secondes -- **Santé** : Toutes les 60 secondes -- **Métriques** : Toutes les 120 secondes -- **Relais** : Toutes les 300 secondes (5 minutes) - -### 2. **Découverte de Relais** -- **Automatique** : Découverte après 10 secondes de démarrage -- **Mesh** : Chaque relais partage sa liste avec les autres -- **Évite les doublons** : Ne s'ajoute pas lui-même - -### 3. **Cache de Déduplication** -- **Messages** : Évite les doublons basés sur l'ID et le timestamp -- **Nettoyage** : Suppression automatique des anciens messages -- **Performance** : Optimisé pour de gros volumes - -### 4. **Métriques de Synchronisation** -- **Relais connus** : Nombre de relais découverts -- **Connexions mesh** : État des connexions -- **Latence** : Temps de réponse moyen -- **Erreurs** : Compteur d'erreurs de synchronisation - -## 🚀 État Actuel - -### ✅ **Services Démarrés** -``` -tor-proxy ✅ Démarré -bitcoin-signet ✅ Démarré (IBD en cours) -blindbit-oracle ✅ Démarré -sdk_relay_1 ✅ Démarré -sdk_relay_2 ✅ Démarré -sdk_relay_3 ✅ Démarré -``` - -### 🔄 **Progression Bitcoin** -- **Relais 1** : ~105685 blocs restants -- **Relais 2** : ~105685 blocs restants -- **Relais 3** : ~105685 blocs restants -- **Statut** : Téléchargement actif (IBD) - -### 🌐 **Connectivité** -- **Réseau Docker** : ✅ Opérationnel -- **Bitcoin Core** : ✅ Accessible via RPC -- **Blindbit** : ✅ Accessible via HTTP -- **WebSocket** : ✅ Ports exposés - -## 📊 Prochaines Étapes - -### 1. **Attendre la Fin de l'IBD** -- Bitcoin Core termine le téléchargement (~30-60 minutes) -- Les relais commencent la synchronisation active - -### 2. **Tester la Synchronisation** -```bash -./monitor_sync.sh -``` - -### 3. **Vérifier les Fonctionnalités** -- Découverte automatique des relais -- Partage de la liste des relais -- Synchronisation des données -- Cache de déduplication - -### 4. **Optimisations Futures** -- Signature des messages pour la sécurité -- Fusion des données entre relais -- Optimisation des performances -- Tests de charge - -## 🎉 Résultats - -### ✅ **Réalisations** -- **3 relais opérationnels** avec synchronisation -- **Architecture mesh** fonctionnelle -- **Système de découverte** automatique -- **Cache de déduplication** efficace -- **Métriques complètes** de synchronisation - -### 🔧 **Technologies Utilisées** -- **Docker** : Orchestration des conteneurs -- **Rust** : Implémentation des relais -- **Bitcoin Core** : Blockchain signet -- **WebSocket** : Communication temps réel -- **JSON-RPC** : API Bitcoin - -### 📈 **Scalabilité** -- **Architecture modulaire** : Facile d'ajouter des relais -- **Réseau mesh** : Redondance et résilience -- **Cache intelligent** : Performance optimisée -- **Métriques** : Monitoring en temps réel - -## 🚀 Commandes Utiles - -```bash -# Surveiller la synchronisation -./monitor_sync.sh - -# Voir les logs d'un relais -docker logs sdk_relay_1 - -# Vérifier l'état des services -docker ps - -# Arrêter tous les services -docker-compose down - -# Redémarrer un relais -docker restart sdk_relay_1 -``` - ---- - -**Status** : ✅ **IMPLÉMENTATION RÉUSSIE** - 3 relais opérationnels avec synchronisation mesh -**Prochaine étape** : Attendre la fin de l'IBD Bitcoin et tester la synchronisation active - - - diff --git a/archive/docs/explain_node_discovery.md b/archive/docs/explain_node_discovery.md deleted file mode 100644 index 0e7cb2ca..00000000 --- a/archive/docs/explain_node_discovery.md +++ /dev/null @@ -1,379 +0,0 @@ -# Découverte des Nœuds et Ajout de Nœuds Externes - -## Comment les relais découvrent-ils initialement les autres nœuds ? - -### 1. Découverte automatique (actuelle) - -Actuellement, les relais utilisent une **découverte statique** basée sur les noms de conteneurs Docker : - -```rust -// Dans sync.rs - discover_relays() -let relay_hosts = vec![ - "sdk_relay_1", - "sdk_relay_2", - "sdk_relay_3", -]; -``` - -**Mécanisme :** -1. Chaque relais a une liste prédéfinie des autres relais -2. Au démarrage, il tente de se connecter à chaque relais de la liste -3. Il ignore son propre nom (`relay_id`) -4. Il ajoute les relais découverts à sa liste `known_relays` - -### 2. Configuration par relay_id - -Chaque relais a un `relay_id` unique dans sa configuration : - -```toml -# .conf.docker.relay1 -relay_id=relay-1 - -# .conf.docker.relay2 -relay_id=relay-2 - -# .conf.docker.relay3 -relay_id=relay-3 -``` - -### 3. Partage de la liste des relais - -Une fois connectés, les relais partagent leur liste de relais connus via des messages `RelaySync` : - -```rust -// Création d'un message RelaySync -pub fn create_relay_sync(&self) -> Result { - let known_relays = self.known_relays.lock().unwrap(); - let relays: Vec = known_relays.values().cloned().collect(); - - let payload = SyncPayload::RelayData { - relays, - network_topology, - }; - - Ok(SyncMessage::new(SyncType::RelaySync, self.relay_id.clone(), payload)) -} -``` - -## Comment ajouter un nœud externe ? - -### Option 1: Modification de la liste statique - -**Pour ajouter un nœud externe, il faut modifier le code source :** - -```rust -// Dans sync.rs - discover_relays() -let relay_hosts = vec![ - "sdk_relay_1", - "sdk_relay_2", - "sdk_relay_3", - "external-relay-1", // ← Nouveau nœud externe - "external-relay-2", // ← Autre nœud externe -]; -``` - -**Avantages :** -- Simple à implémenter -- Contrôle total sur les nœuds autorisés - -**Inconvénients :** -- Nécessite une recompilation -- Pas flexible pour l'ajout dynamique -- Centralisé - -### Option 2: Configuration externe (recommandée) - -**Créer un fichier de configuration pour les nœuds externes :** - -```toml -# external_nodes.conf -[relays] -external-relay-1 = "external-relay-1.example.com:8090" -external-relay-2 = "external-relay-2.example.com:8090" -external-relay-3 = "192.168.1.100:8090" - -[discovery] -auto_discover = true -bootstrap_nodes = [ - "bootstrap-1.4nk.net:8090", - "bootstrap-2.4nk.net:8090" -] -``` - -**Modification du code pour supporter la configuration :** - -```rust -pub struct DiscoveryConfig { - pub external_relays: HashMap, - pub auto_discover: bool, - pub bootstrap_nodes: Vec, -} - -impl SyncManager { - pub fn load_discovery_config(&self) -> Result { - // Charger depuis external_nodes.conf - } - - pub async fn discover_relays(&self) -> Result<()> { - let config = self.load_discovery_config()?; - - // Découverte locale (Docker) - for host in &["sdk_relay_1", "sdk_relay_2", "sdk_relay_3"] { - // ... logique existante - } - - // Découverte externe - for (relay_id, address) in &config.external_relays { - let relay_info = RelayInfo { - relay_id: relay_id.clone(), - address: address.clone(), - // ... autres champs - }; - self.add_relay(relay_info)?; - } - - // Découverte via bootstrap nodes - if config.auto_discover { - for bootstrap in &config.bootstrap_nodes { - self.discover_via_bootstrap(bootstrap).await?; - } - } - - Ok(()) - } -} -``` - -### Option 3: Découverte via DNS - -**Utiliser des enregistrements DNS pour la découverte :** - -```rust -pub async fn discover_via_dns(&self, domain: &str) -> Result<()> { - // Résoudre les enregistrements SRV ou A - let addresses = dns_lookup::get_host_addresses(domain)?; - - for addr in addresses { - let relay_info = RelayInfo { - relay_id: format!("relay-{}", addr), - address: format!("{}:8090", addr), - // ... autres champs - }; - self.add_relay(relay_info)?; - } - - Ok(()) -} -``` - -### Option 4: Découverte via API REST - -**Créer une API pour l'enregistrement des nœuds :** - -```rust -// Endpoint pour enregistrer un nouveau nœud -POST /api/relays/register -{ - "relay_id": "external-relay-1", - "address": "external-relay-1.example.com:8090", - "capabilities": ["sync", "mesh"], - "version": "1.0.0" -} - -// Endpoint pour récupérer la liste des nœuds -GET /api/relays/list -``` - -## Implémentation recommandée - -### 1. Créer un fichier de configuration externe - -```bash -# Créer le fichier de configuration -cat > 4NK/4NK_node/sdk_relay/external_nodes.conf << EOF -[relays] -# Nœuds externes connus -external-relay-1 = "external-relay-1.example.com:8090" -external-relay-2 = "192.168.1.100:8090" - -[discovery] -auto_discover = true -bootstrap_nodes = [ - "bootstrap-1.4nk.net:8090" -] - -[security] -allowed_domains = [ - "*.4nk.net", - "*.example.com" -] -EOF -``` - -### 2. Modifier le code pour supporter la configuration - -```rust -// Dans sync.rs -use std::fs; -use toml; - -#[derive(Debug, Deserialize)] -struct ExternalConfig { - relays: HashMap, - discovery: DiscoverySettings, - security: SecuritySettings, -} - -#[derive(Debug, Deserialize)] -struct DiscoverySettings { - auto_discover: bool, - bootstrap_nodes: Vec, -} - -#[derive(Debug, Deserialize)] -struct SecuritySettings { - allowed_domains: Vec, -} - -impl SyncManager { - pub fn load_external_config(&self) -> Result { - let config_content = fs::read_to_string("external_nodes.conf")?; - let config: ExternalConfig = toml::from_str(&config_content)?; - Ok(config) - } - - pub async fn discover_relays(&self) -> Result<()> { - // Découverte locale (existante) - let local_hosts = vec!["sdk_relay_1", "sdk_relay_2", "sdk_relay_3"]; - for host in local_hosts { - // ... logique existante - } - - // Découverte externe (nouvelle) - if let Ok(config) = self.load_external_config() { - for (relay_id, address) in &config.relays { - let relay_info = RelayInfo { - relay_id: relay_id.clone(), - address: address.clone(), - sp_address: "".to_string(), - version: "1.0.0".to_string(), - uptime: 0, - last_seen: SystemTime::now().duration_since(UNIX_EPOCH)?.as_secs(), - capabilities: vec!["sync".to_string(), "mesh".to_string()], - health_status: HealthStatus::Healthy, - }; - self.add_relay(relay_info)?; - } - } - - Ok(()) - } -} -``` - -### 3. Script pour ajouter un nœud externe - -```bash -#!/bin/bash -# add_external_node.sh - -RELAY_ID=$1 -ADDRESS=$2 -CONFIG_FILE="4NK/4NK_node/sdk_relay/external_nodes.conf" - -if [ -z "$RELAY_ID" ] || [ -z "$ADDRESS" ]; then - echo "Usage: $0 " - echo "Example: $0 external-relay-1 external-relay-1.example.com:8090" - exit 1 -fi - -# Ajouter le nœud à la configuration -echo "Adding external node: $RELAY_ID -> $ADDRESS" - -# Vérifier si le fichier existe -if [ ! -f "$CONFIG_FILE" ]; then - cat > "$CONFIG_FILE" << EOF -[relays] - -[discovery] -auto_discover = true -bootstrap_nodes = [] - -[security] -allowed_domains = ["*.4nk.net"] -EOF -fi - -# Ajouter le nœud -sed -i "/^\[relays\]$/a $RELAY_ID = \"$ADDRESS\"" "$CONFIG_FILE" - -echo "✅ External node added successfully!" -echo "🔄 Restart relays to apply changes:" -echo " docker-compose restart sdk_relay_1 sdk_relay_2 sdk_relay_3" -``` - -## Sécurité et validation - -### Validation des nœuds externes - -```rust -impl SyncManager { - pub fn validate_external_relay(&self, relay_info: &RelayInfo) -> Result { - // Vérifier le format de l'adresse - if !self.is_valid_address(&relay_info.address) { - return Ok(false); - } - - // Vérifier le domaine autorisé - if !self.is_allowed_domain(&relay_info.address) { - return Ok(false); - } - - // Vérifier la connectivité - if !self.can_connect_to_relay(&relay_info.address).await? { - return Ok(false); - } - - Ok(true) - } - - pub async fn can_connect_to_relay(&self, address: &str) -> Result { - // Test de connectivité WebSocket - // ... logique de test - } -} -``` - -### Gestion des nœuds malveillants - -```rust -impl SyncManager { - pub fn blacklist_relay(&self, relay_id: &str, reason: &str) { - // Ajouter à la liste noire - // Arrêter les connexions - // Notifier les autres relais - } - - pub fn rate_limit_relay(&self, relay_id: &str) { - // Limiter le nombre de messages - // Surveiller les comportements suspects - } -} -``` - -## Conclusion - -**Recommandation :** Utiliser l'**Option 2 (Configuration externe)** car elle offre : - -1. **Flexibilité** : Ajout de nœuds sans recompilation -2. **Sécurité** : Contrôle des domaines autorisés -3. **Évolutivité** : Support pour la découverte automatique -4. **Simplicité** : Configuration par fichier - -**Prochaines étapes :** -1. Implémenter le support de `external_nodes.conf` -2. Créer le script `add_external_node.sh` -3. Ajouter la validation et la sécurité -4. Tester avec des nœuds externes - - diff --git a/docs/templates/API.md b/docs/templates/API.md deleted file mode 100644 index 431560f3..00000000 --- a/docs/templates/API.md +++ /dev/null @@ -1,8 +0,0 @@ -# Référence API — Template - -- Vue d’ensemble -- Authentification/permissions -- Endpoints par domaine (schémas, invariants) -- Codes d’erreur -- Limites et quotas -- Sécurité et conformité diff --git a/docs/templates/ARCHITECTURE.md b/docs/templates/ARCHITECTURE.md deleted file mode 100644 index 42b78b2d..00000000 --- a/docs/templates/ARCHITECTURE.md +++ /dev/null @@ -1,8 +0,0 @@ -# Architecture — Template - -- Contexte et objectifs -- Découpage en couches (UI, services, données) -- Flux principaux -- Observabilité -- CI/CD -- Contraintes et SLA diff --git a/docs/templates/CONFIGURATION.md b/docs/templates/CONFIGURATION.md deleted file mode 100644 index 3506069d..00000000 --- a/docs/templates/CONFIGURATION.md +++ /dev/null @@ -1,6 +0,0 @@ -# Configuration — Template - -- Variables d’environnement (nom, type, défaut, portée) -- Fichiers de configuration (format, validation) -- Réseau et sécurité (ports, TLS, auth) -- Observabilité (logs, métriques, traces) diff --git a/docs/templates/INDEX.md b/docs/templates/INDEX.md deleted file mode 100644 index be566c0c..00000000 --- a/docs/templates/INDEX.md +++ /dev/null @@ -1,12 +0,0 @@ -# Index — Templates de documentation (pour projets dérivés) - -Utilisez ces squelettes pour démarrer la documentation de votre projet. - -- API.md — squelette de référence API -- ARCHITECTURE.md — squelette d’architecture -- CONFIGURATION.md — squelette de configuration -- USAGE.md — squelette d’usage -- TESTING.md — squelette de stratégie de tests -- SECURITY_AUDIT.md — squelette d’audit sécurité -- RELEASE_PLAN.md — squelette de plan de release -- OPEN_SOURCE_CHECKLIST.md — squelette de checklist open source diff --git a/docs/templates/OPEN_SOURCE_CHECKLIST.md b/docs/templates/OPEN_SOURCE_CHECKLIST.md deleted file mode 100644 index 8406e387..00000000 --- a/docs/templates/OPEN_SOURCE_CHECKLIST.md +++ /dev/null @@ -1,7 +0,0 @@ -# Checklist open source — Template - -- Gouvernance: LICENSE, CONTRIBUTING, CODE_OF_CONDUCT -- CI/CD: workflows, tests, security-audit, release-guard -- Documentation: README, INDEX, guides essentiels -- Sécurité: secrets, permissions, audit -- Publication: tag, changelog, release notes diff --git a/docs/templates/README.md b/docs/templates/README.md deleted file mode 100644 index fe4d4bb7..00000000 --- a/docs/templates/README.md +++ /dev/null @@ -1,29 +0,0 @@ -# README — Template de projet - -## Présentation - -Décrivez brièvement l’objectif du projet, son périmètre et ses utilisateurs cibles. - -## Démarrage rapide - -- Prérequis (langages/outils) -- Étapes d’installation -- Commandes de démarrage - -## Documentation - -- Index: `docs/INDEX.md` -- Architecture: `docs/ARCHITECTURE.md` -- Configuration: `docs/CONFIGURATION.md` -- Tests: `docs/TESTING.md` -- Sécurité: `docs/SECURITY_AUDIT.md` -- Déploiement: `docs/DEPLOYMENT.md` - -## Contribution - -- GUIDE: `CONTRIBUTING.md`, `CODE_OF_CONDUCT.md` -- Processus de PR et revues - -## Licence - -- Indiquez la licence choisie (MIT/Apache-2.0/GPL) diff --git a/docs/templates/RELEASE_PLAN.md b/docs/templates/RELEASE_PLAN.md deleted file mode 100644 index ab912bfd..00000000 --- a/docs/templates/RELEASE_PLAN.md +++ /dev/null @@ -1,7 +0,0 @@ -# Plan de release — Template - -- Vue d’ensemble, objectifs, date cible -- Préparation (docs/CI/tests/sécurité) -- Communication (annonces, canaux) -- Lancement (checklist, tagging) -- Post‑lancement (support, retours) diff --git a/docs/templates/SECURITY_AUDIT.md b/docs/templates/SECURITY_AUDIT.md deleted file mode 100644 index 3876d6a9..00000000 --- a/docs/templates/SECURITY_AUDIT.md +++ /dev/null @@ -1,7 +0,0 @@ -# Audit de sécurité — Template - -- Menaces et surfaces d’attaque -- Contrôles préventifs et détectifs -- Gestion des secrets -- Politique de dépendances -- Vérifications CI (security-audit) diff --git a/docs/templates/TESTING.md b/docs/templates/TESTING.md deleted file mode 100644 index 81a4b510..00000000 --- a/docs/templates/TESTING.md +++ /dev/null @@ -1,6 +0,0 @@ -# Tests — Template - -- Pyramide: unit, integration, connectivity, external, performance -- Structure des répertoires -- Exécution et rapports -- Intégration CI diff --git a/docs/templates/USAGE.md b/docs/templates/USAGE.md deleted file mode 100644 index 8cad2e97..00000000 --- a/docs/templates/USAGE.md +++ /dev/null @@ -1,7 +0,0 @@ -# Usage — Template - -- Démarrage quotidien -- Opérations courantes -- Tests (référence vers TESTING.md) -- Sécurité (référence vers SECURITY_AUDIT.md) -- Déploiement (référence vers DEPLOYMENT.md)