feat: Architecture modulaire Docker complète - 4NK_node devient orchestrateur pur
This commit is contained in:
parent
3c0377cdb9
commit
1b886afcc4
@ -1,65 +0,0 @@
|
||||
# Dockerfile optimisé pour l'intégration dans 4NK_node
|
||||
FROM node:20-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Installation des dépendances système
|
||||
RUN apk update && apk add --no-cache \
|
||||
git \
|
||||
build-base \
|
||||
python3 \
|
||||
make \
|
||||
g++ \
|
||||
curl \
|
||||
ca-certificates
|
||||
|
||||
# Copie des fichiers de dépendances
|
||||
COPY package*.json ./
|
||||
|
||||
# Installation des dépendances (inclut les devDependencies nécessaires au build)
|
||||
RUN npm install
|
||||
|
||||
# Copie du code source
|
||||
COPY . .
|
||||
|
||||
# Préparation des dépendances wasm (pkg/sdk_client)
|
||||
ARG SDK_CLIENT_PKG_URL=""
|
||||
ARG SDK_CLIENT_PKG_TARBALL=""
|
||||
ARG SDK_CLIENT_PKG_BASE="https://git.4nkweb.com/4nk/ihm_client/raw/branch/docker-support/pkg"
|
||||
ENV SDK_CLIENT_PKG_URL=${SDK_CLIENT_PKG_URL}
|
||||
ENV SDK_CLIENT_PKG_TARBALL=${SDK_CLIENT_PKG_TARBALL}
|
||||
ENV SDK_CLIENT_PKG_BASE=${SDK_CLIENT_PKG_BASE}
|
||||
RUN chmod +x ./scripts/setup-remote-deps.sh && npm run build_wasm
|
||||
|
||||
# Build de l'application
|
||||
RUN npm run build
|
||||
|
||||
# Image de production
|
||||
FROM nginx:alpine
|
||||
|
||||
# Installation de Node.js pour les scripts de démarrage
|
||||
RUN apk update && apk add --no-cache nodejs npm wget
|
||||
|
||||
# Copie des fichiers buildés
|
||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||
COPY --from=builder /app/package*.json /app/
|
||||
|
||||
# Copie de la configuration nginx optimisée pour 4NK_node
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
RUN sed -i 's|types_hash_max_size .*;|types_hash_max_size 4096;|' /etc/nginx/nginx.conf || true
|
||||
|
||||
# Script de démarrage
|
||||
COPY start.sh /start-4nk-node.sh
|
||||
RUN chmod +x /start-4nk-node.sh
|
||||
|
||||
# Exposition des ports
|
||||
EXPOSE 80 3003
|
||||
|
||||
# Variables d'environnement pour 4NK_node
|
||||
ENV SDK_RELAY_WS_URL=ws://sdk_relay_1:8090
|
||||
ENV SDK_RELAY_HTTP_URL=http://sdk_relay_1:8091
|
||||
ENV BITCOIN_RPC_URL=http://bitcoin:18443
|
||||
ENV BLINDBIT_URL=http://blindbit:8000
|
||||
|
||||
# Point d'entrée
|
||||
CMD ["/start-4nk-node.sh"]
|
@ -1,123 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
echo "🚀 Démarrage de l'interface utilisateur 4NK..."
|
||||
|
||||
# Variables d'environnement avec valeurs par défaut
|
||||
SDK_RELAY_WS_URL=${SDK_RELAY_WS_URL:-"ws://sdk_relay_1:8090"}
|
||||
SDK_RELAY_HTTP_URL=${SDK_RELAY_HTTP_URL:-"http://sdk_relay_1:8091"}
|
||||
BITCOIN_RPC_URL=${BITCOIN_RPC_URL:-"http://bitcoin:18443"}
|
||||
BLINDBIT_URL=${BLINDBIT_URL:-"http://blindbit:8000"}
|
||||
|
||||
# Fonction pour attendre qu'un service soit disponible
|
||||
wait_for_service() {
|
||||
local service_name=$1
|
||||
local service_url=$2
|
||||
local max_attempts=30
|
||||
local attempt=1
|
||||
|
||||
echo "⏳ Attente du service $service_name ($service_url)..."
|
||||
|
||||
while [ $attempt -le $max_attempts ]; do
|
||||
if wget --quiet --tries=1 --timeout=5 --spider "$service_url" 2>/dev/null; then
|
||||
echo "✅ Service $service_name disponible"
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo " Tentative $attempt/$max_attempts - Service $service_name non disponible"
|
||||
sleep 2
|
||||
attempt=$((attempt + 1))
|
||||
done
|
||||
|
||||
echo "❌ Service $service_name non disponible après $max_attempts tentatives"
|
||||
return 1
|
||||
}
|
||||
|
||||
# Fonction pour vérifier la connectivité WebSocket
|
||||
check_websocket() {
|
||||
local service_name=$1
|
||||
local ws_url=$2
|
||||
local max_attempts=10
|
||||
local attempt=1
|
||||
|
||||
echo "🔌 Vérification WebSocket $service_name ($ws_url)..."
|
||||
|
||||
while [ $attempt -le $max_attempts ]; do
|
||||
if nc -z $(echo $ws_url | sed 's|ws://||' | sed 's|wss://||' | cut -d: -f1) $(echo $ws_url | cut -d: -f3) 2>/dev/null; then
|
||||
echo "✅ WebSocket $service_name accessible"
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo " Tentative $attempt/$max_attempts - WebSocket $service_name non accessible"
|
||||
sleep 3
|
||||
attempt=$((attempt + 1))
|
||||
done
|
||||
|
||||
echo "⚠️ WebSocket $service_name non accessible (continuera sans)"
|
||||
return 0
|
||||
}
|
||||
|
||||
# Vérification des services critiques
|
||||
echo "🔍 Vérification des services 4NK_node..."
|
||||
|
||||
# Les relays sont disponibles, l'interface utilisateur se connectera via WebSocket
|
||||
echo "✅ Services 4NK_node prêts"
|
||||
echo "🔄 L'interface utilisateur démarrera et se connectera aux relais via WebSocket"
|
||||
|
||||
# Vérifier sdk_relay WebSocket (optionnel)
|
||||
check_websocket "sdk_relay WebSocket" "$SDK_RELAY_WS_URL"
|
||||
|
||||
# Bitcoin Core est disponible, l'interface utilisateur se connectera directement
|
||||
echo "✅ Bitcoin Core disponible"
|
||||
echo "🔄 L'interface utilisateur se connectera directement à Bitcoin Core"
|
||||
|
||||
# Blindbit est disponible, l'interface utilisateur se connectera directement
|
||||
echo "✅ Blindbit disponible"
|
||||
echo "🔄 L'interface utilisateur se connectera directement à Blindbit"
|
||||
|
||||
# Génération de la configuration dynamique
|
||||
echo "⚙️ Génération de la configuration dynamique..."
|
||||
|
||||
# Créer un fichier de configuration JavaScript pour l'application
|
||||
# Pour l'accès via reverse proxy public, utiliser des chemins relatifs /ws et /api
|
||||
cat > /usr/share/nginx/html/config.js << 'EOF'
|
||||
window.ENV_CONFIG = {
|
||||
SDK_RELAY_WS_URL: '/ws',
|
||||
SDK_RELAY_HTTP_URL: '/api',
|
||||
ENVIRONMENT: '4nk-node'
|
||||
};
|
||||
EOF
|
||||
|
||||
# Démarrage de nginx
|
||||
echo "🌐 Démarrage de nginx..."
|
||||
nginx -g "daemon off;" &
|
||||
|
||||
# Attendre que nginx soit prêt
|
||||
sleep 2
|
||||
|
||||
# Vérifier que nginx fonctionne
|
||||
if ! wget --quiet --tries=1 --timeout=5 --spider http://localhost 2>/dev/null; then
|
||||
echo "❌ Nginx n'a pas démarré correctement"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✅ Interface utilisateur 4NK démarrée avec succès"
|
||||
echo " 📍 URL: http://localhost"
|
||||
echo " 🔌 WebSocket: $SDK_RELAY_WS_URL"
|
||||
echo " 🌐 API: $SDK_RELAY_HTTP_URL"
|
||||
|
||||
# Maintenir le conteneur en vie
|
||||
while true; do
|
||||
sleep 30
|
||||
|
||||
# Vérification périodique de la santé
|
||||
if ! wget --quiet --tries=1 --timeout=5 --spider http://localhost 2>/dev/null; then
|
||||
echo "❌ Nginx ne répond plus, redémarrage..."
|
||||
nginx -s reload
|
||||
fi
|
||||
|
||||
# Vérification périodique des relais (optionnel)
|
||||
echo "✅ Interface utilisateur opérationnelle"
|
||||
echo "🌐 Accessible sur http://localhost:8080"
|
||||
done
|
@ -1,77 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
echo "🚀 Démarrage de l'infrastructure 4NK_node avec interface utilisateur..."
|
||||
|
||||
# Vérifier que nous sommes dans le bon répertoire
|
||||
if [[ ! -f "docker-compose.yml" ]]; then
|
||||
echo "❌ Ce script doit être exécuté depuis le répertoire 4NK_node"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Arrêter et nettoyer les conteneurs existants
|
||||
echo "🧹 Nettoyage des conteneurs existants..."
|
||||
docker-compose down
|
||||
|
||||
# Démarrer tous les services
|
||||
echo "📦 Démarrage de tous les services..."
|
||||
docker-compose up -d
|
||||
|
||||
# Attendre que les services critiques soient prêts
|
||||
echo "⏳ Attente du démarrage des services critiques..."
|
||||
sleep 30
|
||||
|
||||
# Vérifier la santé des services
|
||||
echo "🔍 Vérification de la santé des services..."
|
||||
|
||||
# Bitcoin
|
||||
if docker-compose ps bitcoin | grep -q "Up"; then
|
||||
echo "✅ Bitcoin démarré"
|
||||
else
|
||||
echo "❌ Bitcoin n'est pas démarré"
|
||||
docker-compose logs bitcoin
|
||||
fi
|
||||
|
||||
# Blindbit
|
||||
if docker-compose ps blindbit | grep -q "Up"; then
|
||||
echo "✅ Blindbit démarré"
|
||||
else
|
||||
echo "❌ Blindbit n'est pas démarré"
|
||||
docker-compose logs blindbit
|
||||
fi
|
||||
|
||||
# SDK Relays
|
||||
for i in {1..3}; do
|
||||
if docker-compose ps "sdk_relay_$i" | grep -q "Up"; then
|
||||
echo "✅ SDK Relay $i démarré"
|
||||
else
|
||||
echo "❌ SDK Relay $i n'est pas démarré"
|
||||
docker-compose logs "sdk_relay_$i"
|
||||
fi
|
||||
done
|
||||
|
||||
# Interface utilisateur
|
||||
if docker-compose ps ihm_client | grep -q "Up"; then
|
||||
echo "✅ Interface utilisateur démarrée"
|
||||
else
|
||||
echo "❌ Interface utilisateur n'est pas démarrée"
|
||||
docker-compose logs ihm_client
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "🎉 Infrastructure 4NK_node démarrée avec succès !"
|
||||
echo ""
|
||||
echo "📍 URLs d'accès :"
|
||||
echo " 🌐 Interface utilisateur: http://localhost:8080"
|
||||
echo " 🔗 Bitcoin RPC: http://localhost:18443"
|
||||
echo " 🔗 Blindbit: http://localhost:8000"
|
||||
echo " 🔗 SDK Relay 1: http://localhost:8091"
|
||||
echo " 🔗 SDK Relay 2: http://localhost:8093"
|
||||
echo " 🔗 SDK Relay 3: http://localhost:8095"
|
||||
echo ""
|
||||
echo "🔍 Commandes utiles :"
|
||||
echo " 📋 Statut des services: docker-compose ps"
|
||||
echo " 📋 Logs d'un service: docker-compose logs <service_name>"
|
||||
echo " 📋 Arrêter l'infrastructure: docker-compose down"
|
||||
echo " 📋 Redémarrer un service: docker-compose restart <service_name>"
|
@ -1,30 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
echo "🚀 Démarrage de l'interface utilisateur 4NK..."
|
||||
|
||||
# Vérifier que nous sommes dans le bon répertoire
|
||||
if [[ ! -f "docker-compose.yml" ]]; then
|
||||
echo "❌ Ce script doit être exécuté depuis le répertoire 4NK_node"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Démarrer uniquement le service ihm_client
|
||||
echo "📦 Démarrage du service ihm_client..."
|
||||
docker-compose up -d ihm_client
|
||||
|
||||
# Attendre que le service soit prêt
|
||||
echo "⏳ Attente du démarrage..."
|
||||
sleep 10
|
||||
|
||||
# Vérifier la santé du service
|
||||
if docker-compose ps ihm_client | grep -q "Up"; then
|
||||
echo "✅ Interface utilisateur démarrée avec succès"
|
||||
echo " 📍 URL: http://localhost:8080"
|
||||
echo " 🔍 Logs: docker logs 4nk-ihm-client"
|
||||
else
|
||||
echo "❌ Échec du démarrage de l'interface utilisateur"
|
||||
docker-compose logs ihm_client
|
||||
exit 1
|
||||
fi
|
@ -1 +0,0 @@
|
||||
Subproject commit 09b45d14888724760cde0ae89cce6c42e4a59b8f
|
@ -1,55 +0,0 @@
|
||||
# bitcoin/Dockerfile
|
||||
FROM debian:bullseye-slim as builder
|
||||
|
||||
# Installation des dépendances
|
||||
RUN apt-get update && apt-get install -y \
|
||||
curl \
|
||||
gnupg \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Version de Bitcoin Core
|
||||
ENV VERSION=24.1
|
||||
|
||||
# Téléchargement et vérification de Bitcoin Core
|
||||
WORKDIR /tmp
|
||||
RUN curl -O https://bitcoincore.org/bin/bitcoin-core-${VERSION}/bitcoin-${VERSION}-x86_64-linux-gnu.tar.gz && \
|
||||
curl -O https://bitcoincore.org/bin/bitcoin-core-${VERSION}/SHA256SUMS.asc && \
|
||||
curl -O https://bitcoincore.org/bin/bitcoin-core-${VERSION}/SHA256SUMS
|
||||
|
||||
# Extraction de Bitcoin Core
|
||||
RUN tar -xzf bitcoin-${VERSION}-x86_64-linux-gnu.tar.gz
|
||||
|
||||
# Image finale
|
||||
FROM debian:bullseye-slim
|
||||
|
||||
# On redéfinit la version dans l'image finale
|
||||
ENV VERSION=24.1
|
||||
|
||||
# Installation des dépendances nécessaires
|
||||
RUN apt-get update && apt-get install -y \
|
||||
libatomic1 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Créer l'utilisateur et le groupe bitcoin
|
||||
RUN groupadd -g 1000 bitcoin && \
|
||||
useradd -m -d /home/bitcoin -g bitcoin bitcoin
|
||||
|
||||
# Copie des binaires depuis le builder
|
||||
COPY --from=builder /tmp/bitcoin-${VERSION}/bin/bitcoind /usr/local/bin/
|
||||
COPY --from=builder /tmp/bitcoin-${VERSION}/bin/bitcoin-cli /usr/local/bin/
|
||||
|
||||
# Configuration
|
||||
RUN mkdir -p /home/bitcoin/.bitcoin/wallets /home/bitcoin/.bitcoin/signet && \
|
||||
chown -R bitcoin:bitcoin /home/bitcoin/.bitcoin
|
||||
COPY bitcoin.conf /home/bitcoin/.bitcoin/bitcoin.conf
|
||||
RUN chown bitcoin:bitcoin /home/bitcoin/.bitcoin/bitcoin.conf
|
||||
|
||||
VOLUME ["/home/bitcoin/.bitcoin"]
|
||||
|
||||
# Exposition des ports (signet)
|
||||
EXPOSE 38332 38333 29000 18443
|
||||
|
||||
USER bitcoin
|
||||
WORKDIR /home/bitcoin
|
||||
ENTRYPOINT ["bitcoind", "-conf=/home/bitcoin/.bitcoin/bitcoin.conf", "-signet", "-printtoconsole"]
|
||||
|
@ -1,43 +0,0 @@
|
||||
# Configuration globale
|
||||
datadir=/home/bitcoin/.bitcoin
|
||||
server=1
|
||||
txindex=1
|
||||
debug=1
|
||||
loglevel=debug
|
||||
logthreadnames=1
|
||||
signet=1
|
||||
onion=tor:9050
|
||||
listenonion=1
|
||||
proxy=tor:9050
|
||||
|
||||
# Paramètres RPC
|
||||
rpcauth=bitcoin:c8ea921c7357bd6a5a8a7c43a12350a7$955e25b17672987b17c5a12f12cd8b9c1d38f0f86201c8cd47fc431f2e1c7956
|
||||
rpcallowip=0.0.0.0/0
|
||||
rpcworkqueue=32
|
||||
rpcthreads=4
|
||||
rpcdoccheck=1
|
||||
|
||||
# Paramètres ZMQ
|
||||
zmqpubhashblock=tcp://0.0.0.0:29000
|
||||
zmqpubrawblock=tcp://0.0.0.0:29000
|
||||
zmqpubrawtx=tcp://0.0.0.0:29000
|
||||
|
||||
[signet]
|
||||
listen=1
|
||||
bind=0.0.0.0:38333
|
||||
rpcbind=0.0.0.0:18443
|
||||
rpcbind=0.0.0.0
|
||||
rpcport=18443
|
||||
fallbackfee=0.0001
|
||||
blockfilterindex=1
|
||||
datacarriersize=205
|
||||
acceptnonstdtxn=1
|
||||
dustrelayfee=0.00000001
|
||||
minrelaytxfee=0.00000001
|
||||
prune=0
|
||||
signetchallenge=0020341c43803863c252df326e73574a27d7e19322992061017b0dc893e2eab90821
|
||||
walletdir=/home/bitcoin/.bitcoin/wallets
|
||||
wallet=mining
|
||||
wallet=watchonly
|
||||
maxtxfee=1
|
||||
addnode=tlv2yqamflv22vfdzy2hha2nwmt6zrwrhjjzz4lx7qyq7lyc6wfhabyd.onion
|
@ -1,31 +0,0 @@
|
||||
# blindbit-oracle/Dockerfile
|
||||
FROM golang:1.24 as builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Cloner le repo blindbit-oracle (version stable)
|
||||
RUN git clone --branch master --depth 1 https://github.com/setavenger/blindbit-oracle.git .
|
||||
|
||||
# Compiler le binaire
|
||||
RUN go build -o /go/bin/blindbit-oracle ./src
|
||||
|
||||
# Utiliser debian:bookworm-slim qui contient GLIBC 2.34
|
||||
FROM debian:bookworm-slim
|
||||
|
||||
# Installation des dépendances nécessaires
|
||||
RUN apt-get update && apt-get install -y ca-certificates curl && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copier le binaire depuis le builder
|
||||
COPY --from=builder /go/bin/blindbit-oracle /usr/local/bin/blindbit-oracle
|
||||
|
||||
# Créer le répertoire de données
|
||||
RUN mkdir -p /data
|
||||
|
||||
# Créer le volume pour les données
|
||||
VOLUME ["/data"]
|
||||
|
||||
# Exposer le port par défaut
|
||||
EXPOSE 8000
|
||||
|
||||
# Démarrer blindbit-oracle avec le répertoire de données spécifié
|
||||
ENTRYPOINT ["blindbit-oracle", "-datadir", "/data"]
|
@ -1,28 +0,0 @@
|
||||
# Configuration pour blindbit-oracle
|
||||
host = "0.0.0.0:8000"
|
||||
|
||||
# Définit la chaîne sur laquelle le wallet fonctionne
|
||||
chain = "signet"
|
||||
|
||||
# Point d'accès RPC Bitcoin
|
||||
rpc_endpoint = "http://bitcoin:18443"
|
||||
|
||||
# Chemin vers le fichier cookie RPC Bitcoin
|
||||
cookie_path = "/home/bitcoin/.bitcoin/signet/.cookie"
|
||||
|
||||
# Identifiants RPC Bitcoin (non utilisés avec cookie_path)
|
||||
rpc_user = ""
|
||||
rpc_pass = ""
|
||||
|
||||
# Hauteur de départ pour la synchronisation
|
||||
sync_start_height = 1
|
||||
|
||||
# Paramètres de performance
|
||||
max_parallel_tweak_computations = 4
|
||||
max_parallel_requests = 4
|
||||
|
||||
# Configuration des index
|
||||
tweaks_only = 0
|
||||
tweaks_full_basic = 1
|
||||
tweaks_full_with_dust_filter = 1
|
||||
tweaks_cut_through_with_dust_filter = 1
|
70
build_modules.sh
Executable file
70
build_modules.sh
Executable file
@ -0,0 +1,70 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Script de build pour tous les modules 4NK_node
|
||||
set -e
|
||||
|
||||
echo "🏗️ Construction des modules 4NK_node..."
|
||||
|
||||
# Variables
|
||||
REGISTRY="4nk-node"
|
||||
TAG="latest"
|
||||
|
||||
# Fonction pour construire un module
|
||||
build_module() {
|
||||
local module=$1
|
||||
local dockerfile=$2
|
||||
|
||||
echo "🔨 Construction de $module..."
|
||||
|
||||
if [ -f "$dockerfile" ]; then
|
||||
cd modules/$module && docker build -t "$REGISTRY-$module:$TAG" . && cd ../../
|
||||
echo "✅ $module construit avec succès"
|
||||
else
|
||||
echo "❌ Dockerfile non trouvé pour $module: $dockerfile"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Construction des modules
|
||||
echo "📦 Construction des modules..."
|
||||
|
||||
# sdk_signer
|
||||
if [ -d "../sdk_signer" ]; then
|
||||
echo "📁 Copie du code sdk_signer..."
|
||||
cp -r ../sdk_signer/* modules/sdk_signer/
|
||||
build_module "sdk_signer" "modules/sdk_signer/Dockerfile"
|
||||
else
|
||||
echo "⚠️ Répertoire sdk_signer non trouvé"
|
||||
fi
|
||||
|
||||
# sdk_storage
|
||||
if [ -d "../sdk_storage" ]; then
|
||||
echo "📁 Copie du code sdk_storage..."
|
||||
cp -r ../sdk_storage/* modules/sdk_storage/
|
||||
build_module "sdk_storage" "modules/sdk_storage/Dockerfile"
|
||||
else
|
||||
echo "⚠️ Répertoire sdk_storage non trouvé"
|
||||
fi
|
||||
|
||||
# ihm_client
|
||||
if [ -d "../ihm_client" ]; then
|
||||
echo "📁 Copie du code ihm_client..."
|
||||
cp -r ../ihm_client/* modules/ihm_client/
|
||||
build_module "ihm_client" "modules/ihm_client/Dockerfile"
|
||||
else
|
||||
echo "⚠️ Répertoire ihm_client non trouvé"
|
||||
fi
|
||||
|
||||
# sdk_relay
|
||||
if [ -d "../sdk_relay" ]; then
|
||||
echo "📁 Copie du code sdk_relay..."
|
||||
cp -r ../sdk_relay/* modules/sdk_relay/
|
||||
build_module "sdk-relay" "modules/sdk_relay/Dockerfile"
|
||||
else
|
||||
echo "⚠️ Répertoire sdk_relay non trouvé"
|
||||
fi
|
||||
|
||||
echo "🎉 Construction de tous les modules terminée !"
|
||||
echo ""
|
||||
echo "📋 Images construites :"
|
||||
docker images | grep "$REGISTRY-"
|
@ -1,19 +0,0 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDETCCAfmgAwIBAgIUJboCRW/xrzBSG2jYDSdNfURIzd4wDQYJKoZIhvcNAQEL
|
||||
BQAwGDEWMBQGA1UEAwwNOTIuMjQzLjI3LjE2MDAeFw0yNTA4MjYwMTQxNTRaFw0y
|
||||
NjA4MjYwMTQxNTRaMBgxFjAUBgNVBAMMDTkyLjI0My4yNy4xNjAwggEiMA0GCSqG
|
||||
SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDje8YeBKYLCYnUSOR3mQIX3j2JNbIlHrz9
|
||||
XV5egpEmHArbuh1UV4qsYL8vXv8DuWDSIbFLIvY/QekX++Ug1wMVDQsp+LHWbRp2
|
||||
StsvkLCfyyVU9tfQ90fy4ylILdVVFaptskgKmY5JyVkJJ/s7qFvOeG10r4DfIA5W
|
||||
LisWZv3WQtS1ShPxLIDn6/2I6sNA5sxmOo+szud9mC7RPC5V2hD1mnZaB5o7Ovvd
|
||||
ZfDXfk+cE0qO1rly+CDRSw1YNXmpzpeO8/sRDmMvfA51S/U59NK43C5PgtJ4dunm
|
||||
XWsVrIzt7QjeF+ANldHBGF8jh88gKxRTYJQNYTwIfhL57ipTokfpAgMBAAGjUzBR
|
||||
MB0GA1UdDgQWBBRM/sctXRsTyTY0JwP58SmsoM8+FjAfBgNVHSMEGDAWgBRM/sct
|
||||
XRsTyTY0JwP58SmsoM8+FjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUA
|
||||
A4IBAQAPAV2VNg+V67gKamXCNkgJCCJlC1PrSEdD3W5/SKMQwtORSrYV7OjOpvBb
|
||||
msZ3a769PPOcvV72p35fturzWnave/WHC5sM+2WqZmSQCfoV+d8sHJGB84rDnLV2
|
||||
zl4sKcwSMwUMZhwxPvSYV+d5ZxQ2SfbQ8ZwTiNDLsWGB8K0E1nK/4SbPRIEfAu5U
|
||||
m29RkByl74T1kgTHinu0F/eNWQJsV5aQIkD2hhTnazmf0rC9MI4dRlGF1Ycup7xT
|
||||
FdiBDfkjPkt6YlvA8Mk9aEz/Mm2bh7flmEw2DD9xho6WZfI6974HKQwsngJgb4be
|
||||
JDIzbS+JLEjB7lR1IuXTN83ZUg1l
|
||||
-----END CERTIFICATE-----
|
@ -1,28 +0,0 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDje8YeBKYLCYnU
|
||||
SOR3mQIX3j2JNbIlHrz9XV5egpEmHArbuh1UV4qsYL8vXv8DuWDSIbFLIvY/QekX
|
||||
++Ug1wMVDQsp+LHWbRp2StsvkLCfyyVU9tfQ90fy4ylILdVVFaptskgKmY5JyVkJ
|
||||
J/s7qFvOeG10r4DfIA5WLisWZv3WQtS1ShPxLIDn6/2I6sNA5sxmOo+szud9mC7R
|
||||
PC5V2hD1mnZaB5o7OvvdZfDXfk+cE0qO1rly+CDRSw1YNXmpzpeO8/sRDmMvfA51
|
||||
S/U59NK43C5PgtJ4dunmXWsVrIzt7QjeF+ANldHBGF8jh88gKxRTYJQNYTwIfhL5
|
||||
7ipTokfpAgMBAAECggEALKQ0i92DrDTR/HvVgfbf50kwsEV+UTSIB/yTsV5UF7N3
|
||||
GgmbCdsoFo3h1u0AhH2Tl4kPHtyckGthz9gZ7ejj7PSjVTg9xgOhJsen3dy6HJGk
|
||||
INlUHuj4EJ0tk8GS1OCsklxjMNlTh/1gYKCc9+chJRKTAEwUsTS8O4NR51KMy8fw
|
||||
2yzDQTuIFO3Fk9F5QvHrw1cE8iylxutS1Y9K8JCKP2nsWIcwEpXtiemKFZKODLzj
|
||||
7HJLSdUgIX4xIlxbBgUZgPpRg3HKI6JAldVKQyXdQfk+8rqDSNu6q3jrL0GkctOM
|
||||
e6o2l/3yi+MbiZ/uhLQYfEMcpIYiz/cJ7X3ShK0cAQKBgQD9mlpwtc2zuJmVSE/5
|
||||
c6B8amKq+NcnWU4KtpbNPWGlGirFurT9pic2beHI+o6Ka1ArmdphP5xI9V+YQHyv
|
||||
Xmdew8mZ11qxodBk0a1KCCY+5TGeZ1EC70MrAZtm3to5PINCco5yLvjJzHt5I8ve
|
||||
8L+xfGe3ajJ6uYbwkPP0TutsaQKBgQDlojgQWhus1HAdk5F4mbd6nYmAUUlDWFwF
|
||||
UCscqiBsp4AYt53C8a0J0B1EIEhqVmyFOQ6VOi2Qgbkf7W7+hKXfcBpi3MJApJ0H
|
||||
K/PcXxavibqB+VLfc+Ip9ZX+PTbu8Zt42HGjK+TwCGfNj48wSXulE7DY0qkqPxBq
|
||||
hA2oe6KPgQKBgEt3GR6dGx81+Y3wvMuwWrtrNP1Hm068RnrtpqZgc6Qby0qXqrAo
|
||||
N1b9D8kstin+kRbIa7GwqiMT0WSPHAtbfks229EJwpVFX6wAsR5smmTw8vj+KZ9D
|
||||
76rmiYXtHucVWMH3MOhNjf8O+FcuDcbDwWdha8OquGbIupzvpYi3y1qxAoGAPTEV
|
||||
L4ZTiaKyna8NPM35jrscQQ1oMIIDQ4cxddn/+fRItk13xNMSAWNr6ROROIT/NiEW
|
||||
Ob3fFnr7Ef77bOd8LCZ7YYziVseG8LpNqZPNP8m74ZbG9rSyt+uxpKY7VUEc5P8I
|
||||
iSrRPwV+Y9C1n3B1em/c2GqKma9keH3oBdWsZAECgYBHvF+l9m3FE8JW0gOvcpDu
|
||||
6ny1K8FcQhtuUFM+yeNTZCQoBkzw33DSO3GQJvO5qp6SDGAHVLrV7sshgc699gz8
|
||||
u9T2zUEHMK7b3VV90Cwl/SzDCyrK23TnJJQTf/lzdRwOxgrymxSaLXi9Dla8Z1a4
|
||||
8eSPkI1JPI4SWVxVvZXkUg==
|
||||
-----END PRIVATE KEY-----
|
1
conf/bitcoin.conf
Normal file
1
conf/bitcoin.conf
Normal file
@ -0,0 +1 @@
|
||||
# Configuration Bitcoin Core pour Docker 4NK_node
|
1
conf/blindbit.toml
Normal file
1
conf/blindbit.toml
Normal file
@ -0,0 +1 @@
|
||||
# Configuration pour blindbit-oracle Docker 4NK_node
|
20
conf/sdk_relay1.conf
Normal file
20
conf/sdk_relay1.conf
Normal file
@ -0,0 +1,20 @@
|
||||
# Configuration sdk_relay pour Docker
|
||||
# Services connectés via réseau Docker
|
||||
|
||||
# Bitcoin Core RPC (utilise le nom d'hôte Docker et le cookie)
|
||||
core_url=http://bitcoin:18443
|
||||
core_wallet=relay_wallet
|
||||
ws_url=0.0.0.0:8090
|
||||
http_url=0.0.0.0:8091
|
||||
wallet_name=relay_wallet.json
|
||||
network=signet
|
||||
blindbit_url=http://blindbit:8000
|
||||
zmq_url=tcp://bitcoin:29000
|
||||
data_dir=.4nk
|
||||
cookie_path=/home/bitcoin/.bitcoin/signet/.cookie
|
||||
|
||||
# Mode développement
|
||||
dev_mode=true
|
||||
standalone=true
|
||||
blindbit_enabled=true
|
||||
relay_id=relay-1
|
20
conf/sdk_relay2.conf
Normal file
20
conf/sdk_relay2.conf
Normal file
@ -0,0 +1,20 @@
|
||||
# Configuration sdk_relay pour Docker
|
||||
# Services connectés via réseau Docker
|
||||
|
||||
# Bitcoin Core RPC (utilise le nom d'hôte Docker et le cookie)
|
||||
core_url=http://bitcoin:18443
|
||||
core_wallet=relay_wallet
|
||||
ws_url=0.0.0.0:8090
|
||||
http_url=0.0.0.0:8091
|
||||
wallet_name=relay_wallet.json
|
||||
network=signet
|
||||
blindbit_url=http://blindbit:8000
|
||||
zmq_url=tcp://bitcoin:29000
|
||||
data_dir=.4nk
|
||||
cookie_path=/home/bitcoin/.bitcoin/signet/.cookie
|
||||
|
||||
# Mode développement
|
||||
dev_mode=true
|
||||
standalone=true
|
||||
blindbit_enabled=true
|
||||
relay_id=relay-2
|
20
conf/sdk_relay3.conf
Normal file
20
conf/sdk_relay3.conf
Normal file
@ -0,0 +1,20 @@
|
||||
# Configuration sdk_relay pour Docker
|
||||
# Services connectés via réseau Docker
|
||||
|
||||
# Bitcoin Core RPC (utilise le nom d'hôte Docker et le cookie)
|
||||
core_url=http://bitcoin:18443
|
||||
core_wallet=relay_wallet
|
||||
ws_url=0.0.0.0:8090
|
||||
http_url=0.0.0.0:8091
|
||||
wallet_name=relay_wallet.json
|
||||
network=signet
|
||||
blindbit_url=http://blindbit:8000
|
||||
zmq_url=tcp://bitcoin:29000
|
||||
data_dir=.4nk
|
||||
cookie_path=/home/bitcoin/.bitcoin/signet/.cookie
|
||||
|
||||
# Mode développement
|
||||
dev_mode=true
|
||||
standalone=true
|
||||
blindbit_enabled=true
|
||||
relay_id=relay-3
|
@ -260,35 +260,43 @@ services:
|
||||
- sdk_storage_data:/app/storage
|
||||
# Service interne: aucun port exposé
|
||||
|
||||
# sdk_signer:
|
||||
# build:
|
||||
# context: ../sdk_signer
|
||||
# dockerfile: Dockerfile
|
||||
# container_name: sdk-signer
|
||||
# restart: unless-stopped
|
||||
# user: "0:0"
|
||||
# environment:
|
||||
# - PORT=9090
|
||||
# - API_KEY=dev-change-me
|
||||
# - RELAY_URLS=ws://sdk_relay_1:8090
|
||||
# - LOG_LEVEL=info
|
||||
# - DATABASE_PATH=/app/data/server.db
|
||||
# entrypoint: >
|
||||
# /bin/sh -lc "mkdir -p /app/data && chown -R nodejs:nodejs /app/data || true; \
|
||||
# apk add --no-cache busybox-extras >/dev/null 2>&1 || true; \
|
||||
# mkdir -p /tmp/health && printf 'ok' > /tmp/health/health; \
|
||||
# ( /usr/sbin/httpd -f -h /tmp/health -p 9092 ) & \
|
||||
# exec node -r ts-node/register/transpile-only src/index.ts"
|
||||
# networks:
|
||||
# btcnet:
|
||||
# aliases:
|
||||
# - sdk_signer
|
||||
# depends_on:
|
||||
# sdk_relay_1:
|
||||
# condition: service_started
|
||||
# volumes:
|
||||
# - sdk_signer_data:/app/data
|
||||
# # Service interne: aucun port exposé
|
||||
sdk_signer:
|
||||
args:
|
||||
GIT_BRANCH: master
|
||||
build:
|
||||
args:
|
||||
GIT_BRANCH: master
|
||||
context: ../sdk_signer
|
||||
args:
|
||||
GIT_BRANCH: master
|
||||
dockerfile: Dockerfile
|
||||
args:
|
||||
GIT_BRANCH: master
|
||||
container_name: sdk-signer
|
||||
restart: unless-stopped
|
||||
user: "0:0"
|
||||
environment:
|
||||
- PORT=9090
|
||||
- API_KEY=dev-change-me
|
||||
- RELAY_URLS=ws://sdk_relay_1:8090
|
||||
- LOG_LEVEL=info
|
||||
- DATABASE_PATH=/app/data/server.db
|
||||
entrypoint: >
|
||||
/bin/sh -lc "mkdir -p /app/data && chown -R nodejs:nodejs /app/data || true; \
|
||||
apk add --no-cache busybox-extras >/dev/null 2>&1 || true; \
|
||||
mkdir -p /tmp/health && printf 'ok' > /tmp/health/health; \
|
||||
( /usr/sbin/httpd -f -h /tmp/health -p 9092 ) & \
|
||||
exec node -r ts-node/register/transpile-only src/index.ts"
|
||||
networks:
|
||||
btcnet:
|
||||
aliases:
|
||||
- sdk_signer
|
||||
depends_on:
|
||||
sdk_relay_1:
|
||||
condition: service_started
|
||||
volumes:
|
||||
- sdk_signer_data:/app/data
|
||||
# Service interne: aucun port exposé
|
||||
|
||||
volumes:
|
||||
bitcoin_data:
|
||||
|
@ -1,32 +0,0 @@
|
||||
FROM rust:1 as wasm
|
||||
WORKDIR /src
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
git curl pkg-config libssl-dev ca-certificates \
|
||||
clang llvm lld build-essential \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
RUN curl -sSf https://rustwasm.github.io/wasm-pack/installer/init.sh | sh
|
||||
RUN git clone -b docker-support https://git.4nkweb.com/4nk/sdk_client.git sdk_client
|
||||
ENV CC=clang \
|
||||
AR=llvm-ar \
|
||||
CFLAGS_wasm32_unknown_unknown="--target=wasm32-unknown-unknown" \
|
||||
TARGET_CC=clang
|
||||
RUN wasm-pack build --out-dir /out/pkg ./sdk_client --target nodejs --release
|
||||
|
||||
FROM node:20-alpine AS deps
|
||||
ENV NODE_ENV=development
|
||||
WORKDIR /app
|
||||
RUN apk add --no-cache python3 make g++
|
||||
COPY package.json package-lock.json* ./
|
||||
RUN npm ci
|
||||
|
||||
FROM node:20-alpine AS runner
|
||||
ENV NODE_ENV=production
|
||||
WORKDIR /app
|
||||
RUN addgroup -S nodejs && adduser -S nodejs -G nodejs
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY --from=wasm /out/pkg ./pkg
|
||||
COPY tsconfig.json ./
|
||||
COPY src ./src
|
||||
EXPOSE 9090
|
||||
USER nodejs
|
||||
CMD ["node", "-r", "ts-node/register/transpile-only", "src/index.ts"]
|
795
docs/API.md
795
docs/API.md
@ -1,795 +0,0 @@
|
||||
# Référence API - 4NK_node
|
||||
|
||||
Ce guide documente toutes les APIs disponibles dans l'infrastructure 4NK_node, incluant les interfaces RPC, HTTP et WebSocket.
|
||||
|
||||
## Vue d'Ensemble des APIs
|
||||
|
||||
L'infrastructure 4NK_node expose plusieurs interfaces pour différents types d'interactions :
|
||||
|
||||
- **Bitcoin Core RPC** : Interface JSON-RPC pour Bitcoin
|
||||
- **Blindbit HTTP** : API REST pour les paiements silencieux
|
||||
- **SDK Relay WebSocket** : Interface temps réel pour les clients
|
||||
- **SDK Relay HTTP** : API REST pour les opérations de gestion
|
||||
- **SDK Storage HTTP** : API REST de stockage clé/valeur TTL
|
||||
|
||||
## 1. API Bitcoin Core RPC
|
||||
|
||||
### Informations Générales
|
||||
|
||||
- **Protocole :** JSON-RPC
|
||||
- **Port :** 18443
|
||||
- **Authentification :** Cookie ou credentials
|
||||
- **Réseau :** Signet
|
||||
- **Base URL :** `http://localhost:18443`
|
||||
|
||||
### Authentification
|
||||
|
||||
#### Méthode Cookie (Recommandée)
|
||||
```bash
|
||||
# Le cookie est automatiquement utilisé par Bitcoin Core
|
||||
curl -X POST http://localhost:18443 \
|
||||
-H "Content-Type: application/json" \
|
||||
--data '{"jsonrpc": "1.0", "id": "test", "method": "getblockchaininfo", "params": []}'
|
||||
```
|
||||
|
||||
#### Méthode Credentials
|
||||
```bash
|
||||
curl -X POST http://localhost:18443 \
|
||||
-H "Content-Type: application/json" \
|
||||
-u "username:password" \
|
||||
--data '{"jsonrpc": "1.0", "id": "test", "method": "getblockchaininfo", "params": []}'
|
||||
```
|
||||
|
||||
### Endpoints Principaux
|
||||
|
||||
#### getblockchaininfo
|
||||
Récupère les informations sur la blockchain.
|
||||
|
||||
**Requête :**
|
||||
```json
|
||||
{
|
||||
"jsonrpc": "1.0",
|
||||
"id": "test",
|
||||
"method": "getblockchaininfo",
|
||||
"params": []
|
||||
}
|
||||
```
|
||||
|
||||
**Réponse :**
|
||||
```json
|
||||
{
|
||||
"result": {
|
||||
"chain": "signet",
|
||||
"blocks": 12345,
|
||||
"headers": 12345,
|
||||
"bestblockhash": "0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"difficulty": 1.0,
|
||||
"mediantime": 1234567890,
|
||||
"verificationprogress": 1.0,
|
||||
"initialblockdownload": false,
|
||||
"chainwork": "0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"size_on_disk": 123456789,
|
||||
"pruned": false,
|
||||
"pruneheight": null,
|
||||
"automatic_pruning": false,
|
||||
"prune_target_size": null,
|
||||
"warnings": ""
|
||||
},
|
||||
"error": null,
|
||||
"id": "test"
|
||||
}
|
||||
```
|
||||
|
||||
#### getblock
|
||||
Récupère les informations d'un bloc spécifique.
|
||||
|
||||
**Requête :**
|
||||
```json
|
||||
{
|
||||
"jsonrpc": "1.0",
|
||||
"id": "test",
|
||||
"method": "getblock",
|
||||
"params": ["blockhash", 2]
|
||||
}
|
||||
```
|
||||
|
||||
**Paramètres :**
|
||||
- `blockhash` : Hash du bloc
|
||||
- `verbosity` : Niveau de détail (0, 1, 2)
|
||||
|
||||
#### getrawtransaction
|
||||
Récupère une transaction brute.
|
||||
|
||||
**Requête :**
|
||||
```json
|
||||
{
|
||||
"jsonrpc": "1.0",
|
||||
"id": "test",
|
||||
"method": "getrawtransaction",
|
||||
"params": ["txid", true]
|
||||
}
|
||||
```
|
||||
|
||||
#### sendrawtransaction
|
||||
Envoie une transaction brute au réseau.
|
||||
|
||||
**Requête :**
|
||||
```json
|
||||
{
|
||||
"jsonrpc": "1.0",
|
||||
"id": "test",
|
||||
"method": "sendrawtransaction",
|
||||
"params": ["hexstring"]
|
||||
}
|
||||
```
|
||||
|
||||
#### getwalletinfo
|
||||
Récupère les informations du wallet.
|
||||
|
||||
**Requête :**
|
||||
```json
|
||||
{
|
||||
"jsonrpc": "1.0",
|
||||
"id": "test",
|
||||
"method": "getwalletinfo",
|
||||
"params": []
|
||||
}
|
||||
```
|
||||
|
||||
### Gestion des Erreurs
|
||||
|
||||
**Erreur typique :**
|
||||
```json
|
||||
{
|
||||
"result": null,
|
||||
"error": {
|
||||
"code": -32601,
|
||||
"message": "Method not found"
|
||||
},
|
||||
"id": "test"
|
||||
}
|
||||
```
|
||||
|
||||
**Codes d'erreur courants :**
|
||||
- `-32601` : Méthode non trouvée
|
||||
- `-32602` : Paramètres invalides
|
||||
- `-32603` : Erreur interne
|
||||
- `-1` : Erreur d'authentification
|
||||
|
||||
## 2. API Blindbit HTTP
|
||||
|
||||
### Informations Générales
|
||||
|
||||
- **Protocole :** HTTP REST
|
||||
- **Port :** 8000
|
||||
- **Base URL :** `http://localhost:8000`
|
||||
- **Content-Type :** `application/json`
|
||||
|
||||
### Endpoints
|
||||
|
||||
#### GET /health
|
||||
Vérifie la santé du service.
|
||||
|
||||
**Requête :**
|
||||
```bash
|
||||
curl -X GET http://localhost:8000/health
|
||||
```
|
||||
|
||||
**Réponse :**
|
||||
```json
|
||||
{
|
||||
"status": "healthy",
|
||||
"timestamp": "2024-12-19T14:30:00Z",
|
||||
"version": "1.1.0"
|
||||
}
|
||||
```
|
||||
|
||||
#### POST /generate-address
|
||||
Génère une adresse de paiement silencieux.
|
||||
|
||||
**Requête :**
|
||||
```json
|
||||
{
|
||||
"label": "payment_001",
|
||||
"amount": 0.001
|
||||
}
|
||||
```
|
||||
|
||||
**Réponse :**
|
||||
```json
|
||||
{
|
||||
"address": "bc1p...",
|
||||
"label": "payment_001",
|
||||
"amount": 0.001,
|
||||
"created_at": "2024-12-19T14:30:00Z"
|
||||
}
|
||||
```
|
||||
|
||||
#### GET /payments
|
||||
Liste les paiements reçus.
|
||||
|
||||
**Requête :**
|
||||
```bash
|
||||
curl -X GET "http://localhost:8000/payments?limit=10&offset=0"
|
||||
```
|
||||
|
||||
**Paramètres de requête :**
|
||||
- `limit` : Nombre maximum de résultats (défaut: 10)
|
||||
- `offset` : Décalage pour la pagination (défaut: 0)
|
||||
|
||||
**Réponse :**
|
||||
```json
|
||||
{
|
||||
"payments": [
|
||||
{
|
||||
"id": "payment_001",
|
||||
"address": "bc1p...",
|
||||
"amount": 0.001,
|
||||
"txid": "txid...",
|
||||
"block_height": 12345,
|
||||
"created_at": "2024-12-19T14:30:00Z"
|
||||
}
|
||||
],
|
||||
"total": 1,
|
||||
"limit": 10,
|
||||
"offset": 0
|
||||
}
|
||||
```
|
||||
|
||||
#### GET /payments/{id}
|
||||
Récupère les détails d'un paiement spécifique.
|
||||
|
||||
**Requête :**
|
||||
```bash
|
||||
curl -X GET http://localhost:8000/payments/payment_001
|
||||
```
|
||||
|
||||
**Réponse :**
|
||||
```json
|
||||
{
|
||||
"id": "payment_001",
|
||||
"address": "bc1p...",
|
||||
"amount": 0.001,
|
||||
"txid": "txid...",
|
||||
"block_height": 12345,
|
||||
"confirmations": 6,
|
||||
"created_at": "2024-12-19T14:30:00Z",
|
||||
"status": "confirmed"
|
||||
}
|
||||
```
|
||||
|
||||
### Codes de Statut HTTP
|
||||
|
||||
- `200` : Succès
|
||||
- `201` : Créé
|
||||
- `400` : Requête invalide
|
||||
- `404` : Ressource non trouvée
|
||||
- `500` : Erreur serveur
|
||||
|
||||
## 3. API SDK Relay WebSocket
|
||||
|
||||
### Informations Générales
|
||||
|
||||
- **Protocole :** WebSocket/WSS
|
||||
- **Port :** 8090
|
||||
- **URL :** `ws://localhost:8090` ou `wss://localhost:8090`
|
||||
- **Format :** JSON
|
||||
|
||||
### Connexion
|
||||
|
||||
```javascript
|
||||
const ws = new WebSocket('ws://localhost:8090');
|
||||
|
||||
ws.onopen = function() {
|
||||
console.log('Connexion WebSocket établie');
|
||||
};
|
||||
|
||||
ws.onmessage = function(event) {
|
||||
const message = JSON.parse(event.data);
|
||||
console.log('Message reçu:', message);
|
||||
};
|
||||
|
||||
ws.onerror = function(error) {
|
||||
console.error('Erreur WebSocket:', error);
|
||||
};
|
||||
|
||||
ws.onclose = function() {
|
||||
console.log('Connexion WebSocket fermée');
|
||||
};
|
||||
```
|
||||
|
||||
### Format des Messages
|
||||
|
||||
Tous les messages suivent le format JSON suivant :
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "message_type",
|
||||
"id": "unique_message_id",
|
||||
"timestamp": 1234567890,
|
||||
"data": {
|
||||
// Données spécifiques au type de message
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Types de Messages
|
||||
|
||||
#### Messages de Synchronisation
|
||||
|
||||
**StateSync :**
|
||||
```json
|
||||
{
|
||||
"type": "StateSync",
|
||||
"id": "state_001",
|
||||
"timestamp": 1234567890,
|
||||
"data": {
|
||||
"relay_id": "relay-1",
|
||||
"state": "running",
|
||||
"version": "1.1.0",
|
||||
"uptime": 3600
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**HealthSync :**
|
||||
```json
|
||||
{
|
||||
"type": "HealthSync",
|
||||
"id": "health_001",
|
||||
"timestamp": 1234567890,
|
||||
"data": {
|
||||
"relay_id": "relay-1",
|
||||
"status": "healthy",
|
||||
"uptime": 3600,
|
||||
"cpu_usage": 15.5,
|
||||
"memory_usage": 45.2
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**MetricsSync :**
|
||||
```json
|
||||
{
|
||||
"type": "MetricsSync",
|
||||
"id": "metrics_001",
|
||||
"timestamp": 1234567890,
|
||||
"data": {
|
||||
"relay_id": "relay-1",
|
||||
"messages_sent": 1000,
|
||||
"messages_received": 950,
|
||||
"sync_errors": 5,
|
||||
"connected_relays": 3
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Messages de Transaction
|
||||
|
||||
**TransactionReceived :**
|
||||
```json
|
||||
{
|
||||
"type": "TransactionReceived",
|
||||
"id": "tx_001",
|
||||
"timestamp": 1234567890,
|
||||
"data": {
|
||||
"txid": "txid...",
|
||||
"amount": 0.001,
|
||||
"address": "bc1p...",
|
||||
"block_height": 12345,
|
||||
"confirmations": 1
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**BlockScanned :**
|
||||
```json
|
||||
{
|
||||
"type": "BlockScanned",
|
||||
"id": "block_001",
|
||||
"timestamp": 1234567890,
|
||||
"data": {
|
||||
"block_height": 12345,
|
||||
"block_hash": "hash...",
|
||||
"transactions_count": 150,
|
||||
"silent_payments_found": 2
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Commandes Client
|
||||
|
||||
#### Ping
|
||||
```json
|
||||
{
|
||||
"type": "ping",
|
||||
"id": "ping_001",
|
||||
"timestamp": 1234567890,
|
||||
"data": {}
|
||||
}
|
||||
```
|
||||
|
||||
**Réponse :**
|
||||
```json
|
||||
{
|
||||
"type": "pong",
|
||||
"id": "ping_001",
|
||||
"timestamp": 1234567890,
|
||||
"data": {
|
||||
"relay_id": "relay-1"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### GetStatus
|
||||
```json
|
||||
{
|
||||
"type": "get_status",
|
||||
"id": "status_001",
|
||||
"timestamp": 1234567890,
|
||||
"data": {}
|
||||
}
|
||||
```
|
||||
|
||||
**Réponse :**
|
||||
```json
|
||||
{
|
||||
"type": "status",
|
||||
"id": "status_001",
|
||||
"timestamp": 1234567890,
|
||||
"data": {
|
||||
"relay_id": "relay-1",
|
||||
"status": "running",
|
||||
"uptime": 3600,
|
||||
"connected_relays": 3,
|
||||
"last_block_height": 12345
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 4. API SDK Relay HTTP
|
||||
|
||||
### Informations Générales
|
||||
|
||||
- **Protocole :** HTTP REST
|
||||
- **Port :** 8091
|
||||
- **Base URL :** `http://localhost:8091`
|
||||
- **Content-Type :** `application/json`
|
||||
|
||||
### Endpoints
|
||||
|
||||
#### GET /health
|
||||
Vérifie la santé du relais.
|
||||
|
||||
**Requête :**
|
||||
```bash
|
||||
curl -X GET http://localhost:8091/health
|
||||
```
|
||||
|
||||
**Réponse :**
|
||||
```json
|
||||
{
|
||||
"status": "healthy",
|
||||
"relay_id": "relay-1",
|
||||
"uptime": 3600,
|
||||
"version": "1.1.0",
|
||||
"connected_relays": 3
|
||||
}
|
||||
```
|
||||
|
||||
#### GET /status
|
||||
Récupère le statut détaillé du relais.
|
||||
|
||||
**Requête :**
|
||||
```bash
|
||||
curl -X GET http://localhost:8091/status
|
||||
```
|
||||
|
||||
**Réponse :**
|
||||
```json
|
||||
{
|
||||
"relay_id": "relay-1",
|
||||
"status": "running",
|
||||
"uptime": 3600,
|
||||
"version": "1.0.0",
|
||||
"connected_relays": 3,
|
||||
"last_block_height": 12345,
|
||||
"sync_metrics": {
|
||||
"messages_sent": 1000,
|
||||
"messages_received": 950,
|
||||
"sync_errors": 5
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### GET /relays
|
||||
Liste les relais connectés.
|
||||
|
||||
**Requête :**
|
||||
```bash
|
||||
curl -X GET http://localhost:8091/relays
|
||||
```
|
||||
|
||||
**Réponse :**
|
||||
```json
|
||||
{
|
||||
"relays": [
|
||||
{
|
||||
"relay_id": "relay-2",
|
||||
"address": "sdk_relay_2:8090",
|
||||
"status": "connected",
|
||||
"connected_since": 1234567890,
|
||||
"last_heartbeat": 1234567890
|
||||
},
|
||||
{
|
||||
"relay_id": "relay-3",
|
||||
"address": "sdk_relay_3:8090",
|
||||
"status": "connected",
|
||||
"connected_since": 1234567890,
|
||||
"last_heartbeat": 1234567890
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
#### GET /metrics
|
||||
Récupère les métriques de synchronisation.
|
||||
|
||||
**Requête :**
|
||||
```bash
|
||||
curl -X GET http://localhost:8091/metrics
|
||||
```
|
||||
|
||||
**Réponse :**
|
||||
```json
|
||||
{
|
||||
"messages_sent": 1000,
|
||||
"messages_received": 950,
|
||||
"sync_errors": 5,
|
||||
"last_sync_timestamp": 1234567890,
|
||||
"connected_relays": 3,
|
||||
"mesh_health": 0.95
|
||||
}
|
||||
```
|
||||
|
||||
#### POST /sync
|
||||
Force une synchronisation manuelle.
|
||||
|
||||
**Requête :**
|
||||
```json
|
||||
{
|
||||
"sync_type": "StateSync",
|
||||
"target_relay": "relay-2"
|
||||
}
|
||||
```
|
||||
|
||||
**Réponse :**
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"message": "Synchronisation initiée",
|
||||
"sync_id": "sync_001"
|
||||
}
|
||||
```
|
||||
|
||||
## 5. API SDK Storage HTTP
|
||||
|
||||
### Informations générales
|
||||
|
||||
- **Protocole :** HTTP REST
|
||||
- **Port interne :** 8081 (proxifié)
|
||||
- **Base URL via proxy :** `https://<hôte>/storage/`
|
||||
- **Content-Type :** `application/json`
|
||||
|
||||
### Endpoints
|
||||
|
||||
#### POST /storage/store
|
||||
Corps JSON : `{ key: string(hex64), value: string(hex), ttl?: number(seconds) }`
|
||||
|
||||
Réponses :
|
||||
- 200 OK : `{ "message": "Data stored successfully." }`
|
||||
- 400/409 : message d’erreur explicite
|
||||
|
||||
#### GET /storage/retrieve/{key}
|
||||
Paramètre `key` : hex 64 caractères.
|
||||
|
||||
Réponses :
|
||||
- 200 OK : `{ key, value }` avec `value` en hex
|
||||
- 400/404 : message d’erreur
|
||||
|
||||
Notes :
|
||||
- Sans `ttl`, si l’application est lancée avec `--permanent`, la donnée est permanente; sinon TTL par défaut 86400s.
|
||||
- Les données sont stockées sur volume persistant `sdk_storage_data`.
|
||||
|
||||
## 6. Gestion des Erreurs
|
||||
|
||||
### Erreurs WebSocket
|
||||
|
||||
**Erreur de connexion :**
|
||||
```json
|
||||
{
|
||||
"type": "error",
|
||||
"id": "error_001",
|
||||
"timestamp": 1234567890,
|
||||
"data": {
|
||||
"code": "CONNECTION_ERROR",
|
||||
"message": "Impossible de se connecter au relais",
|
||||
"details": "Connection refused"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Erreur de message :**
|
||||
```json
|
||||
{
|
||||
"type": "error",
|
||||
"id": "error_002",
|
||||
"timestamp": 1234567890,
|
||||
"data": {
|
||||
"code": "INVALID_MESSAGE",
|
||||
"message": "Format de message invalide",
|
||||
"details": "Missing required field 'type'"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Erreurs HTTP
|
||||
|
||||
**Erreur 400 :**
|
||||
```json
|
||||
{
|
||||
"error": {
|
||||
"code": "INVALID_REQUEST",
|
||||
"message": "Requête invalide",
|
||||
"details": "Missing required parameter 'relay_id'"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Erreur 500 :**
|
||||
```json
|
||||
{
|
||||
"error": {
|
||||
"code": "INTERNAL_ERROR",
|
||||
"message": "Erreur interne du serveur",
|
||||
"details": "Database connection failed"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 6. Exemples d'Utilisation
|
||||
|
||||
### Exemple Python - WebSocket
|
||||
|
||||
```python
|
||||
import asyncio
|
||||
import websockets
|
||||
import json
|
||||
|
||||
async def connect_to_relay():
|
||||
uri = "ws://localhost:8090"
|
||||
async with websockets.connect(uri) as websocket:
|
||||
# Envoyer un ping
|
||||
ping_message = {
|
||||
"type": "ping",
|
||||
"id": "ping_001",
|
||||
"timestamp": int(time.time()),
|
||||
"data": {}
|
||||
}
|
||||
await websocket.send(json.dumps(ping_message))
|
||||
|
||||
# Écouter les messages
|
||||
async for message in websocket:
|
||||
data = json.loads(message)
|
||||
print(f"Message reçu: {data}")
|
||||
|
||||
asyncio.run(connect_to_relay())
|
||||
```
|
||||
|
||||
### Exemple JavaScript - WebSocket
|
||||
|
||||
```javascript
|
||||
const ws = new WebSocket('ws://localhost:8090');
|
||||
|
||||
ws.onopen = function() {
|
||||
// Envoyer un ping
|
||||
const pingMessage = {
|
||||
type: 'ping',
|
||||
id: 'ping_001',
|
||||
timestamp: Date.now(),
|
||||
data: {}
|
||||
};
|
||||
ws.send(JSON.stringify(pingMessage));
|
||||
};
|
||||
|
||||
ws.onmessage = function(event) {
|
||||
const message = JSON.parse(event.data);
|
||||
console.log('Message reçu:', message);
|
||||
};
|
||||
```
|
||||
|
||||
### Exemple cURL - Bitcoin Core RPC
|
||||
|
||||
```bash
|
||||
# Récupérer les informations de la blockchain
|
||||
curl -X POST http://localhost:18443 \
|
||||
-H "Content-Type: application/json" \
|
||||
--data '{
|
||||
"jsonrpc": "1.0",
|
||||
"id": "test",
|
||||
"method": "getblockchaininfo",
|
||||
"params": []
|
||||
}'
|
||||
|
||||
# Récupérer un bloc spécifique
|
||||
curl -X POST http://localhost:18443 \
|
||||
-H "Content-Type: application/json" \
|
||||
--data '{
|
||||
"jsonrpc": "1.0",
|
||||
"id": "test",
|
||||
"method": "getblock",
|
||||
"params": ["blockhash", 2]
|
||||
}'
|
||||
```
|
||||
|
||||
## 7. Limites et Quotas
|
||||
|
||||
### Bitcoin Core RPC
|
||||
- **Taux limite :** 1000 requêtes/minute par défaut
|
||||
- **Taille des requêtes :** 32MB maximum
|
||||
- **Connexions simultanées :** 125 par défaut
|
||||
|
||||
### Blindbit HTTP
|
||||
- **Taux limite :** 100 requêtes/minute
|
||||
- **Taille des requêtes :** 10MB maximum
|
||||
- **Connexions simultanées :** 50
|
||||
|
||||
### SDK Relay WebSocket
|
||||
- **Connexions simultanées :** 1000 par relais
|
||||
- **Taille des messages :** 1MB maximum
|
||||
- **Heartbeat :** 30 secondes
|
||||
|
||||
### SDK Relay HTTP
|
||||
- **Taux limite :** 200 requêtes/minute
|
||||
- **Taille des requêtes :** 5MB maximum
|
||||
- **Connexions simultanées :** 100
|
||||
|
||||
## 8. Sécurité
|
||||
|
||||
### Authentification
|
||||
- **Bitcoin Core :** Cookie d'authentification
|
||||
- **Blindbit :** À définir selon les besoins
|
||||
- **SDK Relay :** Authentification WebSocket (optionnelle)
|
||||
|
||||
### Chiffrement
|
||||
- **RPC Bitcoin :** HTTP (non chiffré en local)
|
||||
- **HTTP Blindbit :** HTTP (non chiffré en local)
|
||||
- **WebSocket SDK Relay :** WSS (chiffré)
|
||||
|
||||
### Bonnes Pratiques
|
||||
- Utiliser HTTPS/WSS en production
|
||||
- Implémenter l'authentification appropriée
|
||||
- Valider toutes les entrées
|
||||
- Limiter les taux de requêtes
|
||||
- Monitorer les accès
|
||||
|
||||
## 9. Monitoring et Observabilité
|
||||
|
||||
### Métriques à Surveiller
|
||||
- **Latence des APIs :** Temps de réponse
|
||||
- **Taux d'erreur :** Pourcentage d'erreurs
|
||||
- **Débit :** Requêtes par seconde
|
||||
- **Utilisation des ressources :** CPU, mémoire, réseau
|
||||
|
||||
### Logs
|
||||
- **Logs d'accès :** Requêtes et réponses
|
||||
- **Logs d'erreur :** Erreurs et exceptions
|
||||
- **Logs de performance :** Métriques de performance
|
||||
|
||||
### Alertes
|
||||
- **Erreurs 5xx :** Erreurs serveur
|
||||
- **Latence élevée :** Temps de réponse > 1s
|
||||
- **Taux d'erreur élevé :** > 5%
|
||||
- **Services indisponibles :** Health checks en échec
|
||||
|
||||
|
@ -1,500 +0,0 @@
|
||||
# Architecture Technique - 4NK_node
|
||||
|
||||
Ce guide décrit l'architecture technique détaillée de l'infrastructure 4NK_node, incluant la synchronisation entre relais et les composants système.
|
||||
|
||||
## Vue d'Ensemble de l'Architecture
|
||||
|
||||
L'infrastructure 4NK_node est composée de plusieurs services interconnectés qui forment un système distribué pour les paiements silencieux Bitcoin.
|
||||
|
||||
### Architecture Générale
|
||||
|
||||
```
|
||||
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
|
||||
│ Bitcoin Core │ │ Blindbit │ │ SDK Relay 1 │
|
||||
│ (Signet) │ │ (Service SP) │ │ (WebSocket) │
|
||||
│ Port: 18443 │ │ Port: 8000 │ │ Port: 8090 │
|
||||
└─────────────────┘ └─────────────────┘ └─────────────────┘
|
||||
│ │ │
|
||||
└───────────────────────┼───────────────────────┘
|
||||
│
|
||||
┌─────────────────┐
|
||||
│ Docker Network │
|
||||
│ (btcnet) │
|
||||
└─────────────────┘
|
||||
│
|
||||
┌─────────────────┐
|
||||
│ SDK Relay 2 │
|
||||
│ (WebSocket) │
|
||||
│ Port: 8092 │
|
||||
└─────────────────┘
|
||||
│
|
||||
┌─────────────────┐
|
||||
│ SDK Relay 3 │
|
||||
│ (WebSocket) │
|
||||
│ Port: 8094 │
|
||||
└─────────────────┘
|
||||
```
|
||||
|
||||
### Reverse proxy public (Nginx)
|
||||
|
||||
Un reverse proxy dédié assure désormais l'exposition publique unique de l'infrastructure :
|
||||
|
||||
- Sert les assets statiques de l’interface `ihm_client` générés dans `ihm_client/dist`
|
||||
- Termine TLS en 443 (auto-signé par défaut) et force la redirection HTTP→HTTPS
|
||||
- Proxifie les routes applicatives :
|
||||
- `/` → UI statique
|
||||
- `/api/` → `sdk_relay_1` (HTTP)
|
||||
- `/ws/` → `sdk_relay_1` (WebSocket, upgrade)
|
||||
- `/storage/` → `sdk_storage` (HTTP 8081 via proxy)
|
||||
- `/signer/ws/` → `sdk_signer` (WebSocket 9090 via proxy)
|
||||
- `/signer/health` → `sdk_signer` (HTTP 9092 via sidecar httpd pour health)
|
||||
- Tous les autres services restent strictement internes au réseau Docker `btcnet`
|
||||
|
||||
## Composants Principaux
|
||||
|
||||
### 1. Bitcoin Core (Nœud Signet)
|
||||
|
||||
**Rôle :** Nœud Bitcoin Core configuré en mode signet pour le développement et les tests.
|
||||
|
||||
**Caractéristiques :**
|
||||
- **Port RPC :** 18443
|
||||
- **Port ZMQ :** 29000
|
||||
- **Réseau :** Signet
|
||||
- **Validation :** Complète des transactions
|
||||
- **Stockage :** Blockchain complète
|
||||
- **Interface :** JSON-RPC
|
||||
|
||||
**Fonctionnalités :**
|
||||
- Validation des transactions
|
||||
- Stockage de la blockchain
|
||||
- Interface RPC pour les interactions
|
||||
- Support des wallets
|
||||
- Notifications ZMQ pour les événements
|
||||
|
||||
### 2. Service Blindbit
|
||||
|
||||
**Rôle :** Service pour les paiements silencieux (Silent Payments).
|
||||
|
||||
**Caractéristiques :**
|
||||
- **Port :** 8000
|
||||
- **Interface :** HTTP REST API
|
||||
- **Protocole :** HTTP
|
||||
|
||||
**Fonctionnalités :**
|
||||
- Génération d'adresses de paiement silencieux
|
||||
- Validation des transactions
|
||||
- Interface HTTP pour les interactions
|
||||
- Gestion des clés et signatures
|
||||
|
||||
### 3. Service SDK Relay
|
||||
### 4. Service SDK Storage
|
||||
### 5. Service SDK Signer
|
||||
|
||||
**Rôle :** Serveur WebSocket de signature/gestion de processus, connecté aux relais SDK.
|
||||
|
||||
**Caractéristiques :**
|
||||
- Port interne : 9090 (WebSocket)
|
||||
- Santé : HTTP 9092 (sidecar httpd minimal) exposé via `/signer/health`
|
||||
- Dépendances : `sdk_relay_1` (URL relay `ws://sdk_relay_1:8090`)
|
||||
- Publication : via reverse proxy en `/signer/ws/`
|
||||
- Persistance : volume `sdk_signer_data` pour la base locale
|
||||
|
||||
**Rôle :** Stockage clé/valeur TTL simple pour échanges temporisés.
|
||||
|
||||
**Caractéristiques :**
|
||||
- Port interne : 8081
|
||||
- Endpoints : `/store` (POST), `/retrieve/:key` (GET)
|
||||
- Persistance : volume `sdk_storage_data` mappé sur `/app/storage`
|
||||
- Publication : uniquement via reverse proxy en `/storage/*`
|
||||
|
||||
|
||||
**Rôle :** Relais pour les interactions SDK avec synchronisation mesh.
|
||||
|
||||
**Caractéristiques :**
|
||||
- **Port WebSocket :** 8090
|
||||
- **Port HTTP :** 8091
|
||||
- **Protocole :** WebSocket/WSS
|
||||
- **Synchronisation :** Mesh network
|
||||
|
||||
**Fonctionnalités :**
|
||||
- Connexion au nœud Bitcoin Core
|
||||
- Gestion des wallets
|
||||
- Interface WebSocket
|
||||
- Scan des blocs pour les paiements silencieux
|
||||
- Synchronisation entre relais
|
||||
- Cache de déduplication
|
||||
|
||||
## Architecture de Synchronisation
|
||||
|
||||
### Gestionnaire de Synchronisation (`SyncManager`)
|
||||
|
||||
Le `SyncManager` est le composant central qui gère toute la logique de synchronisation entre les relais :
|
||||
|
||||
```rust
|
||||
pub struct SyncManager {
|
||||
relay_id: String,
|
||||
sequence_counter: Arc<Mutex<u64>>,
|
||||
sync_cache: Arc<Mutex<HashMap<String, Instant>>>,
|
||||
last_sync: Arc<Mutex<HashMap<SyncType, u64>>>,
|
||||
mesh_connections: Arc<Mutex<HashMap<String, MeshConnection>>>,
|
||||
known_relays: Arc<Mutex<HashMap<String, RelayInfo>>>,
|
||||
metrics: Arc<Mutex<SyncMetrics>>,
|
||||
}
|
||||
```
|
||||
|
||||
### Types de Synchronisation
|
||||
|
||||
Le système supporte plusieurs types de synchronisation :
|
||||
|
||||
- **StateSync** : Synchronisation de l'état général du relais
|
||||
- **ProcessSync** : Synchronisation des processus en cours
|
||||
- **MemberSync** : Synchronisation des membres
|
||||
- **TxSync** : Synchronisation des transactions
|
||||
- **BlockSync** : Synchronisation des blocs
|
||||
- **PeerSync** : Synchronisation des pairs connectés
|
||||
- **RelaySync** : Synchronisation des informations des relais
|
||||
- **HealthSync** : Synchronisation de la santé du relais
|
||||
- **MetricsSync** : Synchronisation des métriques
|
||||
- **ConfigSync** : Synchronisation de la configuration
|
||||
- **CapabilitySync** : Synchronisation des capacités
|
||||
|
||||
### Messages de Synchronisation
|
||||
|
||||
#### Structure des Messages
|
||||
|
||||
```rust
|
||||
pub struct SyncMessage {
|
||||
pub sync_type: SyncType,
|
||||
pub relay_id: String,
|
||||
pub sequence: u64,
|
||||
pub timestamp: u64,
|
||||
pub payload: SyncPayload,
|
||||
}
|
||||
```
|
||||
|
||||
#### Types de Payload
|
||||
|
||||
```rust
|
||||
pub enum SyncPayload {
|
||||
StateData { state: String, version: String },
|
||||
ProcessData { processes: HashMap<String, String> },
|
||||
MemberData { members: HashMap<String, String> },
|
||||
HealthData { status: HealthStatus, uptime: u64, cpu_usage: f64 },
|
||||
MetricsData { metrics: SyncMetrics },
|
||||
PeerData { peers: Vec<PeerInfo>, last_seen: u64 },
|
||||
RelayData { relays: Vec<RelayInfo>, network_topology: NetworkTopology },
|
||||
}
|
||||
```
|
||||
|
||||
## Fonctionnalités de Synchronisation
|
||||
|
||||
### 1. Découverte Automatique des Relais
|
||||
|
||||
Le système implémente une découverte automatique des relais dans le réseau :
|
||||
|
||||
```rust
|
||||
pub async fn discover_relays(&self) -> Result<()> {
|
||||
let relay_hosts = vec![
|
||||
"sdk_relay_1",
|
||||
"sdk_relay_2",
|
||||
"sdk_relay_3",
|
||||
];
|
||||
|
||||
for host in relay_hosts {
|
||||
if host == self.relay_id {
|
||||
continue; // Ignorer soi-même
|
||||
}
|
||||
|
||||
let relay_info = RelayInfo {
|
||||
relay_id: host.to_string(),
|
||||
address: format!("{}:8090", host),
|
||||
// ... autres champs
|
||||
};
|
||||
|
||||
self.add_relay(relay_info)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
```
|
||||
|
||||
### 2. Cache de Déduplication
|
||||
|
||||
Pour éviter les doublons, un cache de déduplication est implémenté :
|
||||
|
||||
```rust
|
||||
pub struct MessageCache {
|
||||
cache: Arc<Mutex<HashMap<String, Instant>>>,
|
||||
}
|
||||
|
||||
impl MessageCache {
|
||||
pub fn is_duplicate(&self, message_id: &str) -> bool {
|
||||
let mut cache = self.cache.lock().unwrap();
|
||||
if cache.contains_key(message_id) {
|
||||
true
|
||||
} else {
|
||||
cache.insert(message_id.to_string(), Instant::now());
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 3. Synchronisation Périodique
|
||||
|
||||
Le système effectue une synchronisation périodique avec des intervalles configurés :
|
||||
|
||||
- **Synchronisation d'état** : Toutes les 30 secondes
|
||||
- **Synchronisation de santé** : Toutes les 60 secondes
|
||||
- **Synchronisation de métriques** : Toutes les 120 secondes
|
||||
- **Synchronisation des relais** : Toutes les 300 secondes (5 minutes)
|
||||
|
||||
### 4. Gestion des Connexions Mesh
|
||||
|
||||
```rust
|
||||
pub struct MeshConnection {
|
||||
pub relay_id: String,
|
||||
pub address: String,
|
||||
pub connected_since: u64,
|
||||
pub last_heartbeat: u64,
|
||||
pub status: ConnectionStatus,
|
||||
}
|
||||
```
|
||||
|
||||
## Configuration Multi-Relais
|
||||
|
||||
### Configuration Docker
|
||||
|
||||
Le système supporte la configuration de plusieurs relais via Docker, avec une publication unique via reverse proxy :
|
||||
|
||||
```yaml
|
||||
# Publication unique via reverse proxy
|
||||
services:
|
||||
reverse_proxy:
|
||||
image: nginx:alpine
|
||||
volumes:
|
||||
- ./proxy/nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
||||
- ./certs:/etc/nginx/certs:ro
|
||||
- ./ihm_client/dist:/usr/share/nginx/html:ro
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
networks:
|
||||
- btcnet
|
||||
|
||||
# Relais internes seulement (pas de ports exposés)
|
||||
sdk_relay_1:
|
||||
networks:
|
||||
- btcnet
|
||||
sdk_relay_2:
|
||||
networks:
|
||||
- btcnet
|
||||
sdk_relay_3:
|
||||
networks:
|
||||
- btcnet
|
||||
```
|
||||
|
||||
### Configuration par Relais
|
||||
|
||||
Chaque relais a sa propre configuration :
|
||||
|
||||
```ini
|
||||
# .conf.docker.relay1
|
||||
relay_id=relay-1
|
||||
ws_url=0.0.0.0:8090
|
||||
|
||||
# .conf.docker.relay2
|
||||
relay_id=relay-2
|
||||
ws_url=0.0.0.0:8090
|
||||
|
||||
# .conf.docker.relay3
|
||||
relay_id=relay-3
|
||||
ws_url=0.0.0.0:8090
|
||||
```
|
||||
|
||||
## Métriques de Synchronisation
|
||||
|
||||
```rust
|
||||
pub struct SyncMetrics {
|
||||
pub messages_sent: u64,
|
||||
pub messages_received: u64,
|
||||
pub sync_errors: u64,
|
||||
pub last_sync_timestamp: u64,
|
||||
pub connected_relays: u64,
|
||||
pub mesh_health: f64,
|
||||
}
|
||||
```
|
||||
|
||||
## Flux de Données
|
||||
|
||||
### 1. Flux de Synchronisation
|
||||
|
||||
```
|
||||
Relay 1 ──┐
|
||||
├─── SyncManager ──── MessageCache ──── Mesh Network
|
||||
Relay 2 ──┤
|
||||
│
|
||||
Relay 3 ──┘
|
||||
```
|
||||
|
||||
### 2. Flux de Traitement des Transactions
|
||||
|
||||
```
|
||||
Bitcoin Core ──── ZMQ Notifications ──── SDK Relay ──── Blindbit
|
||||
│ │ │ │
|
||||
└─── Block Scan ─────┴─── Silent Payment ─┴─── Validation
|
||||
```
|
||||
|
||||
### 3. Flux de Communication WebSocket
|
||||
|
||||
```
|
||||
Client ──── WebSocket ──── SDK Relay ──── Bitcoin Core RPC
|
||||
│ │ │
|
||||
└─── Events ─┴─── Commands ─┴─── Responses
|
||||
```
|
||||
|
||||
## Sécurité et Isolation
|
||||
|
||||
### 1. Isolation Réseau
|
||||
|
||||
- **Réseau privé :** `btcnet` pour la communication inter-services
|
||||
- **Ports exposés :** Uniquement 80/443 sur `reverse_proxy` ; tous les autres services sont internes (aucune publication de ports)
|
||||
- **Volumes :** Données persistantes isolées
|
||||
|
||||
### 2. Authentification
|
||||
|
||||
- **Bitcoin Core :** Cookie d'authentification
|
||||
- **Blindbit :** À définir selon les besoins
|
||||
- **SDK Relay :** Authentification WebSocket
|
||||
- **Tor :** Pas d'authentification requise
|
||||
|
||||
### 3. Chiffrement
|
||||
|
||||
- **RPC Bitcoin :** HTTP (non chiffré en local)
|
||||
- **HTTP Blindbit :** HTTP (non chiffré en local)
|
||||
- **WebSocket SDK Relay :** WSS (chiffré)
|
||||
- **Tor :** Chiffrement intégré
|
||||
|
||||
## Performance et Optimisations
|
||||
|
||||
### 1. Ressources Requises
|
||||
|
||||
- **CPU :** Minimum 2 cœurs
|
||||
- **RAM :** Minimum 4 GB
|
||||
- **Stockage :** Minimum 50 GB pour la blockchain
|
||||
- **Réseau :** Connexion stable à Internet
|
||||
|
||||
### 2. Optimisations Implémentées
|
||||
|
||||
- **Cache :** Mise en cache des données fréquemment utilisées
|
||||
- **Compression :** Compression des données de blockchain
|
||||
- **Parallélisation :** Traitement parallèle des blocs
|
||||
- **Monitoring :** Métriques de performance
|
||||
|
||||
### 3. Métriques de Performance
|
||||
|
||||
- **Latence de synchronisation :** < 100ms
|
||||
- **Débit de messages :** > 1000 msg/s
|
||||
- **Utilisation mémoire :** < 2GB par relais
|
||||
- **Temps de démarrage :** < 30 secondes
|
||||
|
||||
## Monitoring et Observabilité
|
||||
|
||||
### 1. Métriques Collectées
|
||||
|
||||
- **Métriques système :** CPU, RAM, disque, réseau
|
||||
- **Métriques de synchronisation :** Messages envoyés/reçus, erreurs
|
||||
- **Métriques de santé :** Uptime, statut des connexions
|
||||
- **Métriques métier :** Transactions traitées, paiements détectés
|
||||
|
||||
### 2. Logs
|
||||
|
||||
- **Logs système :** Démarrage, arrêt, erreurs
|
||||
- **Logs de synchronisation :** Messages, erreurs, métriques
|
||||
- **Logs métier :** Transactions, paiements, événements
|
||||
|
||||
### 3. Alertes
|
||||
|
||||
- **Alertes critiques :** Services arrêtés, erreurs de synchronisation
|
||||
- **Alertes de performance :** Latence élevée, utilisation mémoire
|
||||
- **Alertes métier :** Échecs de traitement, anomalies
|
||||
|
||||
## Évolutivité
|
||||
|
||||
### 1. Scalabilité Horizontale
|
||||
|
||||
- **Ajout de relais :** Configuration automatique
|
||||
- **Load balancing :** Distribution de charge
|
||||
- **Redondance :** Relais de secours
|
||||
|
||||
### 2. Scalabilité Verticale
|
||||
|
||||
- **Ressources :** Augmentation CPU/RAM
|
||||
- **Stockage :** Extension des volumes
|
||||
- **Réseau :** Bande passante
|
||||
|
||||
### 3. Architecture Distribuée
|
||||
|
||||
- **Microservices :** Services indépendants
|
||||
- **API Gateway :** Point d'entrée unifié
|
||||
- **Service Discovery :** Découverte automatique
|
||||
|
||||
## Déploiement et Infrastructure
|
||||
|
||||
### 1. Environnements
|
||||
|
||||
- **Développement :** Configuration locale
|
||||
- **Test :** Environnement de test
|
||||
- **Production :** Configuration optimisée
|
||||
|
||||
### 2. Orchestration
|
||||
|
||||
- **Docker Compose :** Orchestration locale
|
||||
- **Kubernetes :** Orchestration distribuée (futur)
|
||||
- **Service Mesh :** Communication inter-services
|
||||
|
||||
### 3. CI/CD
|
||||
|
||||
- **Build :** Construction des images
|
||||
- **Test :** Tests automatisés
|
||||
- **Déploiement :** Déploiement automatique
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### 1. Problèmes de Synchronisation
|
||||
|
||||
- **Connexions perdues :** Vérifier la connectivité réseau
|
||||
- **Messages dupliqués :** Vérifier le cache de déduplication
|
||||
- **Latence élevée :** Vérifier les ressources système
|
||||
|
||||
### 2. Problèmes de Performance
|
||||
|
||||
- **Utilisation mémoire :** Vérifier les fuites mémoire
|
||||
- **CPU élevé :** Vérifier les boucles infinies
|
||||
- **Disque plein :** Nettoyer les logs et données
|
||||
|
||||
### 3. Problèmes de Configuration
|
||||
|
||||
- **Ports bloqués :** Vérifier le pare-feu
|
||||
- **Volumes manquants :** Vérifier les permissions
|
||||
- **Variables d'environnement :** Vérifier la configuration
|
||||
|
||||
## Évolution Future
|
||||
|
||||
### 1. Améliorations Planifiées
|
||||
|
||||
- **Synchronisation temps réel :** Réduction de la latence
|
||||
- **Compression avancée :** Optimisation de la bande passante
|
||||
- **Chiffrement end-to-end :** Sécurité renforcée
|
||||
|
||||
### 2. Nouvelles Fonctionnalités
|
||||
|
||||
- **API REST :** Interface REST pour les clients
|
||||
- **Webhooks :** Notifications en temps réel
|
||||
- **Analytics :** Tableaux de bord avancés
|
||||
|
||||
### 3. Intégrations
|
||||
|
||||
- **Monitoring :** Prometheus, Grafana
|
||||
- **Logging :** ELK Stack
|
||||
- **Alerting :** PagerDuty, Slack
|
@ -1,238 +0,0 @@
|
||||
# Automatisation SSH pour Push - ihm_client
|
||||
|
||||
## Vue d'ensemble
|
||||
|
||||
L'automatisation SSH pour les push permet d'utiliser automatiquement votre clé SSH pour tous les push vers le repository `ihm_client` sur Gitea, sans avoir à spécifier manuellement les paramètres SSH.
|
||||
|
||||
## Configuration automatique
|
||||
|
||||
### 1. Configuration Git globale
|
||||
|
||||
La configuration SSH est automatiquement appliquée :
|
||||
|
||||
```bash
|
||||
git config --global url."git@git.4nkweb.com:".insteadOf "https://git.4nkweb.com/"
|
||||
```
|
||||
|
||||
### 2. Vérification SSH
|
||||
|
||||
Le script vérifie automatiquement la configuration SSH :
|
||||
|
||||
```bash
|
||||
ssh -T git@git.4nkweb.com
|
||||
```
|
||||
|
||||
## Scripts d'automatisation
|
||||
|
||||
### Script principal : `auto-ssh-push.sh`
|
||||
|
||||
Le script `scripts/auto-ssh-push.sh` offre plusieurs modes de push automatique :
|
||||
|
||||
#### Options disponibles
|
||||
|
||||
```bash
|
||||
# Push rapide (message automatique)
|
||||
./scripts/auto-ssh-push.sh quick
|
||||
|
||||
# Push avec message personnalisé
|
||||
./scripts/auto-ssh-push.sh message "feat: nouvelle fonctionnalité"
|
||||
|
||||
# Push sur une branche spécifique
|
||||
./scripts/auto-ssh-push.sh branch feature/nouvelle-fonctionnalite
|
||||
|
||||
# Push et préparation merge
|
||||
./scripts/auto-ssh-push.sh merge feature/nouvelle-fonctionnalite main
|
||||
|
||||
# Status et push conditionnel
|
||||
./scripts/auto-ssh-push.sh status
|
||||
```
|
||||
|
||||
#### Exemples d'utilisation
|
||||
|
||||
```bash
|
||||
# Push rapide sur la branche courante
|
||||
./scripts/auto-ssh-push.sh quick
|
||||
|
||||
# Push avec message de commit
|
||||
./scripts/auto-ssh-push.sh message "fix: correction du bug de synchronisation"
|
||||
|
||||
# Push sur une branche spécifique
|
||||
./scripts/auto-ssh-push.sh branch develop
|
||||
|
||||
# Push et création de Pull Request
|
||||
./scripts/auto-ssh-push.sh merge feature/nouvelle-fonctionnalite main
|
||||
```
|
||||
|
||||
### Alias Git globaux
|
||||
|
||||
Des alias Git ont été configurés pour simplifier les push :
|
||||
|
||||
```bash
|
||||
# Push avec message personnalisé
|
||||
git ssh-push "Mon message de commit"
|
||||
|
||||
# Push rapide (message automatique)
|
||||
git quick-push
|
||||
```
|
||||
|
||||
## Fonctionnalités automatiques
|
||||
|
||||
### 1. Configuration SSH automatique
|
||||
|
||||
- Configuration Git pour utiliser SSH
|
||||
- Vérification de l'authentification SSH
|
||||
- Gestion des erreurs de configuration
|
||||
|
||||
### 2. Push automatique
|
||||
|
||||
- Ajout automatique de tous les changements (`git add .`)
|
||||
- Commit automatique avec message
|
||||
- Push automatique vers la branche courante
|
||||
|
||||
### 3. Gestion des branches
|
||||
|
||||
- Détection automatique de la branche courante
|
||||
- Support des branches personnalisées
|
||||
- Préparation des Pull Requests
|
||||
|
||||
### 4. Validation et sécurité
|
||||
|
||||
- Vérification de l'authentification SSH avant push
|
||||
- Messages d'erreur explicites
|
||||
- Gestion des cas d'échec
|
||||
|
||||
## Workflow recommandé
|
||||
|
||||
### Développement quotidien
|
||||
|
||||
```bash
|
||||
# 1. Faire vos modifications
|
||||
# 2. Push rapide
|
||||
./scripts/auto-ssh-push.sh quick
|
||||
|
||||
# Ou avec message personnalisé
|
||||
./scripts/auto-ssh-push.sh message "feat: ajout de la fonctionnalité X"
|
||||
```
|
||||
|
||||
### Développement de fonctionnalités
|
||||
|
||||
```bash
|
||||
# 1. Créer une branche
|
||||
git checkout -b feature/nouvelle-fonctionnalite
|
||||
|
||||
# 2. Développer
|
||||
# 3. Push sur la branche
|
||||
./scripts/auto-ssh-push.sh branch feature/nouvelle-fonctionnalite
|
||||
|
||||
# 4. Préparer le merge
|
||||
./scripts/auto-ssh-push.sh merge feature/nouvelle-fonctionnalite main
|
||||
```
|
||||
|
||||
### Intégration continue
|
||||
|
||||
```bash
|
||||
# Push automatique après tests
|
||||
./scripts/auto-ssh-push.sh message "ci: tests passés, déploiement automatique"
|
||||
```
|
||||
|
||||
## Dépannage
|
||||
|
||||
### Problèmes courants
|
||||
|
||||
#### 1. Échec d'authentification SSH
|
||||
|
||||
```bash
|
||||
# Vérifier la clé SSH
|
||||
ssh -T git@git.4nkweb.com
|
||||
|
||||
# Si échec, configurer une nouvelle clé
|
||||
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519_4nk
|
||||
ssh-add ~/.ssh/id_ed25519_4nk
|
||||
```
|
||||
|
||||
#### 2. Configuration Git manquante
|
||||
|
||||
```bash
|
||||
# Reconfigurer Git pour SSH
|
||||
git config --global url."git@git.4nkweb.com:".insteadOf "https://git.4nkweb.com/"
|
||||
```
|
||||
|
||||
#### 3. Permissions de script
|
||||
|
||||
```bash
|
||||
# Rendre le script exécutable
|
||||
chmod +x scripts/auto-ssh-push.sh
|
||||
```
|
||||
|
||||
### Commandes de diagnostic
|
||||
|
||||
```bash
|
||||
# Vérifier la configuration SSH
|
||||
ssh -vT git@git.4nkweb.com
|
||||
|
||||
# Vérifier la configuration Git
|
||||
git config --global --list | grep url
|
||||
|
||||
# Vérifier les remotes
|
||||
git remote -v
|
||||
```
|
||||
|
||||
## Intégration avec CI/CD
|
||||
|
||||
### Workflow Gitea Actions
|
||||
|
||||
Le workflow CI/CD (`.gitea/workflows/ci.yml`) utilise automatiquement SSH :
|
||||
|
||||
```yaml
|
||||
- name: Setup SSH for Gitea
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
ssh-keyscan -H git.4nkweb.com >> ~/.ssh/known_hosts
|
||||
git config --global url."git@git.4nkweb.com:".insteadOf "https://git.4nkweb.com/"
|
||||
```
|
||||
|
||||
### Variables d'environnement
|
||||
|
||||
- `SSH_PRIVATE_KEY` : Clé SSH privée pour l'authentification
|
||||
- `SSH_PUBLIC_KEY` : Clé SSH publique (optionnelle)
|
||||
|
||||
## Sécurité
|
||||
|
||||
### Bonnes pratiques
|
||||
|
||||
- Les clés SSH sont stockées de manière sécurisée
|
||||
- Les permissions des fichiers SSH sont correctement configurées
|
||||
- La vérification des hôtes SSH est activée
|
||||
- Les clés sont régulièrement renouvelées
|
||||
|
||||
### Permissions recommandées
|
||||
|
||||
```bash
|
||||
chmod 700 ~/.ssh
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
chmod 644 ~/.ssh/id_rsa.pub
|
||||
chmod 600 ~/.ssh/config
|
||||
```
|
||||
|
||||
## Évolution
|
||||
|
||||
### Améliorations futures
|
||||
|
||||
- Support pour plusieurs clés SSH
|
||||
- Rotation automatique des clés
|
||||
- Intégration avec un gestionnaire de secrets
|
||||
- Support pour l'authentification par certificats SSH
|
||||
|
||||
### Maintenance
|
||||
|
||||
- Vérification régulière de la validité des clés SSH
|
||||
- Mise à jour des configurations selon les bonnes pratiques
|
||||
- Documentation des changements de configuration
|
||||
|
||||
## Conclusion
|
||||
|
||||
L'automatisation SSH pour les push simplifie considérablement le workflow de développement en éliminant la nécessité de configurer manuellement SSH pour chaque opération Git. Le script `auto-ssh-push.sh` et les alias Git offrent une interface simple et sécurisée pour tous les push vers le repository `ihm_client`.
|
||||
|
||||
|
@ -1,403 +0,0 @@
|
||||
# Guide de la Communauté - 4NK_node
|
||||
|
||||
## 🌟 Bienvenue dans la Communauté 4NK_node !
|
||||
|
||||
Ce guide vous accompagne dans votre participation à la communauté open source de 4NK_node, une infrastructure complète pour les paiements silencieux Bitcoin.
|
||||
|
||||
## 🎯 À Propos de 4NK_node
|
||||
|
||||
### **Qu'est-ce que 4NK_node ?**
|
||||
|
||||
4NK_node est une infrastructure Docker complète qui permet de déployer et gérer facilement un écosystème Bitcoin complet incluant :
|
||||
|
||||
- **Bitcoin Core** : Nœud Bitcoin avec support signet
|
||||
- **Blindbit** : Service de filtres pour les paiements silencieux
|
||||
- **SDK Relay** : Système de relais avec synchronisation mesh
|
||||
- **Tor** : Proxy anonyme pour la confidentialité
|
||||
|
||||
### **Pourquoi les Paiements Silencieux ?**
|
||||
|
||||
Les paiements silencieux (Silent Payments) sont une innovation Bitcoin qui améliore la confidentialité en permettant de créer des adresses uniques pour chaque transaction, sans révéler de liens entre les paiements.
|
||||
|
||||
## 🤝 Comment Contribuer
|
||||
|
||||
### **Niveaux de Contribution**
|
||||
|
||||
#### 🟢 **Débutant**
|
||||
- **Documentation** : Améliorer les guides, corriger les fautes
|
||||
- **Tests** : Ajouter des tests, signaler des bugs
|
||||
- **Support** : Aider les autres utilisateurs
|
||||
- **Traduction** : Traduire la documentation
|
||||
|
||||
#### 🟡 **Intermédiaire**
|
||||
- **Fonctionnalités** : Implémenter de nouvelles fonctionnalités
|
||||
- **Optimisations** : Améliorer les performances
|
||||
- **Tests avancés** : Tests d'intégration et de performance
|
||||
- **Outils** : Créer des scripts et outils
|
||||
|
||||
#### 🔴 **Avancé**
|
||||
- **Architecture** : Améliorer l'architecture du système
|
||||
- **Sécurité** : Audits de sécurité, améliorations
|
||||
- **Core features** : Fonctionnalités principales
|
||||
- **Mentorat** : Guider les nouveaux contributeurs
|
||||
|
||||
### **Premiers Pas**
|
||||
|
||||
#### 1. **Fork et Clone**
|
||||
```bash
|
||||
# Fork le repository sur Gitea
|
||||
# Puis clonez votre fork
|
||||
git clone https://git.4nkweb.com/votre-username/4NK_node.git
|
||||
cd 4NK_node
|
||||
|
||||
# Ajoutez l'upstream
|
||||
git remote add upstream https://git.4nkweb.com/4nk/4NK_node.git
|
||||
```
|
||||
|
||||
#### 2. **Installation Locale**
|
||||
```bash
|
||||
# Installez l'infrastructure
|
||||
./restart_4nk_node.sh
|
||||
|
||||
# Vérifiez que tout fonctionne
|
||||
docker ps
|
||||
```
|
||||
|
||||
#### 3. **Exploration**
|
||||
```bash
|
||||
# Explorez la documentation
|
||||
ls docs/
|
||||
cat docs/INDEX.md
|
||||
|
||||
# Exécutez les tests
|
||||
./tests/run_all_tests.sh
|
||||
```
|
||||
|
||||
## 📚 Ressources d'Apprentissage
|
||||
|
||||
### **Documentation Essentielle**
|
||||
|
||||
#### **Pour Commencer**
|
||||
- **[Guide d'Installation](docs/INSTALLATION.md)** - Installation complète
|
||||
- **[Guide d'Utilisation](docs/USAGE.md)** - Utilisation quotidienne
|
||||
- **[Guide de Configuration](docs/CONFIGURATION.md)** - Configuration avancée
|
||||
|
||||
#### **Pour Développer**
|
||||
- **[Architecture Technique](docs/ARCHITECTURE.md)** - Architecture détaillée
|
||||
- **[API Reference](docs/API.md)** - Documentation des APIs
|
||||
- **[Guide de Tests](docs/TESTING.md)** - Tests et validation
|
||||
|
||||
#### **Pour Contribuer**
|
||||
- **[Guide de Contribution](CONTRIBUTING.md)** - Processus de contribution
|
||||
- **[Code de Conduite](CODE_OF_CONDUCT.md)** - Règles de la communauté
|
||||
- **[Politique de Sécurité](SECURITY.md)** - Signalement de vulnérabilités
|
||||
|
||||
### **Ressources Externes**
|
||||
|
||||
#### **Bitcoin et Paiements Silencieux**
|
||||
- [Bitcoin.org](https://bitcoin.org/) - Documentation Bitcoin officielle
|
||||
- [BIP 352](https://github.com/bitcoin/bips/blob/master/bip-0352.mediawiki) - Spécification des paiements silencieux
|
||||
- [Bitcoin Core Documentation](https://bitcoincore.org/en/doc/) - Documentation Bitcoin Core
|
||||
|
||||
#### **Technologies Utilisées**
|
||||
- [Docker Documentation](https://docs.docker.com/) - Guide Docker
|
||||
- [Rust Book](https://doc.rust-lang.org/book/) - Guide Rust
|
||||
- [WebSocket RFC](https://tools.ietf.org/html/rfc6455) - Spécification WebSocket
|
||||
|
||||
## 🛠️ Environnement de Développement
|
||||
|
||||
### **Prérequis**
|
||||
|
||||
#### **Système**
|
||||
```bash
|
||||
# Ubuntu/Debian
|
||||
sudo apt update
|
||||
sudo apt install docker.io docker-compose git curl
|
||||
|
||||
# CentOS/RHEL
|
||||
sudo yum install docker docker-compose git curl
|
||||
|
||||
# macOS
|
||||
brew install docker docker-compose git curl
|
||||
```
|
||||
|
||||
#### **Développement**
|
||||
```bash
|
||||
# Rust (pour sdk_relay)
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
||||
|
||||
# Python (pour les tests)
|
||||
sudo apt install python3 python3-pip
|
||||
pip3 install websockets requests
|
||||
```
|
||||
|
||||
### **Configuration de Développement**
|
||||
|
||||
#### **Variables d'Environnement**
|
||||
```bash
|
||||
# Configuration de développement
|
||||
export RUST_LOG=debug
|
||||
export ENABLE_SYNC_TEST=1
|
||||
export BITCOIN_NETWORK=signet
|
||||
```
|
||||
|
||||
#### **Outils de Développement**
|
||||
```bash
|
||||
# Linting et formatting
|
||||
cargo clippy
|
||||
cargo fmt
|
||||
|
||||
# Tests
|
||||
cargo test
|
||||
./tests/run_all_tests.sh
|
||||
|
||||
# Build
|
||||
cargo build --release
|
||||
```
|
||||
|
||||
## 🐛 Signaler un Bug
|
||||
|
||||
### **Avant de Signaler**
|
||||
|
||||
1. **Vérifiez la documentation** - La solution pourrait déjà être documentée
|
||||
2. **Recherchez les issues existantes** - Le bug pourrait déjà être signalé
|
||||
3. **Testez sur la dernière version** - Le bug pourrait déjà être corrigé
|
||||
|
||||
### **Template de Bug Report**
|
||||
|
||||
Utilisez le template fourni dans Gitea ou suivez cette structure :
|
||||
|
||||
```markdown
|
||||
## Description du Bug
|
||||
Description claire et concise du problème.
|
||||
|
||||
## Étapes pour Reproduire
|
||||
1. Aller à '...'
|
||||
2. Cliquer sur '...'
|
||||
3. Faire défiler jusqu'à '...'
|
||||
4. Voir l'erreur
|
||||
|
||||
## Comportement Attendu
|
||||
Description de ce qui devrait se passer.
|
||||
|
||||
## Comportement Actuel
|
||||
Description de ce qui se passe actuellement.
|
||||
|
||||
## Informations Système
|
||||
- OS: [ex: Ubuntu 20.04]
|
||||
- Docker: [ex: 20.10.0]
|
||||
- Version: [ex: v1.0.0]
|
||||
|
||||
## Logs
|
||||
```
|
||||
Logs pertinents ici
|
||||
```
|
||||
```
|
||||
|
||||
## 💡 Proposer une Fonctionnalité
|
||||
|
||||
### **Avant de Proposer**
|
||||
|
||||
1. **Vérifiez la roadmap** - La fonctionnalité pourrait déjà être planifiée
|
||||
2. **Discutez avec la communauté** - Utilisez les discussions Gitea
|
||||
3. **Préparez un prototype** - Montrez que c'est faisable
|
||||
|
||||
### **Template de Feature Request**
|
||||
|
||||
```markdown
|
||||
## Résumé
|
||||
Description claire et concise de la fonctionnalité souhaitée.
|
||||
|
||||
## Motivation
|
||||
Pourquoi cette fonctionnalité est-elle nécessaire ?
|
||||
|
||||
## Proposition
|
||||
Description détaillée de la fonctionnalité proposée.
|
||||
|
||||
## Alternatives Considérées
|
||||
Autres solutions envisagées.
|
||||
|
||||
## Exemples d'Utilisation
|
||||
Comment cette fonctionnalité serait-elle utilisée ?
|
||||
```
|
||||
|
||||
## 🔄 Processus de Contribution
|
||||
|
||||
### **Workflow Git**
|
||||
|
||||
#### 1. **Créer une Branche**
|
||||
```bash
|
||||
# Depuis la branche main
|
||||
git checkout main
|
||||
git pull upstream main
|
||||
|
||||
# Créer une branche pour votre contribution
|
||||
git checkout -b feature/nom-de-votre-feature
|
||||
# ou
|
||||
git checkout -b fix/nom-du-bug
|
||||
```
|
||||
|
||||
#### 2. **Développer**
|
||||
```bash
|
||||
# Développez votre fonctionnalité
|
||||
# Ajoutez des tests
|
||||
# Mettez à jour la documentation
|
||||
|
||||
# Commitez régulièrement
|
||||
git add .
|
||||
git commit -m "feat: ajouter nouvelle fonctionnalité"
|
||||
```
|
||||
|
||||
#### 3. **Tester**
|
||||
```bash
|
||||
# Exécutez les tests
|
||||
./tests/run_all_tests.sh
|
||||
|
||||
# Vérifiez le code
|
||||
cargo clippy
|
||||
cargo fmt --check
|
||||
```
|
||||
|
||||
#### 4. **Soumettre**
|
||||
```bash
|
||||
# Poussez vers votre fork
|
||||
git push origin feature/nom-de-votre-feature
|
||||
|
||||
# Créez une Pull Request sur Gitea
|
||||
```
|
||||
|
||||
### **Standards de Code**
|
||||
|
||||
#### **Messages de Commit**
|
||||
Utilisez le format conventionnel :
|
||||
```bash
|
||||
feat(sdk_relay): add new sync type for metrics
|
||||
fix(bitcoin): resolve connection timeout issue
|
||||
docs(api): update WebSocket message format
|
||||
test(integration): add multi-relay sync tests
|
||||
```
|
||||
|
||||
#### **Code Style**
|
||||
- **Rust** : Suivez les conventions Rust (rustfmt, clippy)
|
||||
- **Bash** : Utilisez shellcheck pour les scripts
|
||||
- **Python** : Suivez PEP 8
|
||||
- **Markdown** : Utilisez un linter markdown
|
||||
|
||||
## 🏷️ Labels et Milestones
|
||||
|
||||
### **Labels Utilisés**
|
||||
|
||||
#### **Type**
|
||||
- `bug` - Problèmes et bugs
|
||||
- `enhancement` - Nouvelles fonctionnalités
|
||||
- `documentation` - Amélioration de la documentation
|
||||
- `good first issue` - Pour les nouveaux contributeurs
|
||||
- `help wanted` - Besoin d'aide
|
||||
|
||||
#### **Priorité**
|
||||
- `priority: high` - Priorité élevée
|
||||
- `priority: medium` - Priorité moyenne
|
||||
- `priority: low` - Priorité basse
|
||||
|
||||
#### **Statut**
|
||||
- `status: blocked` - Bloqué
|
||||
- `status: in progress` - En cours
|
||||
- `status: ready for review` - Prêt pour review
|
||||
|
||||
### **Milestones**
|
||||
|
||||
- **v1.0.0** - Version stable initiale
|
||||
- **v1.1.0** - Améliorations et corrections
|
||||
- **v2.0.0** - Nouvelles fonctionnalités majeures
|
||||
|
||||
## 🎉 Reconnaissance
|
||||
|
||||
### **Hall of Fame**
|
||||
|
||||
Les contributeurs significatifs seront reconnus dans :
|
||||
|
||||
- **README.md** - Liste des contributeurs
|
||||
- **CHANGELOG.md** - Mentions dans les releases
|
||||
- **Documentation** - Crédits dans les guides
|
||||
- **Site web** - Page dédiée aux contributeurs
|
||||
|
||||
### **Badges et Certifications**
|
||||
|
||||
- **Contributeur Bronze** : 1-5 contributions
|
||||
- **Contributeur Argent** : 6-20 contributions
|
||||
- **Contributeur Or** : 21+ contributions
|
||||
- **Maintainer** : Responsabilités de maintenance
|
||||
|
||||
## 🆘 Besoin d'Aide ?
|
||||
|
||||
### **Canaux de Support**
|
||||
|
||||
#### **Issues Gitea**
|
||||
- **Bugs** : [Issues](https://git.4nkweb.com/4nk/4NK_node/issues?q=is%3Aissue+is%3Aopen+label%3Abug)
|
||||
- **Fonctionnalités** : [Feature Requests](https://git.4nkweb.com/4nk/4NK_node/issues?q=is%3Aissue+is%3Aopen+label%3Aenhancement)
|
||||
|
||||
#### **Discussions**
|
||||
- **Questions générales** : [Discussions](https://git.4nkweb.com/4nk/4NK_node/issues)
|
||||
- **Aide technique** : [Support](https://git.4nkweb.com/4nk/4NK_node/issues/new)
|
||||
|
||||
#### **Contact Direct**
|
||||
- **Email** : support@4nkweb.com
|
||||
- **Sécurité** : security@4nkweb.com
|
||||
|
||||
### **FAQ**
|
||||
|
||||
#### **Questions Fréquentes**
|
||||
|
||||
**Q: Comment installer 4NK_node ?**
|
||||
A: Suivez le [Guide d'Installation](docs/INSTALLATION.md)
|
||||
|
||||
**Q: Comment contribuer au code ?**
|
||||
A: Consultez le [Guide de Contribution](CONTRIBUTING.md)
|
||||
|
||||
**Q: Comment signaler un bug de sécurité ?**
|
||||
A: Contactez security@4nkweb.com (NE PAS créer d'issue publique)
|
||||
|
||||
**Q: Comment proposer une nouvelle fonctionnalité ?**
|
||||
A: Créez une issue avec le label `enhancement`
|
||||
|
||||
## 🚀 Projets Futurs
|
||||
|
||||
### **Roadmap Communautaire**
|
||||
|
||||
#### **Court Terme (1-3 mois)**
|
||||
- Interface utilisateur web
|
||||
- Support de nouveaux réseaux Bitcoin
|
||||
- Amélioration de la documentation
|
||||
- Tests de performance
|
||||
|
||||
#### **Moyen Terme (3-6 mois)**
|
||||
- Support Lightning Network
|
||||
- API REST complète
|
||||
- Monitoring avancé
|
||||
- Déploiement cloud
|
||||
|
||||
#### **Long Terme (6-12 mois)**
|
||||
- Écosystème complet
|
||||
- Marketplace d'extensions
|
||||
- Support multi-blockchains
|
||||
- IA et automatisation
|
||||
|
||||
### **Idées de Contribution**
|
||||
|
||||
#### **Fonctionnalités Populaires**
|
||||
- Interface graphique pour la gestion
|
||||
- Intégration avec des wallets populaires
|
||||
- Support de nouveaux types de paiements
|
||||
- Outils de monitoring avancés
|
||||
|
||||
#### **Améliorations Techniques**
|
||||
- Optimisation des performances
|
||||
- Amélioration de la sécurité
|
||||
- Support de nouvelles plateformes
|
||||
- Tests automatisés avancés
|
||||
|
||||
---
|
||||
|
||||
**Merci de faire partie de la communauté 4NK_node ! Votre contribution aide à construire l'avenir des paiements Bitcoin privés et sécurisés.** 🌟
|
||||
|
||||
|
@ -1,817 +0,0 @@
|
||||
# ⚙️ Guide de Configuration - 4NK_node
|
||||
|
||||
Guide complet pour configurer l'infrastructure 4NK_node selon vos besoins.
|
||||
|
||||
## 📋 Configuration Générale
|
||||
|
||||
### 1. Variables d'Environnement
|
||||
|
||||
Créer un fichier `.env` à la racine du projet :
|
||||
|
||||
```bash
|
||||
# Configuration 4NK_node
|
||||
PROJECT_NAME=4NK_node
|
||||
NETWORK_NAME=4nk_node_btcnet
|
||||
|
||||
# Logs
|
||||
RUST_LOG=debug,bitcoincore_rpc=trace
|
||||
|
||||
# Bitcoin
|
||||
BITCOIN_COOKIE_PATH=/home/bitcoin/.bitcoin/signet/.cookie
|
||||
|
||||
# Synchronisation
|
||||
ENABLE_SYNC_TEST=1
|
||||
|
||||
# Ports
|
||||
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
|
||||
```
|
||||
|
||||
### 1.b Santé des services
|
||||
|
||||
- `sdk_signer` expose un endpoint de santé interne HTTP sur le port 9092 (sidecar httpd minimal). Le reverse proxy le publie en `/signer/health`.
|
||||
- Les `sdk_relay_*` utilisent un healthcheck tolérant au démarrage : le processus doit être actif et l’indicateur `/home/bitcoin/.4nk/processes` présent. Les ports 8090/8091 peuvent n’ouvrir qu’après les phases initiales (scan/resync).
|
||||
|
||||
### 2. Configuration Réseau
|
||||
|
||||
#### Réseau Docker Personnalisé
|
||||
|
||||
```bash
|
||||
# Créer un réseau personnalisé
|
||||
docker network create 4nk-network --subnet=172.20.0.0/16 --gateway=172.20.0.1
|
||||
|
||||
# Modifier docker-compose.yml
|
||||
sed -i 's/4nk_default/4nk-network/g' docker-compose.yml
|
||||
```
|
||||
|
||||
#### Configuration de Pare-feu
|
||||
|
||||
```bash
|
||||
# Exposition publique centralisée via reverse proxy uniquement
|
||||
sudo ufw allow 80/tcp # HTTP (redirection)
|
||||
sudo ufw allow 443/tcp # HTTPS (UI + API + WS)
|
||||
sudo ufw enable
|
||||
sudo ufw enable
|
||||
|
||||
# Vérifier les règles
|
||||
sudo ufw status numbered
|
||||
```
|
||||
|
||||
## 🔧 Configuration Bitcoin Core
|
||||
|
||||
### 1. Configuration de Base
|
||||
|
||||
Fichier : `bitcoin/bitcoin.conf`
|
||||
|
||||
```ini
|
||||
# Configuration Bitcoin Core Signet
|
||||
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
|
||||
|
||||
# Configuration Signet
|
||||
[signet]
|
||||
listen=1
|
||||
bind=0.0.0.0:38333
|
||||
rpcbind=0.0.0.0:18443
|
||||
rpcport=18443
|
||||
fallbackfee=0.0001
|
||||
blockfilterindex=1
|
||||
datacarriersize=205
|
||||
acceptnonstdtxn=1
|
||||
dustrelayfee=0.00000001
|
||||
minrelaytxfee=0.00000001
|
||||
prune=0
|
||||
signetchallenge=0020341c43803863c252df326e73574a27d7e19322992061017b0dc893e2eab90821
|
||||
walletdir=/home/bitcoin/.bitcoin/wallets
|
||||
wallet=mining
|
||||
wallet=watchonly
|
||||
maxtxfee=1
|
||||
addnode=tlv2yqamflv22vfdzy2hha2nwmt6zrwrhjjzz4lx7qyq7lyc6wfhabyd.onion
|
||||
```
|
||||
|
||||
### 2. Configuration Avancée
|
||||
|
||||
#### Performance
|
||||
|
||||
```ini
|
||||
# Optimisation mémoire
|
||||
dbcache=450
|
||||
maxmempool=300
|
||||
maxconnections=125
|
||||
|
||||
# Optimisation disque
|
||||
txindex=1
|
||||
blockfilterindex=1
|
||||
coinstatsindex=1
|
||||
|
||||
# Optimisation réseau
|
||||
listenonion=1
|
||||
onion=tor:9050
|
||||
proxy=tor:9050
|
||||
```
|
||||
|
||||
#### Sécurité
|
||||
|
||||
```ini
|
||||
# Authentification
|
||||
rpcauth=bitcoin:c8ea921c7357bd6a5a8a7c43a12350a7$955e25b17672987b17c5a12f12cd8b9c1d38f0f86201c8cd47fc431f2e1c7956
|
||||
rpcallowip=172.19.0.0/16
|
||||
rpcworkqueue=32
|
||||
rpcthreads=4
|
||||
rpcdoccheck=1
|
||||
|
||||
# Limites
|
||||
maxuploadtarget=5000
|
||||
maxconnections=125
|
||||
```
|
||||
|
||||
### 3. Configuration des Wallets
|
||||
|
||||
```bash
|
||||
# Créer un wallet pour les relais
|
||||
docker exec bitcoin-signet bitcoin-cli -signet createwallet "relay_wallet"
|
||||
|
||||
# Créer un wallet pour le mining
|
||||
docker exec bitcoin-signet bitcoin-cli -signet createwallet "mining_wallet"
|
||||
|
||||
# Créer un wallet watch-only
|
||||
docker exec bitcoin-signet bitcoin-cli -signet createwallet "watchonly_wallet" true
|
||||
```
|
||||
|
||||
## 🔧 Configuration Blindbit
|
||||
|
||||
### 1. Configuration de Base
|
||||
|
||||
Fichier : `blindbit/blindbit.toml`
|
||||
|
||||
```toml
|
||||
# Configuration Blindbit Oracle
|
||||
host = "0.0.0.0:8000"
|
||||
chain = "signet"
|
||||
rpc_endpoint = "http://bitcoin:18443"
|
||||
cookie_path = "/home/bitcoin/.bitcoin/signet/.cookie"
|
||||
rpc_user = ""
|
||||
rpc_pass = ""
|
||||
sync_start_height = 1
|
||||
|
||||
# Performance
|
||||
max_parallel_tweak_computations = 4
|
||||
max_parallel_requests = 4
|
||||
|
||||
# Index
|
||||
tweaks_only = 0
|
||||
tweaks_full_basic = 1
|
||||
tweaks_full_with_dust_filter = 1
|
||||
tweaks_cut_through_with_dust_filter = 1
|
||||
```
|
||||
|
||||
### 2. Configuration Avancée
|
||||
|
||||
#### Performance
|
||||
|
||||
```toml
|
||||
# Optimisation des calculs
|
||||
max_parallel_tweak_computations = 8
|
||||
max_parallel_requests = 8
|
||||
|
||||
# Cache
|
||||
cache_size = 1000
|
||||
cache_ttl = 3600
|
||||
|
||||
# Logs
|
||||
log_level = "info"
|
||||
log_file = "/data/blindbit.log"
|
||||
```
|
||||
|
||||
#### Sécurité
|
||||
|
||||
```toml
|
||||
# Authentification
|
||||
rpc_user = "blindbit_user"
|
||||
rpc_pass = "secure_password"
|
||||
|
||||
# Limites
|
||||
max_request_size = 1048576
|
||||
rate_limit = 100
|
||||
```
|
||||
|
||||
## 🔧 Configuration des Relais
|
||||
|
||||
### 1. Configuration de Base
|
||||
|
||||
#### Relay 1 - `sdk_relay/.conf.docker.relay1`
|
||||
|
||||
```ini
|
||||
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
|
||||
```
|
||||
|
||||
#### Relay 2 - `sdk_relay/.conf.docker.relay2`
|
||||
|
||||
```ini
|
||||
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-2
|
||||
```
|
||||
|
||||
#### Relay 3 - `sdk_relay/.conf.docker.relay3`
|
||||
|
||||
```ini
|
||||
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-3
|
||||
```
|
||||
|
||||
### 2. Configuration Avancée
|
||||
|
||||
#### Performance
|
||||
|
||||
```ini
|
||||
# Optimisation mémoire
|
||||
max_connections=100
|
||||
connection_timeout=30
|
||||
read_timeout=60
|
||||
|
||||
# Cache
|
||||
cache_size=1000
|
||||
cache_ttl=3600
|
||||
|
||||
# Logs
|
||||
log_level=info
|
||||
log_file=/home/bitcoin/.4nk/relay.log
|
||||
```
|
||||
|
||||
#### Sécurité
|
||||
|
||||
```ini
|
||||
# Authentification
|
||||
auth_required=true
|
||||
auth_token=your_secure_token
|
||||
|
||||
# Limites
|
||||
max_message_size=1048576
|
||||
rate_limit=1000
|
||||
```
|
||||
|
||||
### 3. Configuration de Synchronisation
|
||||
|
||||
```ini
|
||||
# Synchronisation
|
||||
sync_enabled=true
|
||||
sync_interval=30
|
||||
sync_timeout=10
|
||||
|
||||
# Découverte
|
||||
discovery_enabled=true
|
||||
discovery_interval=60
|
||||
discovery_timeout=5
|
||||
|
||||
# Cache de déduplication
|
||||
dedup_enabled=true
|
||||
dedup_ttl=300
|
||||
dedup_max_size=10000
|
||||
```
|
||||
|
||||
## 🌐 Configuration des Nœuds Externes
|
||||
|
||||
### 1. Configuration de Base
|
||||
|
||||
Fichier : `sdk_relay/external_nodes.conf`
|
||||
|
||||
```toml
|
||||
# Configuration des nœuds externes
|
||||
[relays]
|
||||
external-relay-1 = "external-relay-1.example.com:8090"
|
||||
external-relay-2 = "192.168.1.100:8090"
|
||||
dev3-relay = "dev3.4nkweb.com:443"
|
||||
|
||||
[discovery]
|
||||
auto_discover = true
|
||||
bootstrap_nodes = [
|
||||
"bootstrap-1.4nk.net:8090",
|
||||
"bootstrap-2.4nk.net:8090"
|
||||
]
|
||||
|
||||
[security]
|
||||
allowed_domains = [
|
||||
"*.4nk.net",
|
||||
"*.example.com",
|
||||
"localhost",
|
||||
"127.0.0.1"
|
||||
]
|
||||
|
||||
[validation]
|
||||
max_connection_timeout = 10
|
||||
health_check_interval = 300
|
||||
blacklist_threshold = 5
|
||||
```
|
||||
|
||||
### 2. Configuration Avancée
|
||||
|
||||
#### Découverte Automatique
|
||||
|
||||
```toml
|
||||
[discovery]
|
||||
auto_discover = true
|
||||
bootstrap_nodes = [
|
||||
"bootstrap-1.4nk.net:8090",
|
||||
"bootstrap-2.4nk.net:8090"
|
||||
]
|
||||
discovery_interval = 300
|
||||
discovery_timeout = 10
|
||||
max_discovered_nodes = 50
|
||||
```
|
||||
|
||||
#### Sécurité
|
||||
|
||||
```toml
|
||||
[security]
|
||||
allowed_domains = [
|
||||
"*.4nk.net",
|
||||
"*.example.com",
|
||||
"localhost",
|
||||
"127.0.0.1"
|
||||
]
|
||||
blocked_domains = [
|
||||
"malicious.example.com"
|
||||
]
|
||||
allowed_ips = [
|
||||
"192.168.1.0/24",
|
||||
"10.0.0.0/8"
|
||||
]
|
||||
```
|
||||
|
||||
#### Validation
|
||||
|
||||
```toml
|
||||
[validation]
|
||||
max_connection_timeout = 10
|
||||
health_check_interval = 300
|
||||
blacklist_threshold = 5
|
||||
whitelist_enabled = false
|
||||
certificate_verification = true
|
||||
```
|
||||
|
||||
## 🔧 Configuration Tor
|
||||
|
||||
### 1. Image et service Tor
|
||||
|
||||
- Le service Tor est désormais construit localement depuis `tor/Dockerfile` et monté avec `tor/torrc`.
|
||||
- Le conteneur tourne en utilisateur `debian-tor` et expose uniquement le SOCKS (9050) et, en interne, un ControlPort local (127.0.0.1:9051).
|
||||
|
||||
Extrait `docker-compose.yml` (service `tor`):
|
||||
|
||||
```yaml
|
||||
services:
|
||||
tor:
|
||||
build: ./tor
|
||||
image: 4nk_node-tor
|
||||
container_name: tor-proxy
|
||||
ports:
|
||||
- "9050:9050"
|
||||
- "9051:9051"
|
||||
volumes:
|
||||
- ./tor/torrc:/etc/tor/torrc:ro
|
||||
command: ["tor", "-f", "/etc/tor/torrc"]
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "nc -z 127.0.0.1 9050"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
networks:
|
||||
- btcnet
|
||||
```
|
||||
|
||||
### 2. Fichier `tor/torrc`
|
||||
|
||||
Configuration de base (extrait) :
|
||||
|
||||
```ini
|
||||
SocksPort 0.0.0.0:9050
|
||||
ControlPort 127.0.0.1:9051
|
||||
DataDirectory /var/lib/tor
|
||||
Log notice stdout
|
||||
ClientUseIPv6 1
|
||||
SafeLogging 1
|
||||
ReducedConnectionPadding 1
|
||||
SocksPolicy accept 0.0.0.0/0
|
||||
AutomapHostsOnResolve 1
|
||||
```
|
||||
|
||||
### 3. Bridges obfs4 (optionnels)
|
||||
|
||||
Pour contourner des filtrages réseaux, activer les bridges obfs4 dans `tor/torrc` :
|
||||
|
||||
```ini
|
||||
UseBridges 1
|
||||
ClientTransportPlugin obfs4 exec /usr/bin/obfs4proxy
|
||||
Bridge obfs4 81.64.0.218:6697 53E6469DC06BED50543AED0311D66082F4B66676 cert=zOKy+MnZ4wWbKcENcyaElPu62PEaXdE/c802ssuzCIDa2aIC1+J4LyfPhAwSiLaAo/I/bg iat-mode=0
|
||||
Bridge obfs4 198.98.53.149:443 886CA31F71272FC8B3808C601FA3ABB8A2905DB4 cert=D+zypuFdMpP8riBUbInxIguzqClR0JKkP1DbkKz5es1+OP2Fao8jiXyM+B/+DYA2ZFy6UA iat-mode=0
|
||||
```
|
||||
|
||||
L’image Tor installe `obfs4proxy`. Après modification :
|
||||
|
||||
```bash
|
||||
sudo docker compose build tor
|
||||
sudo docker compose up -d tor
|
||||
```
|
||||
|
||||
Vérifications :
|
||||
|
||||
```bash
|
||||
sudo docker compose ps tor
|
||||
sudo docker logs tor-proxy --tail=40
|
||||
sudo docker exec tor-proxy nc -z 127.0.0.1 9050 && echo SOCKS:OK
|
||||
```
|
||||
|
||||
#### Notes et recommandations (Tor/bridges)
|
||||
|
||||
- Le `ControlPort 127.0.0.1:9051` est utilisé pour le diagnostic interne. Ne pas l’exposer publiquement. Une authentification peut être activée si un contrôle à distance est requis.
|
||||
- Les bridges obfs4 ci‑dessus proviennent de la page de référence du Tor Project. En cas d’échec répété (messages « general SOCKS server failure » côté Tor), ajouter 2–3 bridges supplémentaires depuis la même source et redémarrer le service Tor.
|
||||
- Pour faciliter l’ajout à chaud de bridges, un fichier `tor/bridges.extra` est monté en lecture seule dans le conteneur et inclus via `%include /etc/tor/bridges.extra`. Vous pouvez y coller de nouveaux bridges sans modifier `tor/torrc`, puis redémarrer Tor.
|
||||
- Les tests de connectivité doivent distinguer :
|
||||
- Accès SOCKS vers des services onion « publics » (ex. DuckDuckGo) pour valider le proxy Tor.
|
||||
- Accès SOCKS vers l’onion cible du signet pour valider la reachability du pair.
|
||||
- À la date d’édition, le proxy SOCKS fonctionne (onion publics accessibles), mais le pair signet `.onion:38333` est injoignable (host unreachable). La configuration du signet (signetchallenge et addnode) doit rester inchangée, conformément à la contrainte fonctionnelle.
|
||||
|
||||
#### Outils de diagnostic réseau
|
||||
|
||||
- Installer `netcat-openbsd` sur l’hôte et dans les conteneurs pertinents pour faciliter les vérifications :
|
||||
- Hôte : `sudo apt-get install -y netcat-openbsd`
|
||||
- Conteneur Bitcoin (root) : `apt-get update && apt-get install -y --no-install-recommends netcat-openbsd`
|
||||
- Exemples de vérifications :
|
||||
- `nc -vz -w 10 -x 127.0.0.1:9050 -X 5 <onion> 80`
|
||||
- `nc -vz -w 10 -x 127.0.0.1:9050 -X 5 <onion_signet> 38333`
|
||||
|
||||
#### DNS externes (ex. dev.4nkweb.com)
|
||||
|
||||
- Si un nom de domaine (ex. `dev.4nkweb.com`) doit pointer vers un service, s’assurer qu’un enregistrement DNS A/AAAA existe. En l’absence de résolution, les tests échoueront côté HTTP/HTTPS et TCP.
|
||||
- En phase de test, une entrée temporaire peut être ajoutée dans `/etc/hosts` si l’IP est connue.
|
||||
|
||||
## 🔧 Configuration Docker Compose
|
||||
|
||||
### 1. Configuration de Base
|
||||
|
||||
Fichier : `docker-compose.yml`
|
||||
|
||||
```yaml
|
||||
# Compose modernisé (sans clé version), publication unique via reverse proxy
|
||||
services:
|
||||
reverse_proxy:
|
||||
image: nginx:alpine
|
||||
depends_on:
|
||||
- sdk_relay_1
|
||||
volumes:
|
||||
- ./proxy/nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
||||
- ./certs:/etc/nginx/certs:ro
|
||||
- ./ihm_client/dist:/usr/share/nginx/html:ro
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
networks:
|
||||
btcnet:
|
||||
aliases:
|
||||
- reverse_proxy
|
||||
|
||||
# Tous les autres services sont internes (pas de ports exposés)
|
||||
bitcoin:
|
||||
networks:
|
||||
- btcnet
|
||||
blindbit:
|
||||
networks:
|
||||
- btcnet
|
||||
sdk_relay_1:
|
||||
networks:
|
||||
- btcnet
|
||||
```
|
||||
|
||||
### 2. Configuration Avancée
|
||||
|
||||
#### Ressources
|
||||
|
||||
```yaml
|
||||
services:
|
||||
bitcoin:
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 2G
|
||||
cpus: '1.0'
|
||||
reservations:
|
||||
memory: 1G
|
||||
cpus: '0.5'
|
||||
|
||||
sdk_relay_1:
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 512M
|
||||
cpus: '0.5'
|
||||
reservations:
|
||||
memory: 256M
|
||||
cpus: '0.25'
|
||||
```
|
||||
|
||||
#### Sécurité
|
||||
|
||||
```yaml
|
||||
services:
|
||||
bitcoin:
|
||||
security_opt:
|
||||
- no-new-privileges:true
|
||||
read_only: false
|
||||
tmpfs:
|
||||
- /tmp:noexec,nosuid,size=100m
|
||||
|
||||
sdk_relay_1:
|
||||
security_opt:
|
||||
- no-new-privileges:true
|
||||
read_only: false
|
||||
tmpfs:
|
||||
- /tmp:noexec,nosuid,size=50m
|
||||
```
|
||||
|
||||
## 🔧 Configuration SSL/TLS
|
||||
|
||||
### 1. Certificat Auto-Signé
|
||||
|
||||
```bash
|
||||
# Générer et protéger des certificats auto-signés
|
||||
./scripts/generate_certs.sh
|
||||
|
||||
# Les certificats sont montés par le reverse proxy :
|
||||
# - certs/server.crt -> /etc/nginx/certs/server.crt
|
||||
# - certs/server.key -> /etc/nginx/certs/server.key
|
||||
```
|
||||
|
||||
### 2. Certificat Let's Encrypt
|
||||
|
||||
```bash
|
||||
# Installer certbot
|
||||
sudo apt install certbot python3-certbot-nginx
|
||||
|
||||
# Obtenir un certificat
|
||||
sudo certbot --nginx -d your-domain.com
|
||||
|
||||
# Configuration automatique
|
||||
sudo certbot renew --dry-run
|
||||
```
|
||||
|
||||
### 3. Production (webroot, HSTS et renouvellement)
|
||||
|
||||
- Le reverse proxy sert les challenges ACME en HTTP: `/.well-known/acme-challenge/` via le montage `./acme -> /var/www/certbot`.
|
||||
- Le certificat de production est installé dans `./certs/server.crt` et `./certs/server.key`.
|
||||
- HSTS est activé par défaut (entête `Strict-Transport-Security: max-age=31536000; includeSubDomains`).
|
||||
- Renouvellement: script idempotent `scripts/renew_certs.sh` (webroot certbot + reload Nginx).
|
||||
- Déploiement initial automatisé: `scripts/deploy_first_install_with_certs.sh` (avec certificats) ou `scripts/deploy_first_install_no_certs.sh` (auto‑signé).
|
||||
|
||||
Exécution manuelle:
|
||||
```bash
|
||||
./scripts/renew_certs.sh
|
||||
```
|
||||
|
||||
Cron (quotidien à 03:00):
|
||||
```bash
|
||||
0 3 * * * /home/debian/4NK_node/scripts/renew_certs.sh >> /home/debian/4NK_node/logs/cert_renew.log 2>&1
|
||||
```
|
||||
|
||||
## 🔧 Configuration de Monitoring
|
||||
|
||||
### 1. Prometheus
|
||||
|
||||
```yaml
|
||||
# docker-compose.yml addition
|
||||
services:
|
||||
prometheus:
|
||||
image: prom/prometheus:latest
|
||||
container_name: prometheus
|
||||
ports:
|
||||
- "9090:9090"
|
||||
volumes:
|
||||
- ./prometheus.yml:/etc/prometheus/prometheus.yml
|
||||
- prometheus_data:/prometheus
|
||||
command:
|
||||
- '--config.file=/etc/prometheus/prometheus.yml'
|
||||
- '--storage.tsdb.path=/prometheus'
|
||||
- '--web.console.libraries=/etc/prometheus/console_libraries'
|
||||
- '--web.console.templates=/etc/prometheus/consoles'
|
||||
- '--storage.tsdb.retention.time=200h'
|
||||
- '--web.enable-lifecycle'
|
||||
|
||||
grafana:
|
||||
image: grafana/grafana:latest
|
||||
container_name: grafana
|
||||
ports:
|
||||
- "3000:3000"
|
||||
volumes:
|
||||
- grafana_data:/var/lib/grafana
|
||||
environment:
|
||||
- GF_SECURITY_ADMIN_PASSWORD=admin
|
||||
|
||||
volumes:
|
||||
prometheus_data:
|
||||
grafana_data:
|
||||
```
|
||||
|
||||
### 2. Configuration Prometheus
|
||||
|
||||
Fichier : `prometheus.yml`
|
||||
|
||||
```yaml
|
||||
global:
|
||||
scrape_interval: 15s
|
||||
evaluation_interval: 15s
|
||||
|
||||
rule_files:
|
||||
# - "first_rules.yml"
|
||||
# - "second_rules.yml"
|
||||
|
||||
scrape_configs:
|
||||
- job_name: 'bitcoin'
|
||||
static_configs:
|
||||
- targets: ['bitcoin:18443']
|
||||
|
||||
- job_name: 'blindbit'
|
||||
static_configs:
|
||||
- targets: ['blindbit:8000']
|
||||
|
||||
- job_name: 'sdk_relay'
|
||||
static_configs:
|
||||
- targets: ['sdk_relay_1:8091']
|
||||
```
|
||||
|
||||
## 🔧 Configuration de Sauvegarde
|
||||
|
||||
### 1. Script de Sauvegarde
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
# backup_4nk.sh
|
||||
|
||||
DATE=$(date +%Y%m%d_%H%M%S)
|
||||
BACKUP_DIR="/backup/4nk_node_$DATE"
|
||||
|
||||
mkdir -p $BACKUP_DIR
|
||||
|
||||
# Sauvegarder les configurations
|
||||
cp -r sdk_relay/.conf* $BACKUP_DIR/
|
||||
cp external_nodes.conf $BACKUP_DIR/
|
||||
cp bitcoin/bitcoin.conf $BACKUP_DIR/
|
||||
cp blindbit/blindbit.toml $BACKUP_DIR/
|
||||
|
||||
# Sauvegarder les données Bitcoin
|
||||
docker exec bitcoin-signet tar czf /tmp/bitcoin-backup.tar.gz /home/bitcoin/.bitcoin
|
||||
docker cp bitcoin-signet:/tmp/bitcoin-backup.tar.gz $BACKUP_DIR/
|
||||
|
||||
# Sauvegarder les données Blindbit
|
||||
docker exec blindbit-oracle tar czf /tmp/blindbit-backup.tar.gz /data
|
||||
docker cp blindbit-oracle:/tmp/blindbit-backup.tar.gz $BACKUP_DIR/
|
||||
|
||||
# Sauvegarder les données des relais
|
||||
for i in {1..3}; do
|
||||
docker exec sdk_relay_$i tar czf /tmp/relay_$i-backup.tar.gz /home/bitcoin/.4nk
|
||||
docker cp sdk_relay_$i:/tmp/relay_$i-backup.tar.gz $BACKUP_DIR/
|
||||
done
|
||||
|
||||
# Nettoyer les anciennes sauvegardes (garder 7 jours)
|
||||
find /backup -name "4nk_node_*" -type d -mtime +7 -exec rm -rf {} \;
|
||||
|
||||
echo "Sauvegarde terminée: $BACKUP_DIR"
|
||||
```
|
||||
|
||||
### 2. Configuration Cron
|
||||
|
||||
```bash
|
||||
# Ajouter au cron pour sauvegarde automatique
|
||||
echo "0 2 * * * /path/to/backup_4nk.sh" | crontab -
|
||||
```
|
||||
|
||||
## 🔧 Configuration de Logs
|
||||
|
||||
### 1. Rotation des Logs
|
||||
|
||||
```bash
|
||||
# Configuration logrotate
|
||||
cat > /etc/logrotate.d/4nk-node << EOF
|
||||
/var/lib/docker/containers/*/*.log {
|
||||
daily
|
||||
rotate 7
|
||||
compress
|
||||
delaycompress
|
||||
missingok
|
||||
notifempty
|
||||
copytruncate
|
||||
size 100M
|
||||
}
|
||||
EOF
|
||||
```
|
||||
|
||||
### 2. Centralisation des Logs
|
||||
|
||||
```yaml
|
||||
# docker-compose.yml addition
|
||||
services:
|
||||
elasticsearch:
|
||||
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.0
|
||||
container_name: elasticsearch
|
||||
environment:
|
||||
- discovery.type=single-node
|
||||
ports:
|
||||
- "9200:9200"
|
||||
volumes:
|
||||
- elasticsearch_data:/usr/share/elasticsearch/data
|
||||
|
||||
kibana:
|
||||
image: docker.elastic.co/kibana/kibana:7.17.0
|
||||
container_name: kibana
|
||||
ports:
|
||||
- "5601:5601"
|
||||
depends_on:
|
||||
- elasticsearch
|
||||
|
||||
filebeat:
|
||||
image: docker.elastic.co/beats/filebeat:7.17.0
|
||||
container_name: filebeat
|
||||
volumes:
|
||||
- /var/lib/docker/containers:/var/lib/docker/containers:ro
|
||||
- ./filebeat.yml:/usr/share/filebeat/filebeat.yml:ro
|
||||
depends_on:
|
||||
- elasticsearch
|
||||
|
||||
volumes:
|
||||
elasticsearch_data:
|
||||
```
|
||||
|
||||
## 📝 Checklist de Configuration
|
||||
|
||||
- [ ] Variables d'environnement configurées
|
||||
- [ ] Configuration Bitcoin Core vérifiée
|
||||
- [ ] Configuration Blindbit vérifiée
|
||||
- [ ] Configurations des relais vérifiées
|
||||
- [ ] Configuration des nœuds externes vérifiée
|
||||
- [ ] Configuration Tor vérifiée
|
||||
- [ ] Configuration Docker Compose vérifiée
|
||||
- [ ] SSL/TLS configuré (si nécessaire)
|
||||
- [ ] Monitoring configuré (si nécessaire)
|
||||
- [ ] Sauvegarde configurée
|
||||
- [ ] Logs configurés
|
||||
- [ ] Pare-feu configuré
|
||||
- [ ] Tests de configuration passés
|
||||
|
||||
## 🎯 Commandes de Configuration
|
||||
|
||||
```bash
|
||||
# Vérifier la configuration
|
||||
docker-compose config
|
||||
|
||||
# Tester la configuration
|
||||
./test_final_sync.sh
|
||||
|
||||
# Appliquer la configuration
|
||||
./restart_4nk_node.sh
|
||||
|
||||
# Vérifier les logs
|
||||
docker-compose logs --tail=50
|
||||
```
|
||||
|
||||
---
|
@ -1,285 +0,0 @@
|
||||
# Configuration Gitea - 4NK_node
|
||||
|
||||
Ce guide explique comment configurer le projet 4NK_node spécifiquement pour Gitea (git.4nkweb.com).
|
||||
|
||||
## 🎯 Configuration Gitea
|
||||
|
||||
### Repository Configuration
|
||||
|
||||
Le projet est hébergé sur : **https://git.4nkweb.com/4nk/4NK_node**
|
||||
|
||||
### Branches Principales
|
||||
|
||||
- **`main`** - Branche principale, code stable
|
||||
- **`develop`** - Branche de développement (optionnelle)
|
||||
- **`feature/*`** - Branches de fonctionnalités
|
||||
- **`fix/*`** - Branches de corrections
|
||||
|
||||
### Protection des Branches
|
||||
|
||||
Configurez les protections suivantes sur Gitea :
|
||||
|
||||
1. **Branche `main`** :
|
||||
- ✅ Require pull request reviews before merging
|
||||
- ✅ Require status checks to pass before merging
|
||||
- ✅ Require branches to be up to date before merging
|
||||
- ✅ Restrict pushes that create files
|
||||
- ✅ Restrict pushes that delete files
|
||||
|
||||
2. **Branche `develop`** (si utilisée) :
|
||||
- ✅ Require pull request reviews before merging
|
||||
- ✅ Require status checks to pass before merging
|
||||
|
||||
## 🔧 Configuration CI/CD
|
||||
|
||||
### Option 1 : Gitea Actions (Recommandé)
|
||||
|
||||
Si votre instance Gitea supporte Gitea Actions :
|
||||
|
||||
```yaml
|
||||
# .gitea/workflows/ci.yml
|
||||
name: CI - 4NK_node
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, develop ]
|
||||
pull_request:
|
||||
branches: [ main, develop ]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup Rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
- name: Run tests
|
||||
run: |
|
||||
cd sdk_relay
|
||||
cargo test
|
||||
```
|
||||
|
||||
### Option 2 : Runner Externe
|
||||
|
||||
Configurez un runner CI/CD externe (Jenkins, GitLab CI, etc.) :
|
||||
|
||||
```bash
|
||||
# Exemple avec Jenkins
|
||||
pipeline {
|
||||
agent any
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
checkout scm
|
||||
}
|
||||
}
|
||||
stage('Test') {
|
||||
steps {
|
||||
sh 'cd sdk_relay && cargo test'
|
||||
}
|
||||
}
|
||||
stage('Build') {
|
||||
steps {
|
||||
sh 'docker-compose build'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Publication automatique des releases
|
||||
|
||||
- Définir un secret de repository nommé `RELEASE_TOKEN` (scope: write:repository) dans Gitea.
|
||||
- Le workflow `.gitea/workflows/ci.yml` publie automatiquement une release lors d’un push de tag `v*` en utilisant ce secret.
|
||||
- Le corps de la release référence `CHANGELOG.md`. Pour des notes plus détaillées, mettez à jour le changelog avant de créer le tag.
|
||||
|
||||
### Option 3 : GitHub Actions (Migration)
|
||||
|
||||
Si vous souhaitez utiliser GitHub Actions avec un miroir :
|
||||
|
||||
1. Créez un repository miroir sur GitHub
|
||||
2. Configurez un webhook pour synchroniser automatiquement
|
||||
3. Utilisez le workflow GitHub Actions existant
|
||||
|
||||
## 📋 Templates Gitea
|
||||
|
||||
### Issues Templates
|
||||
|
||||
Les templates d'issues sont stockés dans `.gitea/ISSUE_TEMPLATE/` :
|
||||
|
||||
- `bug_report.md` - Pour signaler des bugs
|
||||
- `feature_request.md` - Pour proposer des fonctionnalités
|
||||
|
||||
### Pull Request Template
|
||||
|
||||
Le template de PR est dans `.gitea/PULL_REQUEST_TEMPLATE.md`
|
||||
|
||||
## 🔗 Intégrations Gitea
|
||||
|
||||
### Webhooks
|
||||
|
||||
Configurez des webhooks pour :
|
||||
|
||||
1. **Notifications** - Slack, Discord, Email
|
||||
2. **CI/CD** - Déclenchement automatique des builds
|
||||
3. **Deployment** - Déploiement automatique
|
||||
|
||||
### API Gitea
|
||||
|
||||
Utilisez l'API Gitea pour l'automatisation :
|
||||
|
||||
```bash
|
||||
# Exemple : Créer une release
|
||||
curl -X POST "https://git.4nkweb.com/api/v1/repos/4nk/4NK_node/releases" \
|
||||
-H "Authorization: token YOUR_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"tag_name": "v1.0.0",
|
||||
"name": "Release v1.0.0",
|
||||
"body": "Description de la release"
|
||||
}'
|
||||
```
|
||||
|
||||
## 🏷️ Labels et Milestones
|
||||
|
||||
### Labels Recommandés
|
||||
|
||||
- **bug** - Problèmes et bugs
|
||||
- **enhancement** - Nouvelles fonctionnalités
|
||||
- **documentation** - Amélioration de la documentation
|
||||
- **good first issue** - Pour les nouveaux contributeurs
|
||||
- **help wanted** - Besoin d'aide
|
||||
- **priority: high** - Priorité élevée
|
||||
- **priority: low** - Priorité basse
|
||||
- **status: blocked** - Bloqué
|
||||
- **status: in progress** - En cours
|
||||
- **status: ready for review** - Prêt pour review
|
||||
|
||||
### Milestones
|
||||
|
||||
- **v1.0.0** - Version stable initiale
|
||||
- **v1.1.0** - Améliorations et corrections
|
||||
- **v2.0.0** - Nouvelles fonctionnalités majeures
|
||||
|
||||
## 🔐 Sécurité Gitea
|
||||
|
||||
### Permissions
|
||||
|
||||
1. **Repository** :
|
||||
- Public pour l'open source
|
||||
- Issues et PR activés
|
||||
- Wiki activé (optionnel)
|
||||
|
||||
2. **Collaborateurs** :
|
||||
- Maintainers : Write access
|
||||
- Contributors : Read access
|
||||
- Public : Read access
|
||||
|
||||
### Secrets
|
||||
|
||||
Stockez les secrets sensibles dans les variables d'environnement Gitea :
|
||||
|
||||
- `DOCKER_USERNAME`
|
||||
- `DOCKER_PASSWORD`
|
||||
- `GITEA_TOKEN`
|
||||
- `SLACK_WEBHOOK_URL`
|
||||
|
||||
## 📊 Monitoring et Analytics
|
||||
|
||||
### Gitea Analytics
|
||||
|
||||
- **Traffic** - Vues du repository
|
||||
- **Contributors** - Contributeurs actifs
|
||||
- **Issues** - Statistiques des issues
|
||||
- **Pull Requests** - Statistiques des PR
|
||||
|
||||
### Intégrations Externes
|
||||
|
||||
- **Codecov** - Couverture de code
|
||||
- **SonarCloud** - Qualité du code
|
||||
- **Dependabot** - Mise à jour des dépendances
|
||||
|
||||
## 🚀 Workflow de Contribution
|
||||
|
||||
### 1. Fork et Clone
|
||||
|
||||
```bash
|
||||
# Fork sur Gitea
|
||||
# Puis clone
|
||||
git clone https://git.4nkweb.com/votre-username/4NK_node.git
|
||||
cd 4NK_node
|
||||
|
||||
# Ajouter l'upstream
|
||||
git remote add upstream https://git.4nkweb.com/4nk/4NK_node.git
|
||||
```
|
||||
|
||||
### 2. Développement
|
||||
|
||||
```bash
|
||||
# Créer une branche
|
||||
git checkout -b feature/nouvelle-fonctionnalite
|
||||
|
||||
# Développer
|
||||
# ...
|
||||
|
||||
# Commiter
|
||||
git commit -m "feat: ajouter nouvelle fonctionnalité"
|
||||
|
||||
# Pousser
|
||||
git push origin feature/nouvelle-fonctionnalite
|
||||
```
|
||||
|
||||
### 3. Pull Request
|
||||
|
||||
1. Créer une PR sur Gitea
|
||||
2. Remplir le template
|
||||
3. Attendre les reviews
|
||||
4. Merge après approbation
|
||||
|
||||
## 🔧 Configuration Avancée
|
||||
|
||||
### Gitea Configuration
|
||||
|
||||
```ini
|
||||
# gitea.ini
|
||||
[repository]
|
||||
DEFAULT_BRANCH = main
|
||||
PUSH_CREATE_DELETE_PROTECTED_BRANCH = true
|
||||
|
||||
[repository.pull-request]
|
||||
ENABLE_WHITELIST = true
|
||||
WHITELIST_USERS = admin,maintainer
|
||||
```
|
||||
|
||||
### Webhooks Configuration
|
||||
|
||||
```yaml
|
||||
# webhook.yml
|
||||
url: "https://your-ci-server.com/webhook"
|
||||
content_type: "application/json"
|
||||
secret: "your-secret"
|
||||
events:
|
||||
- push
|
||||
- pull_request
|
||||
- issues
|
||||
```
|
||||
|
||||
## 📚 Ressources
|
||||
|
||||
### Documentation Gitea
|
||||
|
||||
- [Gitea Documentation](https://docs.gitea.io/)
|
||||
- [Gitea API](https://docs.gitea.io/en-us/api-usage/)
|
||||
- [Gitea Actions](https://docs.gitea.io/en-us/actions/)
|
||||
|
||||
### Outils Utiles
|
||||
|
||||
- **Gitea CLI** - Interface en ligne de commande
|
||||
- **Gitea SDK** - SDK pour l'automatisation
|
||||
- **Gitea Runner** - Runner pour les actions
|
||||
|
||||
---
|
||||
|
||||
**Configuration Gitea terminée ! Le projet est prêt pour l'open source sur git.4nkweb.com** 🚀
|
313
docs/INDEX.md
313
docs/INDEX.md
@ -1,313 +0,0 @@
|
||||
# 📚 Index de Documentation - 4NK_node
|
||||
|
||||
Index complet de la documentation de l'infrastructure 4NK_node.
|
||||
|
||||
## 📖 Guides Principaux
|
||||
|
||||
### 🚀 [Guide d'Installation](INSTALLATION.md)
|
||||
Guide complet pour installer et configurer l'infrastructure 4NK_node.
|
||||
- **Prérequis système et logiciels**
|
||||
- **Installation de Docker et dépendances**
|
||||
- **Configuration SSH et Gitea**
|
||||
- **Configuration initiale des services**
|
||||
- **Tests post-installation**
|
||||
- **Dépannage et monitoring**
|
||||
|
||||
### 📖 [Guide d'Utilisation](USAGE.md)
|
||||
Guide complet pour utiliser l'infrastructure 4NK_node au quotidien.
|
||||
- **Démarrage quotidien des services**
|
||||
- **Opérations de surveillance et monitoring**
|
||||
- **Utilisation du réseau de relais**
|
||||
- **Connexion aux services (Bitcoin Core, Blindbit, sdk_relay, sdk_storage)**
|
||||
- **Tests et validation**
|
||||
- **Configuration et maintenance**
|
||||
- **Gestion des nœuds externes**
|
||||
|
||||
### ⚙️ [Guide de Configuration](CONFIGURATION.md)
|
||||
Guide complet pour configurer l'infrastructure selon vos besoins.
|
||||
- **Configuration générale et variables d'environnement**
|
||||
- **Configuration Bitcoin Core (base et avancée)**
|
||||
- **Configuration Blindbit (base et avancée)**
|
||||
- **Configuration des relais (base et avancée)**
|
||||
- **Configuration des nœuds externes**
|
||||
- **Configuration Tor**
|
||||
- **Configuration Docker Compose**
|
||||
- **Configuration SSL/TLS**
|
||||
- **Configuration de monitoring et sauvegarde**
|
||||
|
||||
## 🔧 Guides Techniques
|
||||
|
||||
### 🏗️ [Architecture Technique](ARCHITECTURE.md)
|
||||
Documentation technique détaillée de l'architecture.
|
||||
- **Architecture générale du système**
|
||||
- **Composants principaux (Bitcoin Core, Blindbit, SDK Relay)**
|
||||
- **Architecture de synchronisation mesh**
|
||||
- **Flux de données entre services**
|
||||
- **Configuration multi-relais**
|
||||
- **Sécurité et isolation**
|
||||
- **Performance et optimisations**
|
||||
- **Monitoring et observabilité**
|
||||
|
||||
### 📡 [API Reference](API.md)
|
||||
Documentation complète des APIs disponibles.
|
||||
- **API Bitcoin Core RPC** : Interface JSON-RPC pour Bitcoin
|
||||
- **API Blindbit HTTP** : API REST pour les paiements silencieux
|
||||
- **API SDK Relay WebSocket** : Interface temps réel pour les clients
|
||||
- **API SDK Relay HTTP** : API REST pour les opérations de gestion
|
||||
- **API SDK Storage HTTP** : API REST de stockage clé/valeur TTL via `/storage/*`
|
||||
- **Format des messages et payloads**
|
||||
- **Gestion des erreurs**
|
||||
- **Exemples d'utilisation**
|
||||
- **Limites et quotas**
|
||||
|
||||
### 🔒 [Sécurité](SECURITY.md)
|
||||
Guide de sécurité et bonnes pratiques.
|
||||
- **Authentification et autorisation**
|
||||
- **Chiffrement et certificats**
|
||||
- **Isolation réseau**
|
||||
- **Audit et monitoring de sécurité**
|
||||
- **Bonnes pratiques**
|
||||
|
||||
### 🐙 [Configuration Gitea](GITEA_SETUP.md)
|
||||
Guide de configuration spécifique pour Gitea.
|
||||
- **Configuration du repository Gitea**
|
||||
- **Templates d'issues et pull requests**
|
||||
- **Configuration CI/CD avec Gitea Actions**
|
||||
- **Intégrations et webhooks**
|
||||
- **Workflow de contribution**
|
||||
- **Sécurité et permissions**
|
||||
|
||||
### 🚀 [Plan de Release](RELEASE_PLAN.md)
|
||||
Plan de lancement open source complet.
|
||||
- **Phases de préparation**
|
||||
- **Communication et marketing**
|
||||
- **Checklist de lancement**
|
||||
- **Support communautaire**
|
||||
- **Gestion des risques**
|
||||
|
||||
### 🌟 [Guide de la Communauté](COMMUNITY_GUIDE.md)
|
||||
Guide complet pour la communauté.
|
||||
- **Comment contribuer**
|
||||
- **Ressources d'apprentissage**
|
||||
- **Environnement de développement**
|
||||
- **Processus de contribution**
|
||||
- **Support et reconnaissance**
|
||||
|
||||
### 🗺️ [Roadmap](ROADMAP.md)
|
||||
Roadmap de développement détaillée.
|
||||
- **Timeline de développement**
|
||||
- **Fonctionnalités planifiées**
|
||||
- **Évolution de l'architecture**
|
||||
- **Métriques de succès**
|
||||
- **Vision long terme**
|
||||
|
||||
### 📈 [Performance](PERFORMANCE.md)
|
||||
Guide d'optimisation et monitoring des performances.
|
||||
- **Optimisation des ressources**
|
||||
- **Monitoring des performances**
|
||||
- **Tests de charge**
|
||||
- **Métriques et alertes**
|
||||
- **Troubleshooting des performances**
|
||||
|
||||
## 🧪 Guides de Test
|
||||
|
||||
### 🧪 [Guide de Tests](TESTING.md)
|
||||
Guide complet des tests de l'infrastructure 4NK_node.
|
||||
- **Tests unitaires** : Tests individuels des composants
|
||||
- **Tests d'intégration** : Tests d'interaction entre services
|
||||
- **Tests de connectivité** : Tests réseau et WebSocket
|
||||
- **Tests externes** : Tests avec des nœuds externes
|
||||
- **Tests de performance** : Tests de charge et performance (à venir)
|
||||
- **Organisation et exécution des tests**
|
||||
- **Interprétation des résultats**
|
||||
- **Dépannage et maintenance**
|
||||
|
||||
### 🔄 [Tests de Synchronisation](SYNC_TESTING.md)
|
||||
Guide des tests de synchronisation entre relais.
|
||||
- **Tests de synchronisation mesh**
|
||||
- **Tests de découverte de relais**
|
||||
- **Tests de cache de déduplication**
|
||||
- **Tests de métriques de synchronisation**
|
||||
- **Troubleshooting de la synchronisation**
|
||||
|
||||
### 📊 [Tests de Performance](PERFORMANCE_TESTING.md)
|
||||
Guide des tests de performance et de charge.
|
||||
- **Tests de charge WebSocket**
|
||||
- **Tests de performance Bitcoin Core**
|
||||
- **Tests de performance Blindbit**
|
||||
- **Tests de scalabilité**
|
||||
- **Benchmarks et métriques**
|
||||
|
||||
## 🌐 Guides Réseau
|
||||
|
||||
### 🌐 [Réseau de Relais](RELAY_NETWORK.md)
|
||||
Guide de configuration du réseau mesh de relais.
|
||||
- **Architecture mesh**
|
||||
- **Configuration des relais locaux**
|
||||
- **Synchronisation entre relais**
|
||||
- **Découverte automatique**
|
||||
- **Gestion des connexions**
|
||||
|
||||
### 🌍 [Nœuds Externes](EXTERNAL_NODES.md)
|
||||
Guide d'ajout et de gestion de nœuds externes.
|
||||
- **Configuration des nœuds externes**
|
||||
- **Script d'administration**
|
||||
- **Validation et sécurité**
|
||||
- **Tests de connectivité**
|
||||
- **Gestion multi-sites**
|
||||
|
||||
### 🔄 [Synchronisation](SYNCHRONIZATION.md)
|
||||
Guide du protocole de synchronisation.
|
||||
- **Protocole de synchronisation**
|
||||
- **Types de messages**
|
||||
- **Cache de déduplication**
|
||||
- **Métriques de synchronisation**
|
||||
- **Troubleshooting**
|
||||
|
||||
## 📋 Guides de Référence
|
||||
|
||||
### 📋 [Commandes Rapides](QUICK_REFERENCE.md)
|
||||
Référence rapide des commandes essentielles.
|
||||
- **Commandes de démarrage**
|
||||
- **Commandes de monitoring**
|
||||
- **Commandes de test**
|
||||
- **Commandes de dépannage**
|
||||
- **Commandes de maintenance**
|
||||
|
||||
### 📋 [Troubleshooting](TROUBLESHOOTING.md)
|
||||
Guide de résolution des problèmes courants.
|
||||
- **Problèmes de démarrage**
|
||||
- **Problèmes de connectivité**
|
||||
- **Problèmes de synchronisation**
|
||||
- **Problèmes de performance**
|
||||
- **Logs et diagnostics**
|
||||
|
||||
### 📋 [FAQ](FAQ.md)
|
||||
Questions fréquemment posées.
|
||||
- **Questions d'installation**
|
||||
- **Questions de configuration**
|
||||
- **Questions d'utilisation**
|
||||
- **Questions de performance**
|
||||
- **Questions de sécurité**
|
||||
|
||||
## 📁 Structure des Fichiers
|
||||
|
||||
```
|
||||
4NK_node/
|
||||
├── README.md # Documentation principale
|
||||
├── docs/ # Documentation organisée
|
||||
│ ├── INDEX.md # Cet index
|
||||
│ ├── INSTALLATION.md # Guide d'installation
|
||||
│ ├── USAGE.md # Guide d'utilisation
|
||||
│ ├── CONFIGURATION.md # Guide de configuration
|
||||
│ ├── ARCHITECTURE.md # Architecture technique
|
||||
│ ├── API.md # Référence API
|
||||
│ ├── SECURITY.md # Guide de sécurité
|
||||
│ ├── PERFORMANCE.md # Guide de performance
|
||||
│ ├── TESTING.md # Tests de base
|
||||
│ ├── SYNC_TESTING.md # Tests de synchronisation
|
||||
│ ├── PERFORMANCE_TESTING.md # Tests de performance
|
||||
│ ├── RELAY_NETWORK.md # Réseau de relais
|
||||
│ ├── EXTERNAL_NODES.md # Nœuds externes
|
||||
│ ├── SYNCHRONIZATION.md # Protocole de synchronisation
|
||||
│ ├── QUICK_REFERENCE.md # Commandes rapides
|
||||
│ ├── TROUBLESHOOTING.md # Guide de dépannage
|
||||
│ └── FAQ.md # Questions fréquentes
|
||||
├── specs/ # Spécifications techniques
|
||||
│ ├── spec-technique.md # Spécification technique
|
||||
│ └── spec-fonctionnel.md # Spécification fonctionnelle
|
||||
├── scripts/ # Scripts utilitaires
|
||||
├── tests/ # Scripts de test
|
||||
└── examples/ # Exemples d'utilisation
|
||||
```
|
||||
|
||||
## 🎯 Parcours d'Apprentissage
|
||||
|
||||
### 🚀 **Débutant**
|
||||
1. [Guide d'Installation](INSTALLATION.md) - Installer l'infrastructure
|
||||
2. [Guide d'Utilisation](USAGE.md) - Utiliser les services de base
|
||||
3. [Tests de Base](TESTING.md) - Vérifier le fonctionnement
|
||||
4. [FAQ](FAQ.md) - Réponses aux questions courantes
|
||||
|
||||
### 🔧 **Intermédiaire**
|
||||
1. [Guide de Configuration](CONFIGURATION.md) - Configurer selon vos besoins
|
||||
2. [Réseau de Relais](RELAY_NETWORK.md) - Comprendre l'architecture mesh
|
||||
3. [Nœuds Externes](EXTERNAL_NODES.md) - Ajouter des nœuds externes
|
||||
4. [Tests de Synchronisation](SYNC_TESTING.md) - Tester la synchronisation
|
||||
|
||||
### 🏗️ **Avancé**
|
||||
1. [Architecture Technique](ARCHITECTURE.md) - Comprendre l'architecture
|
||||
2. [API Reference](API.md) - Utiliser les APIs
|
||||
3. [Sécurité](SECURITY.md) - Sécuriser l'infrastructure
|
||||
4. [Performance](PERFORMANCE.md) - Optimiser les performances
|
||||
5. [Tests de Performance](PERFORMANCE_TESTING.md) - Tests avancés
|
||||
|
||||
### 🛠️ **Expert**
|
||||
1. [Synchronisation](SYNCHRONIZATION.md) - Protocole de synchronisation
|
||||
2. [Troubleshooting](TROUBLESHOOTING.md) - Résolution de problèmes
|
||||
3. [Commandes Rapides](QUICK_REFERENCE.md) - Référence rapide
|
||||
4. Spécifications techniques dans `/specs/`
|
||||
|
||||
## 🔍 Recherche dans la Documentation
|
||||
|
||||
### Par Sujet
|
||||
- **Installation** : [INSTALLATION.md](INSTALLATION.md)
|
||||
- **Configuration** : [CONFIGURATION.md](CONFIGURATION.md)
|
||||
- **Utilisation** : [USAGE.md](USAGE.md)
|
||||
- **Tests** : [TESTING.md](TESTING.md), [SYNC_TESTING.md](SYNC_TESTING.md)
|
||||
- **Réseau** : [RELAY_NETWORK.md](RELAY_NETWORK.md), [EXTERNAL_NODES.md](EXTERNAL_NODES.md)
|
||||
- **Performance** : [PERFORMANCE.md](PERFORMANCE.md)
|
||||
- **Sécurité** : [SECURITY.md](SECURITY.md)
|
||||
- **Dépannage** : [TROUBLESHOOTING.md](TROUBLESHOOTING.md)
|
||||
|
||||
### Par Service
|
||||
- **Bitcoin Core** : [CONFIGURATION.md](CONFIGURATION.md#configuration-bitcoin-core)
|
||||
- **Blindbit** : [CONFIGURATION.md](CONFIGURATION.md#configuration-blindbit)
|
||||
- **sdk_relay** : [CONFIGURATION.md](CONFIGURATION.md#configuration-des-relais)
|
||||
- **Tor** : [CONFIGURATION.md](CONFIGURATION.md#configuration-tor)
|
||||
|
||||
### Par Tâche
|
||||
- **Démarrer** : [USAGE.md](USAGE.md#démarrage-quotidien)
|
||||
- **Configurer** : [CONFIGURATION.md](CONFIGURATION.md)
|
||||
- **Tester** : [TESTING.md](TESTING.md)
|
||||
- **Monitorer** : [USAGE.md](USAGE.md#monitoring-et-alertes)
|
||||
- **Dépanner** : [TROUBLESHOOTING.md](TROUBLESHOOTING.md)
|
||||
|
||||
## 📞 Support
|
||||
|
||||
### Documentation
|
||||
- **Index** : [INDEX.md](INDEX.md) - Cet index
|
||||
- **FAQ** : [FAQ.md](FAQ.md) - Questions fréquentes
|
||||
- **Troubleshooting** : [TROUBLESHOOTING.md](TROUBLESHOOTING.md) - Résolution de problèmes
|
||||
|
||||
### Ressources Externes
|
||||
- **Repository** : https://git.4nkweb.com/4nk/4NK_node
|
||||
- **Issues** : https://git.4nkweb.com/4nk/4NK_node/issues
|
||||
- **Wiki** : https://git.4nkweb.com/4nk/4NK_node/wiki
|
||||
|
||||
### Contact
|
||||
- **Email** : support@4nkweb.com
|
||||
- **Chat** : [Discord 4NK](https://discord.gg/4nk)
|
||||
- **Forum** : [Forum 4NK](https://forum.4nkweb.com)
|
||||
|
||||
## 🔄 Mise à Jour de la Documentation
|
||||
|
||||
### Dernière Mise à Jour
|
||||
- **Date** : $(date)
|
||||
- **Version** : 1.1.0
|
||||
- **Auteur** : Équipe 4NK
|
||||
|
||||
### Historique des Versions
|
||||
- **v1.0.0** : Documentation initiale complète
|
||||
- **v0.9.0** : Documentation de base
|
||||
- **v0.8.0** : Guides techniques
|
||||
- **v0.7.0** : Guides de test
|
||||
|
||||
### Contribution
|
||||
Pour contribuer à la documentation :
|
||||
1. Fork le repository
|
||||
2. Créer une branche pour votre contribution
|
||||
3. Modifier la documentation
|
||||
4. Créer une Pull Request
|
||||
|
||||
---
|
@ -1,611 +0,0 @@
|
||||
# 📦 Guide d'Installation - 4NK_node
|
||||
|
||||
Guide complet pour installer et configurer l'infrastructure 4NK_node.
|
||||
|
||||
## 📋 Prérequis
|
||||
|
||||
### Système
|
||||
|
||||
- **OS** : Linux (Ubuntu 20.04+, Debian 11+, CentOS 8+)
|
||||
- **Architecture** : x86_64
|
||||
- **RAM** : 4 Go minimum, 8 Go recommandés
|
||||
- **Stockage** : 20 Go minimum, 50 Go recommandés
|
||||
- **Réseau** : Connexion Internet stable
|
||||
|
||||
### Logiciels
|
||||
|
||||
- **Docker** : Version 20.10+
|
||||
- **Docker Compose** : Version 2.0+
|
||||
- **Git** : Version 2.25+
|
||||
- **Bash** : Version 4.0+
|
||||
|
||||
## 🚀 Installation
|
||||
|
||||
### 1. Amorçage automatique (recommandé)
|
||||
|
||||
Exécuter le script d’amorçage qui installe git, Docker, Docker Compose, Node.js/npm (via nvm, dernière LTS) et ajoute l’utilisateur au groupe docker dès le début.
|
||||
|
||||
```bash
|
||||
./scripts/bootstrap.sh
|
||||
# Se déconnecter/reconnecter ensuite ou `newgrp docker` pour activer le groupe docker
|
||||
```
|
||||
|
||||
### 2. Installation de Docker (manuel)
|
||||
|
||||
#### Ubuntu/Debian
|
||||
|
||||
```bash
|
||||
# Mettre à jour les paquets
|
||||
sudo apt update
|
||||
|
||||
# Installer les dépendances
|
||||
sudo apt install -y apt-transport-https ca-certificates curl gnupg lsb-release
|
||||
|
||||
# Ajouter la clé GPG Docker
|
||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
||||
|
||||
# Ajouter le repository Docker
|
||||
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
|
||||
# Installer Docker
|
||||
sudo apt update
|
||||
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
|
||||
|
||||
# Ajouter l'utilisateur au groupe docker
|
||||
sudo usermod -aG docker $USER
|
||||
|
||||
# Démarrer Docker
|
||||
sudo systemctl start docker
|
||||
sudo systemctl enable docker
|
||||
```
|
||||
|
||||
#### CentOS/RHEL
|
||||
|
||||
```bash
|
||||
# Installer les dépendances
|
||||
sudo yum install -y yum-utils
|
||||
|
||||
# Ajouter le repository Docker
|
||||
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
|
||||
|
||||
# Installer Docker
|
||||
sudo yum install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
|
||||
|
||||
# Démarrer Docker
|
||||
sudo systemctl start docker
|
||||
sudo systemctl enable docker
|
||||
|
||||
# Ajouter l'utilisateur au groupe docker
|
||||
sudo usermod -aG docker $USER
|
||||
```
|
||||
|
||||
### 3. Configuration SSH (recommandé)
|
||||
|
||||
```bash
|
||||
# Générer une clé SSH
|
||||
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519_4nk -C "4nk-automation"
|
||||
|
||||
# Ajouter à l'agent SSH
|
||||
ssh-add ~/.ssh/id_ed25519_4nk
|
||||
|
||||
# Configurer Git pour utiliser la clé
|
||||
git config --global core.sshCommand "ssh -i ~/.ssh/id_ed25519_4nk"
|
||||
|
||||
# Afficher la clé publique pour Gitea
|
||||
cat ~/.ssh/id_ed25519_4nk.pub
|
||||
```
|
||||
|
||||
**Ajouter la clé publique à Gitea :**
|
||||
1. Aller sur Gitea > Settings > SSH Keys
|
||||
2. Coller la clé publique
|
||||
3. Cliquer sur "Add key"
|
||||
|
||||
### 4. Clonage du repository
|
||||
|
||||
```bash
|
||||
# Cloner avec SSH (recommandé)
|
||||
git clone git@git.4nkweb.com:4nk/4NK_node.git
|
||||
cd 4NK_node
|
||||
|
||||
# Ou avec HTTPS (si SSH non configuré)
|
||||
# git clone https://git.4nkweb.com/4nk/4NK_node.git
|
||||
# cd 4NK_node
|
||||
```
|
||||
|
||||
### 5. Vérification de l'installation
|
||||
|
||||
```bash
|
||||
# Vérifier Docker
|
||||
docker --version
|
||||
docker-compose --version
|
||||
|
||||
# Vérifier la connectivité Gitea
|
||||
ssh -T git@git.4nkweb.com
|
||||
|
||||
# Vérifier les permissions
|
||||
ls -la
|
||||
```
|
||||
|
||||
## 🔧 Configuration initiale
|
||||
|
||||
### 1. Configuration des Variables d'Environnement
|
||||
|
||||
```bash
|
||||
# Créer le fichier d'environnement
|
||||
cat > .env << EOF
|
||||
# Configuration 4NK_node
|
||||
PROJECT_NAME=4NK_node
|
||||
NETWORK_NAME=4nk_node_btcnet
|
||||
|
||||
# Logs
|
||||
RUST_LOG=debug,bitcoincore_rpc=trace
|
||||
|
||||
# Bitcoin
|
||||
BITCOIN_COOKIE_PATH=/home/bitcoin/.bitcoin/signet/.cookie
|
||||
|
||||
# Synchronisation
|
||||
ENABLE_SYNC_TEST=1
|
||||
|
||||
# Ports
|
||||
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
|
||||
EOF
|
||||
```
|
||||
|
||||
### 2. Préparation de l’UI (ihm_client)
|
||||
|
||||
```bash
|
||||
# Construire l’UI localement et produire ./ihm_client/dist
|
||||
chmod +x scripts/build_ui_local.sh
|
||||
./scripts/build_ui_local.sh
|
||||
```
|
||||
|
||||
### 3. Génération des certificats
|
||||
|
||||
```bash
|
||||
# Générer les certificats auto-signés et appliquer les bons droits
|
||||
chmod +x scripts/generate_certs.sh
|
||||
./scripts/generate_certs.sh
|
||||
```
|
||||
|
||||
#### (Option production) Certificats Let’s Encrypt + HSTS
|
||||
|
||||
Pré-requis : le DNS du domaine (ex. `dev4.4nkweb.com`) pointe vers le serveur et le port 80 est accessible.
|
||||
|
||||
1) Le reverse proxy expose le webroot ACME en HTTP sur `/.well-known/acme-challenge/` (répertoire local `./acme`).
|
||||
|
||||
2) Émettre/renouveler et installer le certificat :
|
||||
```bash
|
||||
chmod +x scripts/renew_certs.sh
|
||||
./scripts/renew_certs.sh
|
||||
```
|
||||
|
||||
3) Activer un cron quotidien (03:00) :
|
||||
```bash
|
||||
0 3 * * * /home/debian/4NK_node/scripts/renew_certs.sh >> /home/debian/4NK_node/logs/cert_renew.log 2>&1
|
||||
```
|
||||
|
||||
Notes :
|
||||
- Les fichiers sont installés dans `./certs/server.crt` et `./certs/server.key` (droits: 0644/0600).
|
||||
- HSTS est activé par défaut sur le reverse proxy.
|
||||
|
||||
### 4. Configuration Bitcoin Core
|
||||
|
||||
```bash
|
||||
# Vérifier la configuration Bitcoin
|
||||
cat bitcoin/bitcoin.conf
|
||||
|
||||
# Modifier si nécessaire
|
||||
nano bitcoin/bitcoin.conf
|
||||
```
|
||||
|
||||
**Configuration recommandée :**
|
||||
```ini
|
||||
# Configuration Bitcoin Core Signet
|
||||
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
|
||||
```
|
||||
|
||||
### 5. Configuration Tor (option bridges)
|
||||
|
||||
Si votre réseau nécessite des bridges obfs4, ajoutez-les dans `tor/torrc` :
|
||||
|
||||
```ini
|
||||
UseBridges 1
|
||||
ClientTransportPlugin obfs4 exec /usr/bin/obfs4proxy
|
||||
# Exemple
|
||||
Bridge obfs4 81.64.0.218:6697 53E6469DC06BED50543AED0311D66082F4B66676 cert=zOKy+MnZ4wWbKcENcyaElPu62PEaXdE/c802ssuzCIDa2aIC1+J4LyfPhAwSiLaAo/I/bg iat-mode=0
|
||||
Bridge obfs4 198.98.53.149:443 886CA31F71272FC8B3808C601FA3ABB8A2905DB4 cert=D+zypuFdMpP8riBUbInxIguzqClR0JKkP1DbkKz5es1+OP2Fao8jiXyM+B/+DYA2ZFy6UA iat-mode=0
|
||||
```
|
||||
|
||||
Puis reconstruire et (re)démarrer :
|
||||
|
||||
```bash
|
||||
sudo docker compose build tor
|
||||
sudo docker compose up -d tor
|
||||
```
|
||||
|
||||
### 6. Configuration Blindbit
|
||||
|
||||
```bash
|
||||
# Vérifier la configuration Blindbit
|
||||
cat blindbit/blindbit.toml
|
||||
|
||||
# Modifier si nécessaire
|
||||
nano blindbit/blindbit.toml
|
||||
```
|
||||
|
||||
**Configuration recommandée :**
|
||||
```toml
|
||||
# Configuration Blindbit
|
||||
host = "0.0.0.0:8000"
|
||||
chain = "signet"
|
||||
rpc_endpoint = "http://bitcoin:18443"
|
||||
cookie_path = "/home/bitcoin/.bitcoin/signet/.cookie"
|
||||
sync_start_height = 1
|
||||
max_parallel_tweak_computations = 4
|
||||
max_parallel_requests = 4
|
||||
```
|
||||
|
||||
### 7. Configuration des Relais
|
||||
|
||||
```bash
|
||||
# Vérifier les configurations des relais
|
||||
ls -la sdk_relay/.conf.docker.*
|
||||
|
||||
# Modifier si nécessaire
|
||||
nano sdk_relay/.conf.docker.relay1
|
||||
nano sdk_relay/.conf.docker.relay2
|
||||
nano sdk_relay/.conf.docker.relay3
|
||||
```
|
||||
|
||||
**Configuration recommandée pour chaque relay :**
|
||||
```ini
|
||||
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 # Changer pour chaque relay
|
||||
```
|
||||
|
||||
## 🚀 Démarrage
|
||||
|
||||
### Déploiement automatisé (première installation)
|
||||
|
||||
Deux scripts facilitent l’installation complète A→Z :
|
||||
|
||||
- Avec certificats Let’s Encrypt (domaine requis):
|
||||
- `scripts/deploy_first_install_with_certs.sh --domain dev4.4nkweb.com --email admin@exemple.com [--skip-ui]`
|
||||
- Actions: préparation des dossiers, lancement du proxy pour ACME, émission LE en webroot, installation dans `./certs/`, démarrage complet, cron de renouvellement, vérifications.
|
||||
|
||||
- Sans certificats (auto‑signé):
|
||||
- `scripts/deploy_first_install_no_certs.sh [--skip-ui]`
|
||||
- Actions: génération auto‑signée via `scripts/generate_certs.sh`, démarrage complet, vérifications locales.
|
||||
|
||||
### 1. Démarrage Complet
|
||||
|
||||
```bash
|
||||
# Démarrer l’infrastructure (reverse proxy inclus)
|
||||
sudo docker compose up -d --build
|
||||
|
||||
# Vérifier le statut
|
||||
docker ps
|
||||
```
|
||||
|
||||
### 2. Démarrage Séquentiel (Debug)
|
||||
|
||||
```bash
|
||||
# Démarrer Tor (si utilisé)
|
||||
sudo docker compose up -d tor
|
||||
|
||||
# Démarrer Bitcoin Core
|
||||
sudo docker compose up -d bitcoin
|
||||
|
||||
# Attendre la synchronisation Bitcoin (10-30 minutes)
|
||||
echo "Attendre la synchronisation Bitcoin..."
|
||||
docker logs bitcoin-signet | grep "progress"
|
||||
|
||||
# Démarrer Blindbit
|
||||
sudo docker compose up -d blindbit
|
||||
|
||||
# Démarrer les relais et le reverse proxy
|
||||
sudo docker compose up -d sdk_relay_1 sdk_relay_2 sdk_relay_3 reverse_proxy
|
||||
```
|
||||
|
||||
### 3. Vérification du Démarrage
|
||||
|
||||
```bash
|
||||
# Vérifier tous les services
|
||||
docker ps
|
||||
|
||||
# Vérifier les logs
|
||||
docker-compose logs --tail=50
|
||||
|
||||
# Vérifier l’accès public
|
||||
curl -kI https://<IP_VM>/
|
||||
curl -kI https://<IP_VM>/api/
|
||||
```
|
||||
|
||||
## 🧪 Tests Post-Installation
|
||||
|
||||
### 1. Tests de Connectivité
|
||||
|
||||
```bash
|
||||
# Test de base
|
||||
./test_final_sync.sh
|
||||
|
||||
# Test de synchronisation
|
||||
./test_sync_logs.sh
|
||||
|
||||
# Test des messages WebSocket
|
||||
python3 test_websocket_messages.py
|
||||
```
|
||||
|
||||
### 2. Tests de Performance
|
||||
|
||||
```bash
|
||||
# Vérifier l'utilisation des ressources
|
||||
docker stats
|
||||
|
||||
# Test de charge
|
||||
python3 test_websocket_messages.py --load-test
|
||||
|
||||
# Monitoring de la synchronisation
|
||||
./monitor_sync.sh
|
||||
```
|
||||
|
||||
### 3. Tests de Sécurité
|
||||
|
||||
```bash
|
||||
# Vérifier les ports exposés
|
||||
netstat -tlnp | grep -E "(18443|8000|9050|8090)"
|
||||
|
||||
# Vérifier les permissions
|
||||
ls -la sdk_relay/.conf*
|
||||
ls -la bitcoin/bitcoin.conf
|
||||
ls -la blindbit/blindbit.toml
|
||||
```
|
||||
|
||||
## 🔧 Configuration Avancée
|
||||
|
||||
### 1. Configuration Réseau
|
||||
|
||||
```bash
|
||||
# Créer un réseau Docker personnalisé
|
||||
docker network create 4nk-network --subnet=172.20.0.0/16
|
||||
|
||||
# Modifier docker-compose.yml
|
||||
sed -i 's/4nk_default/4nk-network/g' docker-compose.yml
|
||||
```
|
||||
|
||||
### 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. 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
|
||||
```
|
||||
|
||||
## 🚨 Dépannage
|
||||
|
||||
### Problèmes Courants
|
||||
|
||||
#### 1. Docker Non Installé
|
||||
|
||||
```bash
|
||||
# Vérifier l'installation Docker
|
||||
docker --version
|
||||
|
||||
# Si non installé, suivre les étapes d'installation ci-dessus
|
||||
```
|
||||
|
||||
#### 2. Permissions Docker
|
||||
|
||||
```bash
|
||||
# Vérifier les permissions
|
||||
docker ps
|
||||
|
||||
# Si erreur de permission
|
||||
sudo usermod -aG docker $USER
|
||||
newgrp docker
|
||||
```
|
||||
|
||||
#### 3. Ports Déjà Utilisés
|
||||
|
||||
```bash
|
||||
# Vérifier les ports utilisés
|
||||
sudo netstat -tlnp | grep -E "(18443|8000|9050|8090)"
|
||||
|
||||
# Arrêter les services conflictuels
|
||||
sudo docker-compose down
|
||||
```
|
||||
|
||||
#### 4. Problèmes de Synchronisation Bitcoin
|
||||
|
||||
```bash
|
||||
# Vérifier les logs Bitcoin
|
||||
docker logs bitcoin-signet
|
||||
|
||||
# Vérifier l'espace disque
|
||||
df -h
|
||||
|
||||
# Redémarrer Bitcoin Core
|
||||
docker restart bitcoin-signet
|
||||
```
|
||||
|
||||
### Logs Utiles
|
||||
|
||||
```bash
|
||||
# Logs de tous les services
|
||||
docker-compose logs -f
|
||||
|
||||
# Logs d'un service spécifique
|
||||
docker logs bitcoin-signet
|
||||
docker logs blindbit-oracle
|
||||
docker logs sdk_relay_1
|
||||
|
||||
# Logs avec timestamps
|
||||
docker-compose logs -t
|
||||
|
||||
# Logs depuis une date
|
||||
docker-compose logs --since="2024-01-01T00:00:00"
|
||||
```
|
||||
|
||||
## 📊 Monitoring
|
||||
|
||||
### 1. Monitoring de Base
|
||||
|
||||
```bash
|
||||
# Statut des conteneurs
|
||||
docker ps
|
||||
|
||||
# Utilisation des ressources
|
||||
docker stats
|
||||
|
||||
# Espace disque
|
||||
docker system df
|
||||
```
|
||||
|
||||
### 2. Monitoring Avancé
|
||||
|
||||
```bash
|
||||
# Surveillance de la synchronisation
|
||||
./monitor_sync.sh
|
||||
|
||||
# Monitoring en continu
|
||||
while true; do
|
||||
echo "=== $(date) ==="
|
||||
docker stats --no-stream | grep -E "(sdk_relay|bitcoin)"
|
||||
sleep 30
|
||||
done
|
||||
```
|
||||
|
||||
### 3. Alertes
|
||||
|
||||
```bash
|
||||
# Script d'alerte simple
|
||||
cat > monitor_alert.sh << 'EOF'
|
||||
#!/bin/bash
|
||||
if ! docker ps | grep -q "bitcoin-signet.*Up"; then
|
||||
echo "ALERTE: Bitcoin Core n'est pas en cours d'exécution!"
|
||||
# Ajouter notification (email, Slack, etc.)
|
||||
fi
|
||||
EOF
|
||||
|
||||
chmod +x monitor_alert.sh
|
||||
```
|
||||
|
||||
## 🔄 Mise à Jour
|
||||
|
||||
### 1. Mise à Jour de l'Infrastructure
|
||||
|
||||
```bash
|
||||
# Sauvegarder la configuration
|
||||
cp -r . ../4NK_node_backup_$(date +%Y%m%d)
|
||||
|
||||
# Mettre à jour le code
|
||||
git pull origin main
|
||||
|
||||
# Redémarrer les services
|
||||
./restart_4nk_node.sh
|
||||
```
|
||||
|
||||
### 2. Mise à Jour de Docker
|
||||
|
||||
```bash
|
||||
# Mettre à jour Docker
|
||||
sudo apt update
|
||||
sudo apt upgrade docker-ce docker-ce-cli containerd.io
|
||||
|
||||
# Redémarrer Docker
|
||||
sudo systemctl restart docker
|
||||
```
|
||||
|
||||
### 3. Mise à Jour des Images
|
||||
|
||||
```bash
|
||||
# Reconstruire les images
|
||||
docker-compose build --no-cache
|
||||
|
||||
# Redémarrer les services
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
## 📝 Checklist d'Installation
|
||||
|
||||
- [ ] Docker installé et configuré
|
||||
- [ ] Docker Compose installé
|
||||
- [ ] Clé SSH configurée pour GitLab
|
||||
- [ ] Repository cloné
|
||||
- [ ] Variables d'environnement configurées
|
||||
- [ ] Configurations Bitcoin Core vérifiées
|
||||
- [ ] Configurations Blindbit vérifiées
|
||||
- [ ] Configurations des relais vérifiées
|
||||
- [ ] Services démarrés avec succès
|
||||
- [ ] Tests de connectivité passés
|
||||
- [ ] Tests de synchronisation passés
|
||||
- [ ] Monitoring configuré
|
||||
- [ ] Pare-feu configuré (optionnel)
|
||||
- [ ] SSL/TLS configuré (optionnel)
|
||||
|
||||
## 🎉 Installation Terminée
|
||||
|
||||
Félicitations ! L'infrastructure 4NK_node est maintenant installée et configurée.
|
||||
|
||||
**Prochaines étapes :**
|
||||
1. Consulter le [Guide d'Utilisation](USAGE.md)
|
||||
2. Configurer les [Nœuds Externes](EXTERNAL_NODES.md)
|
||||
3. Tester la [Synchronisation](SYNCHRONIZATION.md)
|
||||
4. Configurer le [Monitoring](PERFORMANCE.md)
|
||||
|
||||
---
|
@ -1,297 +0,0 @@
|
||||
# Intégration de ihm_client dans 4NK_node
|
||||
|
||||
## Vue d'ensemble
|
||||
|
||||
L'interface utilisateur `ihm_client` a été intégrée avec succès dans l'infrastructure `4NK_node`, permettant une expérience utilisateur complète pour interagir avec les Silent Payments.
|
||||
|
||||
## Architecture
|
||||
|
||||
### Services intégrés
|
||||
|
||||
1. **ihm_client** - Interface utilisateur web
|
||||
- Port: 8080
|
||||
- URL: http://localhost:8080
|
||||
- Technologie: TypeScript + Vite + Vue.js
|
||||
|
||||
2. **sdk_relay_1, sdk_relay_2, sdk_relay_3** - Relais Silent Payments
|
||||
- Ports: 8090-8095
|
||||
- Technologie: Rust
|
||||
|
||||
3. **bitcoin** - Nœud Bitcoin Signet
|
||||
- Port: 18443 (RPC)
|
||||
- Technologie: Bitcoin Core
|
||||
|
||||
4. **blindbit** - Oracle Blindbit
|
||||
- Port: 8000
|
||||
- Technologie: Rust
|
||||
|
||||
### Communication entre services
|
||||
|
||||
```
|
||||
ihm_client (8080)
|
||||
↓ HTTP/WebSocket
|
||||
sdk_relay_1 (8090/8091)
|
||||
↓ P2P
|
||||
sdk_relay_2 (8092/8093)
|
||||
↓ P2P
|
||||
sdk_relay_3 (8094/8095)
|
||||
↓ RPC
|
||||
bitcoin (18443)
|
||||
↓ API
|
||||
blindbit (8000)
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### Variables d'environnement
|
||||
|
||||
Le service `ihm_client` est configuré avec les variables d'environnement suivantes :
|
||||
|
||||
```yaml
|
||||
environment:
|
||||
- SDK_RELAY_WS_URL=ws://sdk_relay_1:8090
|
||||
- SDK_RELAY_HTTP_URL=http://sdk_relay_1:8091
|
||||
- BITCOIN_RPC_URL=http://bitcoin:18443
|
||||
- BLINDBIT_URL=http://blindbit:8000
|
||||
```
|
||||
|
||||
### Dépendances
|
||||
|
||||
- `ihm_client` dépend de `sdk_relay_1`, `sdk_relay_2`, `sdk_relay_3`
|
||||
- Les SDK relays dépendent de `bitcoin` et `blindbit`
|
||||
- `blindbit` dépend de `bitcoin`
|
||||
|
||||
## Démarrage
|
||||
|
||||
### Script de démarrage complet
|
||||
|
||||
```bash
|
||||
./start-4nk-node-with-ui.sh
|
||||
```
|
||||
|
||||
Ce script :
|
||||
1. Arrête et nettoie les conteneurs existants
|
||||
2. Démarre tous les services
|
||||
3. Vérifie la santé de chaque service
|
||||
4. Affiche les URLs d'accès
|
||||
|
||||
### Script de démarrage UI uniquement
|
||||
|
||||
```bash
|
||||
./start-ihm-client.sh
|
||||
```
|
||||
|
||||
Ce script démarre uniquement l'interface utilisateur.
|
||||
|
||||
### Démarrage manuel
|
||||
|
||||
```bash
|
||||
# Démarrer tous les services
|
||||
docker-compose up -d
|
||||
|
||||
# Démarrer uniquement l'interface utilisateur
|
||||
docker-compose up -d ihm_client
|
||||
```
|
||||
|
||||
## URLs d'accès
|
||||
|
||||
| Service | URL | Description |
|
||||
|---------|-----|-------------|
|
||||
| Interface utilisateur | http://localhost:8080 | Interface web principale |
|
||||
| Bitcoin RPC | http://localhost:18443 | API Bitcoin |
|
||||
| Blindbit | http://localhost:8000 | Oracle Blindbit |
|
||||
| SDK Relay 1 | http://localhost:8091 | Relais 1 HTTP |
|
||||
| SDK Relay 2 | http://localhost:8093 | Relais 2 HTTP |
|
||||
| SDK Relay 3 | http://localhost:8095 | Relais 3 HTTP |
|
||||
|
||||
## Commandes utiles
|
||||
|
||||
### Vérification du statut
|
||||
|
||||
```bash
|
||||
# Statut de tous les services
|
||||
docker-compose ps
|
||||
|
||||
# Logs d'un service spécifique
|
||||
docker-compose logs ihm_client
|
||||
docker-compose logs sdk_relay_1
|
||||
docker-compose logs bitcoin
|
||||
```
|
||||
|
||||
### Gestion des services
|
||||
|
||||
```bash
|
||||
# Redémarrer un service
|
||||
docker-compose restart ihm_client
|
||||
|
||||
# Arrêter tous les services
|
||||
docker-compose down
|
||||
|
||||
# Reconstruire un service
|
||||
docker-compose build ihm_client
|
||||
```
|
||||
|
||||
### Debugging
|
||||
|
||||
```bash
|
||||
# Accéder au conteneur ihm_client
|
||||
docker exec -it 4nk-ihm-client bash
|
||||
|
||||
# Vérifier les logs en temps réel
|
||||
docker-compose logs -f ihm_client
|
||||
```
|
||||
|
||||
## Fonctionnalités de l'interface utilisateur
|
||||
|
||||
### Pages principales
|
||||
|
||||
1. **Accueil** - Vue d'ensemble et navigation
|
||||
2. **Compte** - Gestion du profil utilisateur
|
||||
3. **Processus** - Création et gestion des processus
|
||||
4. **Signature** - Signatures de documents
|
||||
5. **Chat** - Communication entre membres
|
||||
|
||||
### Fonctionnalités clés
|
||||
|
||||
- **Pairing** - Connexion avec d'autres utilisateurs
|
||||
- **Wallet** - Gestion des Silent Payments
|
||||
- **Documents** - Validation et signature de documents
|
||||
- **Notifications** - Système de notifications en temps réel
|
||||
- **QR Code** - Scanner et génération de QR codes
|
||||
|
||||
## Développement
|
||||
|
||||
### Structure des fichiers
|
||||
|
||||
```
|
||||
4NK_node/
|
||||
├── ihm_client/ # Interface utilisateur
|
||||
│ ├── src/ # Code source TypeScript
|
||||
│ ├── public/ # Assets statiques
|
||||
│ ├── Dockerfile # Configuration Docker
|
||||
│ ├── nginx.conf # Configuration Nginx
|
||||
│ └── start.sh # Script de démarrage
|
||||
├── docker-compose.yml # Orchestration des services
|
||||
└── start-*.sh # Scripts de démarrage
|
||||
```
|
||||
|
||||
### Compilation
|
||||
|
||||
L'interface utilisateur est compilée automatiquement lors du build Docker :
|
||||
|
||||
```bash
|
||||
# Build manuel
|
||||
docker-compose build ihm_client
|
||||
|
||||
# Build avec cache
|
||||
docker-compose build --no-cache ihm_client
|
||||
```
|
||||
|
||||
### Développement local
|
||||
|
||||
Pour développer l'interface utilisateur localement :
|
||||
|
||||
```bash
|
||||
cd ihm_client
|
||||
npm install
|
||||
npm run dev
|
||||
```
|
||||
|
||||
## Monitoring et logs
|
||||
|
||||
### Health checks
|
||||
|
||||
Chaque service dispose d'un health check configuré :
|
||||
|
||||
- **ihm_client** : Vérification HTTP sur localhost
|
||||
- **sdk_relay** : Script de vérification personnalisé
|
||||
- **bitcoin** : Commande `getblockchaininfo`
|
||||
|
||||
### Logs
|
||||
|
||||
Les logs sont configurés avec rotation :
|
||||
|
||||
```yaml
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
```
|
||||
|
||||
## Sécurité
|
||||
|
||||
### Variables d'environnement
|
||||
|
||||
Les variables sensibles sont configurées via les variables d'environnement Docker.
|
||||
|
||||
### Réseau
|
||||
|
||||
Tous les services communiquent via le réseau Docker `btcnet` isolé.
|
||||
|
||||
### Volumes
|
||||
|
||||
Les données persistantes sont stockées dans des volumes Docker nommés.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Problèmes courants
|
||||
|
||||
1. **Service ne démarre pas**
|
||||
```bash
|
||||
docker-compose logs <service_name>
|
||||
```
|
||||
|
||||
2. **Port déjà utilisé**
|
||||
```bash
|
||||
sudo netstat -tulpn | grep :8080
|
||||
```
|
||||
|
||||
3. **Problème de compilation**
|
||||
```bash
|
||||
docker-compose build --no-cache ihm_client
|
||||
```
|
||||
|
||||
### Logs de debug
|
||||
|
||||
Pour activer les logs de debug :
|
||||
|
||||
```bash
|
||||
# SDK relays
|
||||
export RUST_LOG=debug
|
||||
|
||||
# Interface utilisateur
|
||||
docker-compose logs -f ihm_client
|
||||
```
|
||||
|
||||
## Maintenance
|
||||
|
||||
### Mise à jour
|
||||
|
||||
```bash
|
||||
# Mettre à jour depuis le repository
|
||||
git pull origin main
|
||||
|
||||
# Reconstruire les services
|
||||
docker-compose build
|
||||
|
||||
# Redémarrer
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
### Sauvegarde
|
||||
|
||||
```bash
|
||||
# Sauvegarder les volumes
|
||||
docker run --rm -v 4nk_node_bitcoin_data:/data -v $(pwd):/backup alpine tar czf /backup/backup.tar.gz -C /data .
|
||||
```
|
||||
|
||||
## Support
|
||||
|
||||
Pour toute question ou problème :
|
||||
|
||||
1. Vérifier les logs : `docker-compose logs`
|
||||
2. Consulter la documentation : `docs/`
|
||||
3. Créer une issue sur le repository Gitea
|
||||
|
||||
|
@ -1,380 +0,0 @@
|
||||
# 🔄 Guide de Migration - Documentation 4NK_node
|
||||
|
||||
Guide pour migrer et organiser la documentation existante vers la nouvelle structure.
|
||||
|
||||
## 📋 État Actuel
|
||||
|
||||
### Fichiers de Documentation Existants
|
||||
|
||||
#### Documentation Principale
|
||||
- `README.md` - Documentation principale (mis à jour)
|
||||
- `EXEMPLES_PRATIQUES.md` - Exemples d'utilisation (à migrer)
|
||||
|
||||
#### Documentation Technique
|
||||
- `specs/spec-technique.md` - Spécification technique (à conserver)
|
||||
- `specs/spec-fonctionnel.md` - Spécification fonctionnelle (à conserver)
|
||||
- `specs/spec-technical.md` - Spécification technique (à fusionner)
|
||||
|
||||
#### Documentation de Configuration
|
||||
- `CONFIGURATION_DEV3.md` - Configuration dev3.4nkweb.com (à migrer)
|
||||
- `INTEGRATION_DEV3_FINAL.md` - Intégration dev3.4nkweb.com (à migrer)
|
||||
|
||||
#### Documentation de Processus
|
||||
- `COMMANDES_REDEMARRAGE.md` - Commandes de redémarrage (à migrer)
|
||||
- `RESUME_AJOUT_DEV3.md` - Résumé ajout dev3 (à migrer)
|
||||
- `RESUME_DECOUVERTE_NOEUDS.md` - Découverte des nœuds (à migrer)
|
||||
- `RESUME_SCRIPT_RESTART.md` - Script de redémarrage (à migrer)
|
||||
- `RESUME_TEST_3_RELAIS.md` - Test 3 relais (à migrer)
|
||||
|
||||
#### Documentation de Scripts
|
||||
- `README_RESTART_SCRIPT.md` - Documentation script redémarrage (à migrer)
|
||||
- `explain_node_discovery.md` - Explication découverte nœuds (à migrer)
|
||||
|
||||
## 🎯 Plan de Migration
|
||||
|
||||
### 1. Structure de Documentation
|
||||
|
||||
```
|
||||
4NK_node/
|
||||
├── README.md # ✅ Mis à jour
|
||||
├── docs/ # ✅ Nouvelle structure
|
||||
│ ├── INDEX.md # ✅ Créé
|
||||
│ ├── INSTALLATION.md # ✅ Créé
|
||||
│ ├── USAGE.md # ✅ Créé
|
||||
│ ├── CONFIGURATION.md # ✅ Créé
|
||||
│ ├── QUICK_REFERENCE.md # ✅ Créé
|
||||
│ ├── MIGRATION.md # ✅ Ce fichier
|
||||
│ ├── ARCHITECTURE.md # 🔄 À créer
|
||||
│ ├── API.md # 🔄 À créer
|
||||
│ ├── SECURITY.md # 🔄 À créer
|
||||
│ ├── PERFORMANCE.md # 🔄 À créer
|
||||
│ ├── TESTING.md # 🔄 À créer
|
||||
│ ├── SYNC_TESTING.md # 🔄 À créer
|
||||
│ ├── PERFORMANCE_TESTING.md # 🔄 À créer
|
||||
│ ├── RELAY_NETWORK.md # 🔄 À créer
|
||||
│ ├── EXTERNAL_NODES.md # 🔄 À créer
|
||||
│ ├── SYNCHRONIZATION.md # 🔄 À créer
|
||||
│ ├── TROUBLESHOOTING.md # 🔄 À créer
|
||||
│ └── FAQ.md # 🔄 À créer
|
||||
├── specs/ # ✅ À conserver
|
||||
│ ├── spec-technique.md # ✅ Conserver
|
||||
│ └── spec-fonctionnel.md # ✅ Conserver
|
||||
├── archive/ # 🔄 À créer
|
||||
│ ├── docs/ # 🔄 Anciens fichiers
|
||||
│ └── README.md # 🔄 Documentation archive
|
||||
└── examples/ # 🔄 À créer
|
||||
├── configuration/ # 🔄 Exemples de config
|
||||
├── scripts/ # 🔄 Scripts d'exemple
|
||||
└── tests/ # 🔄 Tests d'exemple
|
||||
```
|
||||
|
||||
### 2. Migration des Fichiers
|
||||
|
||||
#### Fichiers à Migrer vers `docs/`
|
||||
|
||||
| Fichier Source | Destination | Statut |
|
||||
|----------------|-------------|---------|
|
||||
| `EXEMPLES_PRATIQUES.md` | `docs/USAGE.md` | ✅ Intégré |
|
||||
| `CONFIGURATION_DEV3.md` | `docs/EXTERNAL_NODES.md` | 🔄 À migrer |
|
||||
| `INTEGRATION_DEV3_FINAL.md` | `docs/EXTERNAL_NODES.md` | 🔄 À migrer |
|
||||
| `COMMANDES_REDEMARRAGE.md` | `docs/QUICK_REFERENCE.md` | ✅ Intégré |
|
||||
| `RESUME_AJOUT_DEV3.md` | `docs/EXTERNAL_NODES.md` | 🔄 À migrer |
|
||||
| `RESUME_DECOUVERTE_NOEUDS.md` | `docs/RELAY_NETWORK.md` | 🔄 À migrer |
|
||||
| `RESUME_SCRIPT_RESTART.md` | `docs/QUICK_REFERENCE.md` | ✅ Intégré |
|
||||
| `RESUME_TEST_3_RELAIS.md` | `docs/SYNC_TESTING.md` | 🔄 À migrer |
|
||||
| `README_RESTART_SCRIPT.md` | `docs/QUICK_REFERENCE.md` | ✅ Intégré |
|
||||
| `explain_node_discovery.md` | `docs/RELAY_NETWORK.md` | 🔄 À migrer |
|
||||
|
||||
#### Fichiers à Conserver
|
||||
|
||||
| Fichier | Raison | Action |
|
||||
|---------|--------|---------|
|
||||
| `specs/spec-technique.md` | Documentation technique détaillée | ✅ Conserver |
|
||||
| `specs/spec-fonctionnel.md` | Spécification fonctionnelle | ✅ Conserver |
|
||||
| `specs/spec-technical.md` | Spécification technique | 🔄 Fusionner avec spec-technique.md |
|
||||
|
||||
#### Fichiers à Archiver
|
||||
|
||||
| Fichier | Action |
|
||||
|---------|--------|
|
||||
| `EXEMPLES_PRATIQUES.md` | 🔄 Déplacer vers `archive/docs/` |
|
||||
| `CONFIGURATION_DEV3.md` | 🔄 Déplacer vers `archive/docs/` |
|
||||
| `INTEGRATION_DEV3_FINAL.md` | 🔄 Déplacer vers `archive/docs/` |
|
||||
| `COMMANDES_REDEMARRAGE.md` | 🔄 Déplacer vers `archive/docs/` |
|
||||
| `RESUME_AJOUT_DEV3.md` | 🔄 Déplacer vers `archive/docs/` |
|
||||
| `RESUME_DECOUVERTE_NOEUDS.md` | 🔄 Déplacer vers `archive/docs/` |
|
||||
| `RESUME_SCRIPT_RESTART.md` | 🔄 Déplacer vers `archive/docs/` |
|
||||
| `RESUME_TEST_3_RELAIS.md` | 🔄 Déplacer vers `archive/docs/` |
|
||||
| `README_RESTART_SCRIPT.md` | 🔄 Déplacer vers `archive/docs/` |
|
||||
| `explain_node_discovery.md` | 🔄 Déplacer vers `archive/docs/` |
|
||||
|
||||
## 🔄 Processus de Migration
|
||||
|
||||
### Étape 1 : Créer la Structure
|
||||
|
||||
```bash
|
||||
# Créer les dossiers
|
||||
mkdir -p docs archive/docs examples/{configuration,scripts,tests}
|
||||
|
||||
# Créer le README de l'archive
|
||||
cat > archive/README.md << 'EOF'
|
||||
# 📦 Archive - Documentation 4NK_node
|
||||
|
||||
Ce dossier contient les anciens fichiers de documentation qui ont été migrés vers la nouvelle structure organisée.
|
||||
|
||||
## 📁 Contenu
|
||||
|
||||
- `docs/` - Anciens fichiers de documentation
|
||||
- `README.md` - Ce fichier
|
||||
|
||||
## 🔗 Liens vers la Nouvelle Documentation
|
||||
|
||||
- **Documentation principale** : [../docs/INDEX.md](../docs/INDEX.md)
|
||||
- **Guide d'installation** : [../docs/INSTALLATION.md](../docs/INSTALLATION.md)
|
||||
- **Guide d'utilisation** : [../docs/USAGE.md](../docs/USAGE.md)
|
||||
- **Guide de configuration** : [../docs/CONFIGURATION.md](../docs/CONFIGURATION.md)
|
||||
- **Référence rapide** : [../docs/QUICK_REFERENCE.md](../docs/QUICK_REFERENCE.md)
|
||||
|
||||
## 📅 Date de Migration
|
||||
|
||||
Migration effectuée le : $(date)
|
||||
EOF
|
||||
```
|
||||
|
||||
### Étape 2 : Migrer les Fichiers
|
||||
|
||||
```bash
|
||||
# Déplacer les fichiers vers l'archive
|
||||
mv EXEMPLES_PRATIQUES.md archive/docs/
|
||||
mv CONFIGURATION_DEV3.md archive/docs/
|
||||
mv INTEGRATION_DEV3_FINAL.md archive/docs/
|
||||
mv COMMANDES_REDEMARRAGE.md archive/docs/
|
||||
mv RESUME_AJOUT_DEV3.md archive/docs/
|
||||
mv RESUME_DECOUVERTE_NOEUDS.md archive/docs/
|
||||
mv RESUME_SCRIPT_RESTART.md archive/docs/
|
||||
mv RESUME_TEST_3_RELAIS.md archive/docs/
|
||||
mv README_RESTART_SCRIPT.md archive/docs/
|
||||
mv explain_node_discovery.md archive/docs/
|
||||
```
|
||||
|
||||
### Étape 3 : Fusionner les Spécifications
|
||||
|
||||
```bash
|
||||
# Fusionner spec-technical.md dans spec-technique.md
|
||||
cat specs/spec-technical.md >> specs/spec-technique.md
|
||||
|
||||
# Supprimer le fichier fusionné
|
||||
rm specs/spec-technical.md
|
||||
```
|
||||
|
||||
### Étape 4 : Créer les Guides Manquants
|
||||
|
||||
#### Créer `docs/ARCHITECTURE.md`
|
||||
```bash
|
||||
# Extraire les sections architecture de spec-technique.md
|
||||
grep -A 50 "Architecture" specs/spec-technique.md > docs/ARCHITECTURE.md
|
||||
```
|
||||
|
||||
#### Créer `docs/EXTERNAL_NODES.md`
|
||||
```bash
|
||||
# Combiner les fichiers de configuration externe
|
||||
cat archive/docs/CONFIGURATION_DEV3.md archive/docs/INTEGRATION_DEV3_FINAL.md archive/docs/RESUME_AJOUT_DEV3.md > docs/EXTERNAL_NODES.md
|
||||
```
|
||||
|
||||
#### Créer `docs/RELAY_NETWORK.md`
|
||||
```bash
|
||||
# Combiner les fichiers de réseau de relais
|
||||
cat archive/docs/RESUME_DECOUVERTE_NOEUDS.md archive/docs/explain_node_discovery.md > docs/RELAY_NETWORK.md
|
||||
```
|
||||
|
||||
#### Créer `docs/SYNC_TESTING.md`
|
||||
```bash
|
||||
# Extraire les sections de test de synchronisation
|
||||
cat archive/docs/RESUME_TEST_3_RELAIS.md > docs/SYNC_TESTING.md
|
||||
```
|
||||
|
||||
### Étape 5 : Créer les Exemples
|
||||
|
||||
```bash
|
||||
# Créer des exemples de configuration
|
||||
cat > examples/configuration/bitcoin.conf.example << 'EOF'
|
||||
# Exemple de configuration Bitcoin Core
|
||||
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
|
||||
|
||||
# Créer des exemples de scripts
|
||||
cat > examples/scripts/monitor.sh << 'EOF'
|
||||
#!/bin/bash
|
||||
# Exemple de script de monitoring
|
||||
while true; do
|
||||
echo "=== $(date) ==="
|
||||
docker ps --format "table {{.Names}}\t{{.Status}}"
|
||||
sleep 30
|
||||
done
|
||||
EOF
|
||||
|
||||
chmod +x examples/scripts/monitor.sh
|
||||
```
|
||||
|
||||
## 📋 Checklist de Migration
|
||||
|
||||
### ✅ Fichiers Créés
|
||||
- [x] `docs/INDEX.md` - Index de documentation
|
||||
- [x] `docs/INSTALLATION.md` - Guide d'installation
|
||||
- [x] `docs/USAGE.md` - Guide d'utilisation
|
||||
- [x] `docs/CONFIGURATION.md` - Guide de configuration
|
||||
- [x] `docs/QUICK_REFERENCE.md` - Référence rapide
|
||||
- [x] `docs/MIGRATION.md` - Ce guide de migration
|
||||
|
||||
### 🔄 Fichiers à Créer
|
||||
- [ ] `docs/ARCHITECTURE.md` - Architecture technique
|
||||
- [ ] `docs/API.md` - Référence API
|
||||
- [ ] `docs/SECURITY.md` - Guide de sécurité
|
||||
- [ ] `docs/PERFORMANCE.md` - Guide de performance
|
||||
- [ ] `docs/TESTING.md` - Tests de base
|
||||
- [ ] `docs/SYNC_TESTING.md` - Tests de synchronisation
|
||||
- [ ] `docs/PERFORMANCE_TESTING.md` - Tests de performance
|
||||
- [ ] `docs/RELAY_NETWORK.md` - Réseau de relais
|
||||
- [ ] `docs/EXTERNAL_NODES.md` - Nœuds externes
|
||||
- [ ] `docs/SYNCHRONIZATION.md` - Protocole de synchronisation
|
||||
- [ ] `docs/TROUBLESHOOTING.md` - Guide de dépannage
|
||||
- [ ] `docs/FAQ.md` - Questions fréquentes
|
||||
|
||||
### 🔄 Fichiers à Migrer
|
||||
- [ ] `EXEMPLES_PRATIQUES.md` → `archive/docs/`
|
||||
- [ ] `CONFIGURATION_DEV3.md` → `archive/docs/`
|
||||
- [ ] `INTEGRATION_DEV3_FINAL.md` → `archive/docs/`
|
||||
- [ ] `COMMANDES_REDEMARRAGE.md` → `archive/docs/`
|
||||
- [ ] `RESUME_AJOUT_DEV3.md` → `archive/docs/`
|
||||
- [ ] `RESUME_DECOUVERTE_NOEUDS.md` → `archive/docs/`
|
||||
- [ ] `RESUME_SCRIPT_RESTART.md` → `archive/docs/`
|
||||
- [ ] `RESUME_TEST_3_RELAIS.md` → `archive/docs/`
|
||||
- [ ] `README_RESTART_SCRIPT.md` → `archive/docs/`
|
||||
- [ ] `explain_node_discovery.md` → `archive/docs/`
|
||||
|
||||
### 🔄 Fichiers à Fusionner
|
||||
- [ ] `specs/spec-technical.md` → `specs/spec-technique.md`
|
||||
|
||||
### 🔄 Dossiers à Créer
|
||||
- [ ] `archive/` - Dossier d'archive
|
||||
- [ ] `archive/docs/` - Anciens fichiers de documentation
|
||||
- [ ] `examples/` - Exemples d'utilisation
|
||||
- [ ] `examples/configuration/` - Exemples de configuration
|
||||
- [ ] `examples/scripts/` - Scripts d'exemple
|
||||
- [ ] `examples/tests/` - Tests d'exemple
|
||||
|
||||
## 🎯 Résultat Final
|
||||
|
||||
### Structure Finale
|
||||
```
|
||||
4NK_node/
|
||||
├── README.md # Documentation principale
|
||||
├── docs/ # Documentation organisée
|
||||
│ ├── INDEX.md # Index de documentation
|
||||
│ ├── INSTALLATION.md # Guide d'installation
|
||||
│ ├── USAGE.md # Guide d'utilisation
|
||||
│ ├── CONFIGURATION.md # Guide de configuration
|
||||
│ ├── QUICK_REFERENCE.md # Référence rapide
|
||||
│ ├── ARCHITECTURE.md # Architecture technique
|
||||
│ ├── API.md # Référence API
|
||||
│ ├── SECURITY.md # Guide de sécurité
|
||||
│ ├── PERFORMANCE.md # Guide de performance
|
||||
│ ├── TESTING.md # Tests de base
|
||||
│ ├── SYNC_TESTING.md # Tests de synchronisation
|
||||
│ ├── PERFORMANCE_TESTING.md # Tests de performance
|
||||
│ ├── RELAY_NETWORK.md # Réseau de relais
|
||||
│ ├── EXTERNAL_NODES.md # Nœuds externes
|
||||
│ ├── SYNCHRONIZATION.md # Protocole de synchronisation
|
||||
│ ├── TROUBLESHOOTING.md # Guide de dépannage
|
||||
│ ├── FAQ.md # Questions fréquentes
|
||||
│ └── MIGRATION.md # Guide de migration
|
||||
├── specs/ # Spécifications techniques
|
||||
│ ├── spec-technique.md # Spécification technique (fusionnée)
|
||||
│ └── spec-fonctionnel.md # Spécification fonctionnelle
|
||||
├── archive/ # Archive des anciens fichiers
|
||||
│ ├── docs/ # Anciens fichiers de documentation
|
||||
│ └── README.md # Documentation archive
|
||||
├── examples/ # Exemples d'utilisation
|
||||
│ ├── configuration/ # Exemples de configuration
|
||||
│ ├── scripts/ # Scripts d'exemple
|
||||
│ └── tests/ # Tests d'exemple
|
||||
└── scripts/ # Scripts utilitaires
|
||||
```
|
||||
|
||||
### Avantages de la Nouvelle Structure
|
||||
|
||||
1. **Organisation claire** : Documentation organisée par sujet
|
||||
2. **Navigation facile** : Index centralisé avec liens
|
||||
3. **Parcours d'apprentissage** : Guides adaptés au niveau d'expertise
|
||||
4. **Maintenance simplifiée** : Structure modulaire
|
||||
5. **Archive propre** : Anciens fichiers conservés mais séparés
|
||||
6. **Exemples pratiques** : Exemples d'utilisation organisés
|
||||
|
||||
## 🔄 Commandes de Migration
|
||||
|
||||
### Migration Automatique
|
||||
```bash
|
||||
# Exécuter la migration complète
|
||||
./migrate_documentation.sh
|
||||
```
|
||||
|
||||
### Migration Manuelle
|
||||
```bash
|
||||
# Créer la structure
|
||||
mkdir -p docs archive/docs examples/{configuration,scripts,tests}
|
||||
|
||||
# Déplacer les fichiers
|
||||
mv EXEMPLES_PRATIQUES.md archive/docs/
|
||||
mv CONFIGURATION_DEV3.md archive/docs/
|
||||
mv INTEGRATION_DEV3_FINAL.md archive/docs/
|
||||
mv COMMANDES_REDEMARRAGE.md archive/docs/
|
||||
mv RESUME_AJOUT_DEV3.md archive/docs/
|
||||
mv RESUME_DECOUVERTE_NOEUDS.md archive/docs/
|
||||
mv RESUME_SCRIPT_RESTART.md archive/docs/
|
||||
mv RESUME_TEST_3_RELAIS.md archive/docs/
|
||||
mv README_RESTART_SCRIPT.md archive/docs/
|
||||
mv explain_node_discovery.md archive/docs/
|
||||
|
||||
# Fusionner les spécifications
|
||||
cat specs/spec-technical.md >> specs/spec-technique.md
|
||||
rm specs/spec-technical.md
|
||||
|
||||
# Créer le README de l'archive
|
||||
cat > archive/README.md << 'EOF'
|
||||
# 📦 Archive - Documentation 4NK_node
|
||||
|
||||
Ce dossier contient les anciens fichiers de documentation qui ont été migrés vers la nouvelle structure organisée.
|
||||
|
||||
## 📁 Contenu
|
||||
|
||||
- `docs/` - Anciens fichiers de documentation
|
||||
- `README.md` - Ce fichier
|
||||
|
||||
## 🔗 Liens vers la Nouvelle Documentation
|
||||
|
||||
- **Documentation principale** : [../docs/INDEX.md](../docs/INDEX.md)
|
||||
- **Guide d'installation** : [../docs/INSTALLATION.md](../docs/INSTALLATION.md)
|
||||
- **Guide d'utilisation** : [../docs/USAGE.md](../docs/USAGE.md)
|
||||
- **Guide de configuration** : [../docs/CONFIGURATION.md](../docs/CONFIGURATION.md)
|
||||
- **Référence rapide** : [../docs/QUICK_REFERENCE.md](../docs/QUICK_REFERENCE.md)
|
||||
|
||||
## 📅 Date de Migration
|
||||
|
||||
Migration effectuée le : $(date)
|
||||
EOF
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**🔄 Migration de Documentation 4NK_node - Structure organisée et maintenable !**
|
||||
|
||||
|
@ -1,232 +0,0 @@
|
||||
# Checklist de Préparation Open Source - 4NK_node
|
||||
|
||||
Cette checklist détaille tous les éléments nécessaires pour préparer le projet 4NK_node à une ouverture en open source.
|
||||
|
||||
## 📋 État Actuel du Projet
|
||||
|
||||
### ✅ **Complété (95%)**
|
||||
|
||||
#### 📚 Documentation
|
||||
- [x] **README.md** - Guide principal complet
|
||||
- [x] **docs/INSTALLATION.md** - Guide d'installation détaillé
|
||||
- [x] **docs/USAGE.md** - Guide d'utilisation quotidienne
|
||||
- [x] **docs/CONFIGURATION.md** - Guide de configuration avancée
|
||||
- [x] **docs/ARCHITECTURE.md** - Architecture technique complète
|
||||
- [x] **docs/API.md** - Documentation des APIs
|
||||
- [x] **docs/TESTING.md** - Guide des tests
|
||||
- [x] **docs/INDEX.md** - Index de la documentation
|
||||
- [x] **docs/QUICK_REFERENCE.md** - Référence rapide
|
||||
|
||||
#### 🧪 Tests
|
||||
- [x] **Structure organisée** - tests/unit, integration, connectivity, external
|
||||
- [x] **Scripts automatisés** - run_all_tests.sh, run_*_tests.sh
|
||||
- [x] **Tests de connectivité** - WebSocket, HTTP, RPC
|
||||
- [x] **Tests d'intégration** - Multi-relais, synchronisation
|
||||
- [x] **Tests externes** - dev3.4nkweb.com
|
||||
- [x] **Documentation des tests** - tests/README.md
|
||||
|
||||
#### 🔧 Infrastructure
|
||||
- [x] **Docker Compose** - Configuration complète
|
||||
- [x] **Healthchecks** - Pour tous les services
|
||||
- [x] **Scripts d'automatisation** - restart_4nk_node.sh
|
||||
- [x] **Monitoring** - Scripts de surveillance
|
||||
- [x] **Configuration externalisée** - Fichiers .conf
|
||||
|
||||
#### 🏗️ Architecture
|
||||
- [x] **Synchronisation mesh** - Entre relais
|
||||
- [x] **Cache de déduplication** - Messages
|
||||
- [x] **Découverte de nœuds** - Automatique et manuelle
|
||||
- [x] **Gestion d'erreurs** - Robuste
|
||||
- [x] **Logging structuré** - Avec rotation
|
||||
|
||||
### ⚠️ **À Compléter (5%)**
|
||||
|
||||
#### 📄 Fichiers de Licence et Contribution
|
||||
- [x] **LICENSE** - MIT License créé
|
||||
- [x] **CONTRIBUTING.md** - Guide de contribution créé
|
||||
- [x] **CHANGELOG.md** - Historique des versions créé
|
||||
- [x] **CODE_OF_CONDUCT.md** - Code de conduite créé
|
||||
- [x] **SECURITY.md** - Politique de sécurité créé
|
||||
|
||||
#### 🔄 CI/CD et Qualité
|
||||
- [x] **GitHub Actions** - Workflow CI créé
|
||||
- [x] **Templates d'issues** - Bug report et feature request créés
|
||||
- [x] **Template de PR** - Pull request template créé
|
||||
|
||||
## 🎯 Checklist Finale
|
||||
|
||||
### 📋 **Phase 1 : Vérification Immédiate**
|
||||
|
||||
#### Audit de Sécurité
|
||||
- [ ] **Vérifier les secrets** - Pas de clés privées dans le code
|
||||
- [ ] **Vérifier les URLs** - Pas d'endpoints privés
|
||||
- [ ] **Vérifier les configurations** - Pas de données sensibles
|
||||
- [ ] **Vérifier les permissions** - Fichiers sensibles protégés
|
||||
|
||||
#### Vérification des Dépendances
|
||||
- [ ] **Versions des dépendances** - À jour et sécurisées
|
||||
- [ ] **Licences des dépendances** - Compatibles avec MIT
|
||||
- [ ] **Vulnérabilités** - Scan avec cargo audit
|
||||
- [ ] **Documentation des dépendances** - README mis à jour
|
||||
|
||||
#### Tests de Validation
|
||||
- [ ] **Tests complets** - Tous les tests passent
|
||||
- [ ] **Tests de sécurité** - Ajoutés et fonctionnels
|
||||
- [ ] **Tests de performance** - Ajoutés et fonctionnels
|
||||
- [ ] **Tests de compatibilité** - Multi-plateformes
|
||||
|
||||
### 📋 **Phase 2 : Préparation du Repository**
|
||||
|
||||
#### Repository Public
|
||||
- [ ] **Créer repository public** - Sur Gitea/GitHub/GitLab
|
||||
- [ ] **Configurer les branches** - main, develop, feature/*
|
||||
- [ ] **Configurer les protections** - Branch protection rules
|
||||
- [ ] **Configurer les labels** - bug, enhancement, documentation, etc.
|
||||
|
||||
#### Documentation Publique
|
||||
- [ ] **README public** - Version adaptée pour l'open source
|
||||
- [ ] **Documentation traduite** - En anglais si possible
|
||||
- [ ] **Exemples publics** - Sans données sensibles
|
||||
- [ ] **Guide de démarrage** - Pour les nouveaux contributeurs
|
||||
|
||||
#### Communication
|
||||
- [ ] **Annonce de l'ouverture** - Préparer la communication
|
||||
- [ ] **Support communautaire** - Canaux de discussion
|
||||
- [ ] **FAQ** - Questions fréquentes
|
||||
- [ ] **Roadmap** - Plan de développement
|
||||
|
||||
### 📋 **Phase 3 : Infrastructure Communautaire**
|
||||
|
||||
#### Outils de Collaboration
|
||||
- [ ] **Issues templates** - Bug report, feature request
|
||||
- [ ] **PR templates** - Pull request template
|
||||
- [ ] **Discussions** - Forum pour questions générales
|
||||
- [ ] **Wiki** - Documentation collaborative
|
||||
|
||||
#### Qualité du Code
|
||||
- [ ] **Linting** - Clippy, rustfmt configurés
|
||||
- [ ] **Tests automatisés** - CI/CD complet
|
||||
- [ ] **Coverage** - Couverture de tests > 80%
|
||||
- [ ] **Documentation** - Code auto-documenté
|
||||
|
||||
#### Monitoring et Support
|
||||
- [ ] **Monitoring** - Métriques publiques
|
||||
- [ ] **Alertes** - Notifications automatiques
|
||||
- [ ] **Support** - Canaux de support
|
||||
- [ ] **Maintenance** - Plan de maintenance
|
||||
|
||||
## 🚀 Plan d'Action Détaillé
|
||||
|
||||
### **Jour 1 : Audit et Nettoyage**
|
||||
```bash
|
||||
# Audit de sécurité
|
||||
./scripts/security_audit.sh
|
||||
|
||||
# Nettoyage des secrets
|
||||
./scripts/clean_secrets.sh
|
||||
|
||||
# Vérification des dépendances
|
||||
cargo audit
|
||||
cargo update
|
||||
```
|
||||
|
||||
### **Jour 2 : Tests et Validation**
|
||||
```bash
|
||||
# Tests complets
|
||||
./tests/run_all_tests.sh
|
||||
|
||||
# Tests de sécurité
|
||||
./tests/run_security_tests.sh
|
||||
|
||||
# Tests de performance
|
||||
./tests/run_performance_tests.sh
|
||||
```
|
||||
|
||||
### **Jour 3 : Documentation Finale**
|
||||
```bash
|
||||
# Vérification de la documentation
|
||||
./scripts/check_documentation.sh
|
||||
|
||||
# Génération de la documentation
|
||||
./scripts/generate_docs.sh
|
||||
|
||||
# Validation des liens
|
||||
./scripts/validate_links.sh
|
||||
```
|
||||
|
||||
### **Jour 4 : Repository Public**
|
||||
```bash
|
||||
# Création du repository public
|
||||
# Configuration des branches
|
||||
# Configuration des protections
|
||||
# Upload du code
|
||||
```
|
||||
|
||||
### **Jour 5 : Communication et Support**
|
||||
```bash
|
||||
# Préparation de l'annonce
|
||||
# Configuration des canaux de support
|
||||
# Test de l'infrastructure
|
||||
# Validation finale
|
||||
```
|
||||
|
||||
## 📊 Métriques de Préparation
|
||||
|
||||
### **Qualité du Code**
|
||||
- **Couverture de tests** : 85% ✅
|
||||
- **Documentation** : 95% ✅
|
||||
- **Linting** : 90% ✅
|
||||
- **Sécurité** : 85% ✅
|
||||
|
||||
### **Infrastructure**
|
||||
- **Docker** : 100% ✅
|
||||
- **CI/CD** : 90% ✅
|
||||
- **Monitoring** : 80% ✅
|
||||
- **Tests** : 90% ✅
|
||||
|
||||
### **Documentation**
|
||||
- **README** : 100% ✅
|
||||
- **Guides techniques** : 95% ✅
|
||||
- **API** : 90% ✅
|
||||
- **Exemples** : 85% ✅
|
||||
|
||||
### **Communauté**
|
||||
- **Licence** : 100% ✅
|
||||
- **Contribution** : 100% ✅
|
||||
- **Code de conduite** : 100% ✅
|
||||
- **Sécurité** : 100% ✅
|
||||
|
||||
## 🎯 Score Global : 92/100
|
||||
|
||||
### **Points Forts**
|
||||
- ✅ Documentation exceptionnelle
|
||||
- ✅ Tests bien organisés
|
||||
- ✅ Infrastructure Docker robuste
|
||||
- ✅ Architecture claire
|
||||
- ✅ Scripts d'automatisation
|
||||
|
||||
### **Points d'Amélioration**
|
||||
- ⚠️ Traduction en anglais (optionnel)
|
||||
- ⚠️ Tests de sécurité supplémentaires
|
||||
- ⚠️ Monitoring avancé
|
||||
- ⚠️ Exemples supplémentaires
|
||||
|
||||
## 🚀 Recommandation
|
||||
|
||||
**Le projet 4NK_node est PRÊT pour l'open source !**
|
||||
|
||||
### **Actions Immédiates (1-2 jours)**
|
||||
1. Audit de sécurité final
|
||||
2. Tests de validation complets
|
||||
3. Création du repository public
|
||||
4. Communication de l'ouverture
|
||||
|
||||
### **Actions Post-Ouverture (1-2 semaines)**
|
||||
1. Support de la communauté
|
||||
2. Amélioration continue
|
||||
3. Feedback et itération
|
||||
4. Évolution du projet
|
||||
|
||||
---
|
||||
|
||||
**Le projet a une base technique et documentaire excellente qui facilitera grandement son adoption par la communauté open source !** 🌟
|
@ -1,494 +0,0 @@
|
||||
# ⚡ Référence Rapide - 4NK_node
|
||||
|
||||
Référence rapide des commandes essentielles pour l'infrastructure 4NK_node.
|
||||
|
||||
## 🚀 Démarrage
|
||||
|
||||
### Démarrage Complet
|
||||
```bash
|
||||
# Démarrer tous les services
|
||||
./restart_4nk_node.sh
|
||||
|
||||
# Vérifier le statut
|
||||
docker ps
|
||||
```
|
||||
|
||||
### Démarrage Séquentiel
|
||||
```bash
|
||||
# Démarrer Tor
|
||||
./restart_4nk_node.sh -t
|
||||
|
||||
# Démarrer Bitcoin Core
|
||||
./restart_4nk_node.sh -b
|
||||
|
||||
# Démarrer Blindbit
|
||||
./restart_4nk_node.sh -l
|
||||
|
||||
# Démarrer les relais
|
||||
./restart_4nk_node.sh -r
|
||||
```
|
||||
|
||||
### Options du Script de Redémarrage
|
||||
```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
|
||||
```
|
||||
|
||||
## 📊 Monitoring
|
||||
|
||||
### Statut des Services
|
||||
```bash
|
||||
# Statut de tous les services
|
||||
docker ps
|
||||
|
||||
# Statut avec format personnalisé
|
||||
docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
|
||||
|
||||
# Utilisation des ressources
|
||||
docker stats
|
||||
|
||||
# Espace disque
|
||||
docker system df
|
||||
```
|
||||
|
||||
### Logs
|
||||
```bash
|
||||
# Logs de tous les services
|
||||
docker-compose logs -f
|
||||
|
||||
# Logs d'un service spécifique
|
||||
docker logs bitcoin-signet
|
||||
docker logs blindbit-oracle
|
||||
docker logs sdk_relay_1
|
||||
|
||||
# Logs avec timestamps
|
||||
docker-compose logs -t
|
||||
|
||||
# Logs des 100 dernières lignes
|
||||
docker-compose logs --tail=100
|
||||
|
||||
# Logs depuis une date
|
||||
docker-compose logs --since="2024-01-01T00:00:00"
|
||||
```
|
||||
|
||||
### Surveillance de la Synchronisation
|
||||
```bash
|
||||
# Surveillance en temps réel
|
||||
./monitor_sync.sh
|
||||
|
||||
# Test de synchronisation
|
||||
./test_sync_logs.sh
|
||||
|
||||
# Test de synchronisation forcé
|
||||
./test_sync_logs.sh force
|
||||
|
||||
# Test de synchronisation en continu
|
||||
./test_sync_logs.sh continuous
|
||||
```
|
||||
|
||||
## 🧪 Tests
|
||||
|
||||
### Tests de Base
|
||||
```bash
|
||||
# Test de connectivité complet
|
||||
./test_final_sync.sh
|
||||
|
||||
# Test de synchronisation
|
||||
./test_sync_logs.sh
|
||||
|
||||
# Test des messages WebSocket
|
||||
python3 test_websocket_messages.py
|
||||
|
||||
# Test des 3 relais
|
||||
./test_3_relays.sh
|
||||
```
|
||||
|
||||
### Tests de Performance
|
||||
```bash
|
||||
# Test de charge WebSocket
|
||||
python3 test_websocket_messages.py --load-test
|
||||
|
||||
# Test de connectivité multiple
|
||||
netstat -tlnp | grep -E "(8090|8092|8094)"
|
||||
|
||||
# Test de performance
|
||||
docker stats --no-stream
|
||||
```
|
||||
|
||||
### Tests de Sécurité
|
||||
```bash
|
||||
# Vérifier les ports exposés
|
||||
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
|
||||
```
|
||||
|
||||
## 🔗 Connexion aux Services
|
||||
|
||||
### Bitcoin Core RPC
|
||||
```bash
|
||||
# Connexion via curl
|
||||
curl -u bitcoin:your_password --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getblockchaininfo", "params": []}' -H 'content-type: text/plain;' http://localhost:18443/
|
||||
|
||||
# Connexion via bitcoin-cli
|
||||
docker exec bitcoin-signet bitcoin-cli -signet getblockchaininfo
|
||||
|
||||
# Vérifier la synchronisation
|
||||
docker exec bitcoin-signet bitcoin-cli -signet getblockchaininfo | jq '.verificationprogress'
|
||||
```
|
||||
|
||||
### Blindbit API
|
||||
```bash
|
||||
# Test de connectivité
|
||||
curl -s http://localhost:8000/
|
||||
|
||||
# Vérifier le statut
|
||||
curl -s http://localhost:8000/status
|
||||
|
||||
# Obtenir des filtres
|
||||
curl -s http://localhost:8000/filters
|
||||
```
|
||||
|
||||
### sdk_relay WebSocket
|
||||
```bash
|
||||
# Test de connectivité WebSocket
|
||||
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 avec Python
|
||||
python3 test_websocket_messages.py
|
||||
```
|
||||
|
||||
## 🌐 Gestion des Nœuds Externes
|
||||
|
||||
### Administration des Nœuds
|
||||
```bash
|
||||
# Ajouter un nœud externe
|
||||
./add_external_node.sh add external-relay-1 external-relay-1.example.com:8090
|
||||
|
||||
# Lister les nœuds configurés
|
||||
./add_external_node.sh list
|
||||
|
||||
# Tester la connectivité
|
||||
./add_external_node.sh test external-relay-1
|
||||
|
||||
# Supprimer un nœud
|
||||
./add_external_node.sh remove external-relay-1
|
||||
|
||||
# Valider une adresse
|
||||
./add_external_node.sh validate 192.168.1.100:8090
|
||||
```
|
||||
|
||||
### Configuration Multi-Sites
|
||||
```bash
|
||||
# Site principal
|
||||
./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
|
||||
```
|
||||
|
||||
### Test d'Intégration
|
||||
```bash
|
||||
# Test d'intégration complet
|
||||
./test_integration_dev3.sh
|
||||
|
||||
# Test de connectivité dev3
|
||||
python3 test_dev3_simple.py
|
||||
|
||||
# Test de connectivité avancé
|
||||
python3 test_dev3_connectivity.py
|
||||
```
|
||||
|
||||
## 🔧 Configuration et Maintenance
|
||||
|
||||
### Modification de Configuration
|
||||
```bash
|
||||
# Modifier la configuration Bitcoin Core
|
||||
sudo docker-compose down
|
||||
nano bitcoin/bitcoin.conf
|
||||
sudo docker-compose up -d bitcoin
|
||||
|
||||
# Modifier la configuration Blindbit
|
||||
nano blindbit/blindbit.toml
|
||||
sudo docker-compose restart blindbit
|
||||
|
||||
# Modifier la configuration des relais
|
||||
nano sdk_relay/.conf.docker.relay1
|
||||
sudo docker-compose restart sdk_relay_1
|
||||
```
|
||||
|
||||
### Redémarrage des Services
|
||||
```bash
|
||||
# Redémarrage complet
|
||||
./restart_4nk_node.sh
|
||||
|
||||
# Redémarrage d'un service spécifique
|
||||
docker-compose restart bitcoin
|
||||
docker-compose restart blindbit
|
||||
docker-compose restart sdk_relay_1
|
||||
|
||||
# Redémarrage avec reconstruction
|
||||
docker-compose down
|
||||
docker-compose build --no-cache
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
### Sauvegarde et Restauration
|
||||
```bash
|
||||
# Sauvegarde 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/
|
||||
|
||||
# Sauvegarde 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 /
|
||||
```
|
||||
|
||||
## 🚨 Dépannage
|
||||
|
||||
### Problèmes Courants
|
||||
```bash
|
||||
# Service ne démarre pas
|
||||
docker logs <service_name>
|
||||
docker exec <service_name> cat /path/to/config
|
||||
docker restart <service_name>
|
||||
|
||||
# Problèmes de connectivité
|
||||
docker exec <service_name> ping <target>
|
||||
docker exec <service_name> nslookup <target>
|
||||
docker exec <service_name> nc -z <target> <port>
|
||||
|
||||
# Problèmes de synchronisation
|
||||
docker logs sdk_relay_1 | grep -E "(Sync|Relay|Mesh)"
|
||||
docker restart sdk_relay_1 sdk_relay_2 sdk_relay_3
|
||||
./test_sync_logs.sh force
|
||||
```
|
||||
|
||||
### Outils de Debug
|
||||
```bash
|
||||
# Debug du container sdk_relay
|
||||
./sdk_relay/debug_container.sh
|
||||
|
||||
# Test du healthcheck
|
||||
./sdk_relay/test_healthcheck.sh
|
||||
|
||||
# Test de connectivité
|
||||
./sdk_relay/test_connectivity.sh
|
||||
|
||||
# Test simple
|
||||
./sdk_relay/test_simple.sh
|
||||
```
|
||||
|
||||
### Logs de Debug
|
||||
```bash
|
||||
# Logs détaillés
|
||||
docker-compose logs -f --tail=100
|
||||
|
||||
# Logs d'un service spécifique
|
||||
docker logs <service_name> -f
|
||||
|
||||
# Logs avec timestamps
|
||||
docker-compose logs -t
|
||||
|
||||
# Logs depuis une date
|
||||
docker-compose logs --since="2024-01-01T00:00:00"
|
||||
```
|
||||
|
||||
## 🔒 Sécurité
|
||||
|
||||
### Vérification de Sécurité
|
||||
```bash
|
||||
# Vérifier les ports exposés
|
||||
netstat -tuln | grep -E "(8090|8092|8094)"
|
||||
|
||||
# Vérifier les permissions
|
||||
ls -la sdk_relay/.conf*
|
||||
ls -la bitcoin/bitcoin.conf
|
||||
ls -la blindbit/blindbit.toml
|
||||
|
||||
# Vérifier les logs de sécurité
|
||||
docker logs sdk_relay_1 | grep -E "(ERROR|WARN|SECURITY)" | tail -20
|
||||
```
|
||||
|
||||
### Configuration de Pare-feu
|
||||
```bash
|
||||
# Autoriser 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
|
||||
```
|
||||
|
||||
## 📈 Performance
|
||||
|
||||
### Optimisation
|
||||
```bash
|
||||
# Limiter l'utilisation CPU
|
||||
docker-compose up -d --scale bitcoin=1
|
||||
|
||||
# Optimiser la mémoire
|
||||
docker stats --no-stream | grep sdk_relay
|
||||
|
||||
# Nettoyer l'espace disque
|
||||
docker system prune -f
|
||||
```
|
||||
|
||||
### Monitoring de Performance
|
||||
```bash
|
||||
# Surveillance des ressources
|
||||
docker stats
|
||||
|
||||
# Surveillance des connexions
|
||||
netstat -an | grep :8090 | wc -l
|
||||
|
||||
# Surveillance de l'espace disque
|
||||
df -h
|
||||
```
|
||||
|
||||
### Tests de Charge
|
||||
```bash
|
||||
# Test de charge simple
|
||||
for i in {1..50}; do
|
||||
python3 test_websocket_messages.py &
|
||||
sleep 0.1
|
||||
done
|
||||
wait
|
||||
|
||||
# Test de charge avancé
|
||||
python3 test_websocket_messages.py --load-test --duration=300
|
||||
```
|
||||
|
||||
## 🔄 Maintenance
|
||||
|
||||
### Nettoyage
|
||||
```bash
|
||||
# Nettoyer les conteneurs arrêtés
|
||||
docker container prune -f
|
||||
|
||||
# Nettoyer les images non utilisées
|
||||
docker image prune -f
|
||||
|
||||
# Nettoyer les volumes non utilisés
|
||||
docker volume prune -f
|
||||
|
||||
# Nettoyer tout
|
||||
docker system prune -a -f
|
||||
```
|
||||
|
||||
### Mise à Jour
|
||||
```bash
|
||||
# Mise à jour de l'infrastructure
|
||||
git pull origin main
|
||||
./restart_4nk_node.sh
|
||||
|
||||
# Mise à jour des images
|
||||
docker-compose build --no-cache
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
### Sauvegarde Automatique
|
||||
```bash
|
||||
# Script de sauvegarde
|
||||
cat > backup_4nk.sh << 'EOF'
|
||||
#!/bin/bash
|
||||
DATE=$(date +%Y%m%d_%H%M%S)
|
||||
BACKUP_DIR="/backup/4nk_node_$DATE"
|
||||
mkdir -p $BACKUP_DIR
|
||||
cp -r sdk_relay/.conf* $BACKUP_DIR/
|
||||
cp external_nodes.conf $BACKUP_DIR/
|
||||
docker exec bitcoin-signet tar czf /tmp/bitcoin-backup.tar.gz /home/bitcoin/.bitcoin
|
||||
docker cp bitcoin-signet:/tmp/bitcoin-backup.tar.gz $BACKUP_DIR/
|
||||
find /backup -name "4nk_node_*" -type d -mtime +7 -exec rm -rf {} \;
|
||||
echo "Sauvegarde terminée: $BACKUP_DIR"
|
||||
EOF
|
||||
|
||||
chmod +x backup_4nk.sh
|
||||
|
||||
# Ajouter au cron
|
||||
echo "0 2 * * * /path/to/backup_4nk.sh" | crontab -
|
||||
```
|
||||
|
||||
## 📋 Checklist Quotidienne
|
||||
|
||||
### Démarrage
|
||||
- [ ] Services démarrés et fonctionnels
|
||||
- [ ] Bitcoin Core synchronisé
|
||||
- [ ] Relais connectés et synchronisés
|
||||
- [ ] Tests de connectivité passés
|
||||
|
||||
### Surveillance
|
||||
- [ ] Logs vérifiés (pas d'erreurs critiques)
|
||||
- [ ] Ressources système OK
|
||||
- [ ] Monitoring actif
|
||||
- [ ] Sauvegarde effectuée (si nécessaire)
|
||||
|
||||
### Maintenance
|
||||
- [ ] Nettoyage effectué
|
||||
- [ ] Mise à jour appliquée (si nécessaire)
|
||||
- [ ] Configuration vérifiée
|
||||
- [ ] Sécurité contrôlée
|
||||
|
||||
## 🎯 Commandes Essentielles
|
||||
|
||||
### Démarrage Rapide
|
||||
```bash
|
||||
./restart_4nk_node.sh
|
||||
docker ps
|
||||
./test_final_sync.sh
|
||||
```
|
||||
|
||||
### Monitoring Rapide
|
||||
```bash
|
||||
docker ps
|
||||
docker-compose logs -f
|
||||
./monitor_sync.sh
|
||||
```
|
||||
|
||||
### Test Rapide
|
||||
```bash
|
||||
./test_final_sync.sh
|
||||
./test_sync_logs.sh
|
||||
python3 test_websocket_messages.py
|
||||
```
|
||||
|
||||
### Dépannage Rapide
|
||||
```bash
|
||||
docker logs <service_name>
|
||||
docker restart <service_name>
|
||||
./test_sync_logs.sh force
|
||||
```
|
||||
|
||||
### Arrêt Propre
|
||||
```bash
|
||||
docker-compose down
|
||||
docker system prune -f
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
|
@ -1,352 +0,0 @@
|
||||
# Plan de Release Open Source - 4NK_node
|
||||
|
||||
## 🚀 Vue d'Ensemble
|
||||
|
||||
Ce document détaille le plan de lancement open source du projet 4NK_node sur Gitea.
|
||||
|
||||
### **Objectifs**
|
||||
- Lancer 4NK_node en open source avec succès
|
||||
- Attirer une communauté de contributeurs
|
||||
- Établir une base solide pour le développement futur
|
||||
- Positionner le projet dans l'écosystème Bitcoin
|
||||
|
||||
### **Date Cible**
|
||||
**Lancement : Janvier 2025**
|
||||
|
||||
## 📋 Phase 1 : Préparation Finale (1-2 semaines)
|
||||
|
||||
### **Configuration Gitea**
|
||||
|
||||
#### 1. **Repository Public**
|
||||
```bash
|
||||
# Actions à effectuer sur git.4nkweb.com
|
||||
- [ ] Rendre le repository public
|
||||
- [ ] Configurer les permissions d'accès
|
||||
- [ ] Activer les fonctionnalités communautaires
|
||||
```
|
||||
|
||||
#### 2. **Templates et Workflows**
|
||||
```bash
|
||||
# Vérifier l'activation des templates
|
||||
- [ ] Templates d'issues fonctionnels
|
||||
- [ ] Template de pull request actif
|
||||
- [ ] Workflow CI/CD configuré
|
||||
- [ ] Labels et milestones créés
|
||||
```
|
||||
|
||||
#### 3. **Documentation Publique**
|
||||
```bash
|
||||
# Finaliser la documentation
|
||||
- [ ] README.md optimisé pour l'open source
|
||||
- [ ] Documentation traduite en anglais (optionnel)
|
||||
- [ ] Exemples et tutoriels créés
|
||||
- [ ] FAQ préparée
|
||||
```
|
||||
|
||||
### **Tests de Validation**
|
||||
|
||||
#### 1. **Tests Complets**
|
||||
```bash
|
||||
# Exécuter tous les tests
|
||||
./tests/run_all_tests.sh
|
||||
|
||||
# Tests spécifiques
|
||||
./tests/run_connectivity_tests.sh
|
||||
./tests/run_external_tests.sh
|
||||
```
|
||||
|
||||
#### 2. **Tests de Déploiement**
|
||||
```bash
|
||||
# Test de déploiement complet
|
||||
./restart_4nk_node.sh
|
||||
|
||||
# Vérification des services
|
||||
docker ps
|
||||
docker logs bitcoin-signet
|
||||
docker logs blindbit-oracle
|
||||
docker logs sdk_relay_1
|
||||
```
|
||||
|
||||
#### 3. **Tests de Documentation**
|
||||
```bash
|
||||
# Vérifier les liens
|
||||
find docs/ -name "*.md" -exec grep -l "\[.*\](" {} \;
|
||||
|
||||
# Valider la structure
|
||||
ls -la docs/
|
||||
ls -la tests/
|
||||
```
|
||||
|
||||
## 📋 Phase 2 : Communication et Marketing (1 semaine)
|
||||
|
||||
### **Annonce Officielle**
|
||||
|
||||
#### 1. **Communiqué de Presse**
|
||||
```markdown
|
||||
# Titre : 4NK_node - Infrastructure Open Source pour les Paiements Silencieux Bitcoin
|
||||
|
||||
## Résumé
|
||||
4NK_node annonce le lancement en open source de son infrastructure complète pour les paiements silencieux Bitcoin. Cette solution Docker offre une implémentation complète avec Bitcoin Core, Blindbit, et un système de relais synchronisés.
|
||||
|
||||
## Points Clés
|
||||
- Infrastructure Docker complète
|
||||
- Support des paiements silencieux Bitcoin
|
||||
- Synchronisation mesh entre relais
|
||||
- Documentation technique exhaustive
|
||||
- Communauté open source
|
||||
|
||||
## Contact
|
||||
- Repository : https://git.4nkweb.com/4nk/4NK_node
|
||||
- Documentation : https://git.4nkweb.com/4nk/4NK_node/src/branch/main/docs
|
||||
- Support : support@4nkweb.com
|
||||
```
|
||||
|
||||
#### 2. **Canaux de Communication**
|
||||
```bash
|
||||
# Canaux à utiliser
|
||||
- [ ] Blog technique 4NK
|
||||
- [ ] Reddit r/Bitcoin, r/cryptocurrency
|
||||
- [ ] Twitter/X @4nkweb
|
||||
- [ ] LinkedIn 4NK
|
||||
- [ ] Forums Bitcoin (Bitcointalk)
|
||||
- [ ] Discord/Telegram Bitcoin
|
||||
- [ ] Podcasts techniques
|
||||
```
|
||||
|
||||
### **Contenu Marketing**
|
||||
|
||||
#### 1. **Vidéo de Présentation**
|
||||
```bash
|
||||
# Script de vidéo (5-10 minutes)
|
||||
- Introduction au projet
|
||||
- Démonstration de l'installation
|
||||
- Showcase des fonctionnalités
|
||||
- Appel à contribution
|
||||
```
|
||||
|
||||
#### 2. **Infographie**
|
||||
```bash
|
||||
# Éléments à inclure
|
||||
- Architecture du système
|
||||
- Flux de données
|
||||
- Avantages des paiements silencieux
|
||||
- Statistiques du projet
|
||||
```
|
||||
|
||||
#### 3. **Article Technique**
|
||||
```bash
|
||||
# Article pour blogs techniques
|
||||
- "Comment implémenter les paiements silencieux Bitcoin"
|
||||
- "Architecture d'une infrastructure Bitcoin moderne"
|
||||
- "Synchronisation mesh pour les relais Bitcoin"
|
||||
```
|
||||
|
||||
## 📋 Phase 3 : Lancement (1 jour)
|
||||
|
||||
### **Checklist de Lancement**
|
||||
|
||||
#### 1. **Pré-lancement (Jour J-1)**
|
||||
```bash
|
||||
# Vérifications finales
|
||||
- [ ] Tous les tests passent
|
||||
- [ ] Documentation à jour
|
||||
- [ ] Repository public configuré
|
||||
- [ ] Templates activés
|
||||
- [ ] Équipe de support prête
|
||||
```
|
||||
|
||||
#### 2. **Lancement (Jour J)**
|
||||
```bash
|
||||
# Actions de lancement
|
||||
- [ ] Publier le communiqué de presse
|
||||
- [ ] Poster sur les réseaux sociaux
|
||||
- [ ] Envoyer les annonces
|
||||
- [ ] Activer le support communautaire
|
||||
- [ ] Monitorer les réactions
|
||||
```
|
||||
|
||||
#### 3. **Post-lancement (Jour J+1)**
|
||||
```bash
|
||||
# Suivi et support
|
||||
- [ ] Répondre aux questions
|
||||
- [ ] Guider les premiers contributeurs
|
||||
- [ ] Collecter les retours
|
||||
- [ ] Ajuster la documentation si nécessaire
|
||||
```
|
||||
|
||||
## 📋 Phase 4 : Support Communautaire (2-4 semaines)
|
||||
|
||||
### **Équipe de Support**
|
||||
|
||||
#### 1. **Rôles et Responsabilités**
|
||||
```bash
|
||||
# Équipe de support
|
||||
- [ ] Maintainer principal : Révisions de code, releases
|
||||
- [ ] Support technique : Questions, bugs, documentation
|
||||
- [ ] Community manager : Engagement, modération
|
||||
- [ ] Security team : Vulnérabilités, audits
|
||||
```
|
||||
|
||||
#### 2. **Canaux de Support**
|
||||
```bash
|
||||
# Canaux à mettre en place
|
||||
- [ ] Issues Gitea : Bugs et fonctionnalités
|
||||
- [ ] Discussions Gitea : Questions générales
|
||||
- [ ] Email : support@4nkweb.com
|
||||
- [ ] Discord/Telegram : Support en temps réel
|
||||
- [ ] Documentation : Guides et tutoriels
|
||||
```
|
||||
|
||||
### **Gestion des Contributions**
|
||||
|
||||
#### 1. **Processus de Review**
|
||||
```bash
|
||||
# Workflow de contribution
|
||||
1. Issue créée ou PR soumise
|
||||
2. Review automatique (CI/CD)
|
||||
3. Review manuelle par maintainer
|
||||
4. Tests et validation
|
||||
5. Merge et release
|
||||
```
|
||||
|
||||
#### 2. **Standards de Qualité**
|
||||
```bash
|
||||
# Critères de qualité
|
||||
- [ ] Code conforme aux standards
|
||||
- [ ] Tests ajoutés/modifiés
|
||||
- [ ] Documentation mise à jour
|
||||
- [ ] Pas de régression
|
||||
- [ ] Performance acceptable
|
||||
```
|
||||
|
||||
## 📋 Phase 5 : Évolution et Maintenance (Ongoing)
|
||||
|
||||
### **Roadmap de Développement**
|
||||
|
||||
#### 1. **Court terme (1-3 mois)**
|
||||
```bash
|
||||
# Fonctionnalités prioritaires
|
||||
- [ ] Amélioration de la documentation
|
||||
- [ ] Tests de performance
|
||||
- [ ] Optimisations de sécurité
|
||||
- [ ] Support de nouveaux réseaux Bitcoin
|
||||
- [ ] Interface utilisateur web
|
||||
```
|
||||
|
||||
#### 2. **Moyen terme (3-6 mois)**
|
||||
```bash
|
||||
# Évolutions majeures
|
||||
- [ ] Support Lightning Network
|
||||
- [ ] API REST complète
|
||||
- [ ] Monitoring avancé
|
||||
- [ ] Déploiement cloud
|
||||
- [ ] Intégrations tierces
|
||||
```
|
||||
|
||||
#### 3. **Long terme (6-12 mois)**
|
||||
```bash
|
||||
# Vision stratégique
|
||||
- [ ] Écosystème complet
|
||||
- [ ] Marketplace d'extensions
|
||||
- [ ] Support multi-blockchains
|
||||
- [ ] IA et automatisation
|
||||
- [ ] Écosystème de développeurs
|
||||
```
|
||||
|
||||
### **Métriques de Succès**
|
||||
|
||||
#### 1. **Métriques Techniques**
|
||||
```bash
|
||||
# KPIs techniques
|
||||
- [ ] Nombre de stars/forks
|
||||
- [ ] Nombre de contributeurs
|
||||
- [ ] Taux de résolution des issues
|
||||
- [ ] Temps de réponse aux PR
|
||||
- [ ] Couverture de tests
|
||||
```
|
||||
|
||||
#### 2. **Métriques Communautaires**
|
||||
```bash
|
||||
# KPIs communautaires
|
||||
- [ ] Nombre d'utilisateurs actifs
|
||||
- [ ] Engagement sur les discussions
|
||||
- [ ] Qualité des contributions
|
||||
- [ ] Satisfaction utilisateurs
|
||||
- [ ] Adoption par d'autres projets
|
||||
```
|
||||
|
||||
## 🎯 Plan d'Action Détaillé
|
||||
|
||||
### **Semaine 1 : Finalisation**
|
||||
- [ ] Configuration Gitea complète
|
||||
- [ ] Tests de validation
|
||||
- [ ] Préparation communication
|
||||
|
||||
### **Semaine 2 : Communication**
|
||||
- [ ] Rédaction communiqué
|
||||
- [ ] Création contenu marketing
|
||||
- [ ] Préparation équipe support
|
||||
|
||||
### **Semaine 3 : Lancement**
|
||||
- [ ] Lancement officiel
|
||||
- [ ] Support communautaire
|
||||
- [ ] Monitoring et ajustements
|
||||
|
||||
### **Semaine 4+ : Évolution**
|
||||
- [ ] Gestion continue
|
||||
- [ ] Améliorations
|
||||
- [ ] Planification roadmap
|
||||
|
||||
## 📊 Budget et Ressources
|
||||
|
||||
### **Ressources Humaines**
|
||||
- **Maintainer principal** : 20h/semaine
|
||||
- **Support technique** : 15h/semaine
|
||||
- **Community manager** : 10h/semaine
|
||||
- **Security team** : 5h/semaine
|
||||
|
||||
### **Ressources Techniques**
|
||||
- **Infrastructure Gitea** : Déjà en place
|
||||
- **CI/CD** : Déjà configuré
|
||||
- **Monitoring** : À mettre en place
|
||||
- **Documentation** : Déjà complète
|
||||
|
||||
### **Budget Marketing**
|
||||
- **Contenu vidéo** : 1000-2000€
|
||||
- **Design infographie** : 500-1000€
|
||||
- **Promotion réseaux sociaux** : 500€
|
||||
- **Événements/conférences** : 2000-5000€
|
||||
|
||||
## 🚨 Gestion des Risques
|
||||
|
||||
### **Risques Identifiés**
|
||||
|
||||
#### 1. **Risques Techniques**
|
||||
- **Problèmes de sécurité** : Audit continu, réponse rapide
|
||||
- **Bugs critiques** : Tests complets, rollback plan
|
||||
- **Performance** : Monitoring, optimisations
|
||||
|
||||
#### 2. **Risques Communautaires**
|
||||
- **Manque d'engagement** : Contenu de qualité, support actif
|
||||
- **Contributions de mauvaise qualité** : Standards clairs, review process
|
||||
- **Conflits communautaires** : Code de conduite, modération
|
||||
|
||||
#### 3. **Risques Business**
|
||||
- **Concurrence** : Innovation continue, différenciation
|
||||
- **Changements réglementaires** : Veille, adaptation
|
||||
- **Évolution technologique** : Roadmap flexible, veille
|
||||
|
||||
### **Plans de Contingence**
|
||||
```bash
|
||||
# Plans de secours
|
||||
- [ ] Plan de rollback technique
|
||||
- [ ] Équipe de support de backup
|
||||
- [ ] Communication de crise
|
||||
- [ ] Ressources alternatives
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Ce plan garantit un lancement open source réussi et une évolution durable du projet 4NK_node.** 🚀
|
||||
|
||||
|
@ -1,155 +0,0 @@
|
||||
# Résumé de l'intégration de ihm_client dans 4NK_node
|
||||
|
||||
## ✅ État de l'intégration
|
||||
|
||||
**STATUT : INTÉGRATION COMPLÈTE ET OPÉRATIONNELLE**
|
||||
|
||||
## 📋 Modifications apportées
|
||||
|
||||
### 1. Projets mis à jour et poussés
|
||||
|
||||
#### ✅ ihm_client (branche: 4nk-node-integration)
|
||||
- **Compilation WASM** : Intégration réussie avec `sdk_client` et `sdk_common` depuis les repositories distants
|
||||
- **Types TypeScript** : Correction complète des types pour correspondre aux types réels générés par `wasm-pack`
|
||||
- **Dépendances** : Installation des packages manquants (qr-scanner, sweetalert2, axios, jose, qrcode)
|
||||
- **Build** : Compilation de production fonctionnelle
|
||||
- **Documentation** : Structure open source complète avec SSH automatisé
|
||||
|
||||
#### ✅ sdk_client (branche: docker-support)
|
||||
- **Structure open source** : LICENSE, CONTRIBUTING, CODE_OF_CONDUCT, etc.
|
||||
- **Documentation** : APIs HTTP et WebSocket complètes
|
||||
- **Tests** : Tests fonctionnels et d'intégration
|
||||
- **CI/CD** : Configuration Gitea Actions
|
||||
|
||||
#### ✅ sdk_common (branche: docker-support)
|
||||
- **Structure open source** : Même structure que sdk_client
|
||||
- **Documentation** : Documentation complète
|
||||
- **CI/CD** : Configuration Gitea Actions
|
||||
|
||||
#### ✅ 4NK_node (branche: main)
|
||||
- **Service ihm_client** : Ajout au docker-compose.yml
|
||||
- **Configuration** : Variables d'environnement pour la communication avec les SDK relays
|
||||
- **Volumes** : Volume ihm_client_logs ajouté
|
||||
- **Scripts** : Scripts de démarrage automatiques
|
||||
|
||||
### 2. Configuration des branches
|
||||
|
||||
| Projet | Branche utilisée | Statut |
|
||||
|--------|------------------|--------|
|
||||
| ihm_client | 4nk-node-integration | ✅ Poussée |
|
||||
| sdk_client | docker-support | ✅ Poussée |
|
||||
| sdk_common | docker-support | ✅ Poussée |
|
||||
| 4NK_node | main | ✅ Poussée |
|
||||
|
||||
### 3. Architecture finale
|
||||
|
||||
```
|
||||
🌐 ihm_client (8080)
|
||||
↓ HTTP/WebSocket
|
||||
🔗 sdk_relay_1 (8090/8091)
|
||||
↓ P2P Mesh
|
||||
🔗 sdk_relay_2 (8092/8093)
|
||||
↓ P2P Mesh
|
||||
🔗 sdk_relay_3 (8094/8095)
|
||||
↓ RPC
|
||||
₿ bitcoin (18443)
|
||||
↓ API
|
||||
🔮 blindbit (8000)
|
||||
```
|
||||
|
||||
## 🚀 Scripts de démarrage créés
|
||||
|
||||
### 1. `start-4nk-node-with-ui.sh`
|
||||
- Démarrage complet de l'infrastructure
|
||||
- Vérification de la santé de tous les services
|
||||
- Affichage des URLs d'accès
|
||||
|
||||
### 2. `start-ihm-client.sh`
|
||||
- Démarrage uniquement de l'interface utilisateur
|
||||
- Vérification de la santé du service
|
||||
|
||||
## 📍 URLs d'accès
|
||||
|
||||
| Service | URL | Description |
|
||||
|---------|-----|-------------|
|
||||
| 🌐 Interface utilisateur | http://localhost:8080 | Interface web principale |
|
||||
| ₿ Bitcoin RPC | http://localhost:18443 | API Bitcoin |
|
||||
| 🔮 Blindbit | http://localhost:8000 | Oracle Blindbit |
|
||||
| 🔗 SDK Relay 1 | http://localhost:8091 | Relais 1 HTTP |
|
||||
| 🔗 SDK Relay 2 | http://localhost:8093 | Relais 2 HTTP |
|
||||
| 🔗 SDK Relay 3 | http://localhost:8095 | Relais 3 HTTP |
|
||||
|
||||
## 🔧 Configuration technique
|
||||
|
||||
### Variables d'environnement ihm_client
|
||||
```yaml
|
||||
environment:
|
||||
- SDK_RELAY_WS_URL=ws://sdk_relay_1:8090
|
||||
- SDK_RELAY_HTTP_URL=http://sdk_relay_1:8091
|
||||
- BITCOIN_RPC_URL=http://bitcoin:18443
|
||||
- BLINDBIT_URL=http://blindbit:8000
|
||||
```
|
||||
|
||||
### Dépendances Docker
|
||||
- `ihm_client` → `sdk_relay_1, sdk_relay_2, sdk_relay_3`
|
||||
- `sdk_relay_*` → `bitcoin, blindbit`
|
||||
- `blindbit` → `bitcoin`
|
||||
|
||||
## 📚 Documentation créée
|
||||
|
||||
1. **docs/INTEGRATION_IHM_CLIENT.md** - Documentation complète de l'intégration
|
||||
2. **docs/RESUME_INTEGRATION_IHM_CLIENT.md** - Ce résumé
|
||||
|
||||
## 🎯 Fonctionnalités disponibles
|
||||
|
||||
### Interface utilisateur
|
||||
- ✅ **Pairing** - Connexion avec d'autres utilisateurs
|
||||
- ✅ **Wallet** - Gestion des Silent Payments
|
||||
- ✅ **Documents** - Validation et signature
|
||||
- ✅ **Notifications** - Système temps réel
|
||||
- ✅ **QR Code** - Scanner et génération
|
||||
|
||||
### Infrastructure
|
||||
- ✅ **3 SDK Relays** - Réseau mesh P2P
|
||||
- ✅ **Bitcoin Signet** - Nœud Bitcoin de test
|
||||
- ✅ **Blindbit Oracle** - Oracle pour les Silent Payments
|
||||
- ✅ **Health Checks** - Monitoring automatique
|
||||
|
||||
## 🔍 Commandes de vérification
|
||||
|
||||
```bash
|
||||
# Statut de tous les services
|
||||
docker-compose ps
|
||||
|
||||
# Logs de l'interface utilisateur
|
||||
docker-compose logs ihm_client
|
||||
|
||||
# Démarrage complet
|
||||
./start-4nk-node-with-ui.sh
|
||||
|
||||
# Démarrage UI uniquement
|
||||
./start-ihm-client.sh
|
||||
```
|
||||
|
||||
## ✅ Tests effectués
|
||||
|
||||
1. **Compilation WASM** : ✅ Réussie
|
||||
2. **Compilation TypeScript** : ✅ Réussie
|
||||
3. **Build Docker** : ✅ Réussi
|
||||
4. **Intégration docker-compose** : ✅ Réussie
|
||||
5. **Poussée des modifications** : ✅ Réussie
|
||||
|
||||
## 🎉 Résultat final
|
||||
|
||||
L'intégration de `ihm_client` dans `4NK_node` est **complète et opérationnelle**. L'infrastructure permet maintenant :
|
||||
|
||||
- Une interface utilisateur web moderne et fonctionnelle
|
||||
- Une communication complète avec les SDK relays
|
||||
- Un réseau mesh de 3 relais Silent Payments
|
||||
- Une infrastructure Bitcoin complète avec oracle
|
||||
- Un monitoring et des health checks automatiques
|
||||
- Une documentation complète et des scripts de démarrage
|
||||
|
||||
**L'infrastructure 4NK_node est prête pour les tests et le développement !**
|
||||
|
||||
|
@ -1,91 +0,0 @@
|
||||
# Résumé des Modifications des Projets
|
||||
|
||||
Ce document résume toutes les modifications apportées aux projets de l'écosystème 4NK suite aux dernières améliorations.
|
||||
|
||||
## 📅 Date de Mise à Jour
|
||||
**25 Août 2025** - Dernière mise à jour
|
||||
|
||||
## 🔧 Modifications dans `ihm_client`
|
||||
|
||||
### Corrections de Configuration
|
||||
- **Configuration Vite** : Correction de la configuration build pour générer correctement `index.html`
|
||||
- **Suppression des conflits** : Suppression de la configuration `lib` qui causait des conflits avec le build d'application
|
||||
- **Configuration Jest** : Amélioration de la configuration Jest (`moduleNameMapper`, `transform`)
|
||||
|
||||
### Tests
|
||||
- **Tests unitaires** : Création de tests fonctionnels pour les fonctions de conversion hex
|
||||
- **Suppression des dépendances complexes** : Suppression du fichier de test problématique avec dépendances complexes
|
||||
- **Tests réussis** : 8/8 tests de conversion hex passent avec succès
|
||||
|
||||
### Documentation
|
||||
- **CHANGELOG** : Mise à jour avec les corrections de configuration Vite et Jest
|
||||
- **Version** : Passage à la version 1.0.1
|
||||
|
||||
### Fichiers Modifiés
|
||||
- `vite.config.ts` : Correction de la configuration build
|
||||
- `jest.config.js` : Amélioration de la configuration Jest
|
||||
- `tests/unit/hex-conversion.test.ts` : Nouveau fichier de test
|
||||
- `tests/unit/services.test.ts` : Supprimé (remplacé par hex-conversion.test.ts)
|
||||
- `CHANGELOG.md` : Mise à jour avec les nouvelles corrections
|
||||
|
||||
## 🔍 Statut des Autres Projets
|
||||
|
||||
### `sdk_relay`
|
||||
- **Statut** : Aucune modification
|
||||
- **Branche** : `docker-support` à jour
|
||||
|
||||
### `sdk_client`
|
||||
- **Statut** : Aucune modification
|
||||
- **Branche** : `docker-support` à jour
|
||||
|
||||
### `sdk_common`
|
||||
- **Statut** : Aucune modification
|
||||
- **Branche** : `docker-support` à jour
|
||||
|
||||
### `4NK_node`
|
||||
- **Statut** : Aucune modification
|
||||
- **Branche** : `main` à jour
|
||||
|
||||
## 🚀 Déploiement
|
||||
|
||||
### Services Opérationnels
|
||||
- **ihm_client** : ✅ Healthy (interface utilisateur)
|
||||
- **bitcoin-signet** : ✅ Healthy (nœud Bitcoin)
|
||||
- **blindbit-oracle** : ✅ Running (oracle)
|
||||
- **sdk_relay_1/2/3** : ⚠️ Running (relays - unhealthy mais fonctionnels)
|
||||
- **tor-proxy** : ✅ Healthy (proxy Tor)
|
||||
|
||||
### URLs d'Accès
|
||||
- **Interface utilisateur** : `http://localhost:8080`
|
||||
- **Bitcoin RPC** : `http://localhost:18443`
|
||||
- **Blindbit Oracle** : `http://localhost:8000`
|
||||
- **SDK Relay 1** : `ws://localhost:8090` (WebSocket) / `http://localhost:8091` (HTTP)
|
||||
- **SDK Relay 2** : `ws://localhost:8092` (WebSocket) / `http://localhost:8093` (HTTP)
|
||||
- **SDK Relay 3** : `ws://localhost:8094` (WebSocket) / `http://localhost:8095` (HTTP)
|
||||
- **Tor Proxy** : `socks5://localhost:9050`
|
||||
|
||||
## 📊 Impact des Modifications
|
||||
|
||||
### Améliorations
|
||||
- **Configuration build** : Correction des conflits entre lib et application
|
||||
- **Tests** : Tests unitaires robustes et fonctionnels
|
||||
- **Documentation** : Mise à jour complète du CHANGELOG
|
||||
- **Stabilité** : Configuration Jest améliorée pour une meilleure compatibilité
|
||||
|
||||
### Prochaines Étapes
|
||||
- **Interface utilisateur** : Résolution du problème d'affichage de la page par défaut nginx
|
||||
- **Tests d'intégration** : Développement de tests d'intégration complets
|
||||
- **Documentation** : Amélioration de la documentation utilisateur
|
||||
|
||||
## ✅ Résultat Final
|
||||
|
||||
Les modifications apportées améliorent significativement la robustesse et la maintenabilité de l'écosystème 4NK. L'interface utilisateur est maintenant plus fiable et les tests permettent de détecter les problèmes plus tôt dans le cycle de développement.
|
||||
|
||||
### Points Clés
|
||||
- ✅ Configuration Vite corrigée
|
||||
- ✅ Tests unitaires fonctionnels
|
||||
- ✅ Documentation mise à jour
|
||||
- ✅ Tous les projets synchronisés
|
||||
- ✅ Infrastructure opérationnelle
|
||||
|
||||
|
343
docs/ROADMAP.md
343
docs/ROADMAP.md
@ -1,343 +0,0 @@
|
||||
# Roadmap de Développement - 4NK_node
|
||||
|
||||
## 🗺️ Vue d'Ensemble
|
||||
|
||||
Ce document présente la roadmap de développement du projet 4NK_node, détaillant les fonctionnalités planifiées, les améliorations et les évolutions futures.
|
||||
|
||||
### **Vision**
|
||||
4NK_node vise à devenir la référence en matière d'infrastructure open source pour les paiements silencieux Bitcoin, offrant une solution complète, sécurisée et facile à déployer.
|
||||
|
||||
### **Objectifs**
|
||||
- Simplifier le déploiement des paiements silencieux Bitcoin
|
||||
- Créer un écosystème robuste et extensible
|
||||
- Favoriser l'adoption des paiements privés
|
||||
- Construire une communauté active de contributeurs
|
||||
|
||||
## 📅 Timeline de Développement
|
||||
|
||||
### **Phase Actuelle : v1.0.0 (Décembre 2024)**
|
||||
|
||||
#### ✅ **Complété**
|
||||
- Infrastructure Docker complète
|
||||
- Support Bitcoin Core signet
|
||||
- Service Blindbit intégré
|
||||
- SDK Relay avec synchronisation mesh
|
||||
- Documentation technique exhaustive
|
||||
- Tests automatisés
|
||||
- Préparation open source
|
||||
|
||||
#### 🔄 **En Cours**
|
||||
- Lancement open source
|
||||
- Support communautaire
|
||||
- Optimisations de performance
|
||||
|
||||
### **Phase 1 : v1.1.0 (Janvier-Mars 2025)**
|
||||
|
||||
#### 🎯 **Objectifs**
|
||||
- Amélioration de la stabilité
|
||||
- Optimisations de performance
|
||||
- Support communautaire
|
||||
- Documentation enrichie
|
||||
|
||||
#### 📋 **Fonctionnalités Planifiées**
|
||||
|
||||
##### **Stabilité et Performance**
|
||||
- [ ] **Optimisation mémoire** - Réduction de l'empreinte mémoire
|
||||
- [ ] **Amélioration des logs** - Logs structurés et rotation
|
||||
- [ ] **Monitoring avancé** - Métriques détaillées
|
||||
- [ ] **Gestion d'erreurs** - Récupération automatique
|
||||
- [ ] **Tests de charge** - Validation des performances
|
||||
|
||||
##### **Interface Utilisateur**
|
||||
- [ ] **Interface web basique** - Dashboard de monitoring
|
||||
- [ ] **API REST complète** - Endpoints pour la gestion
|
||||
- [ ] **CLI améliorée** - Commandes de gestion
|
||||
- [ ] **Documentation interactive** - Guides interactifs
|
||||
|
||||
##### **Sécurité**
|
||||
- [ ] **Audit de sécurité** - Audit externe complet
|
||||
- [ ] **Chiffrement des données** - Chiffrement des cookies
|
||||
- [ ] **Authentification** - Système d'authentification
|
||||
- [ ] **Certificats SSL/TLS** - Support HTTPS complet
|
||||
|
||||
### **Phase 2 : v1.2.0 (Avril-Juin 2025)**
|
||||
|
||||
#### 🎯 **Objectifs**
|
||||
- Support de nouveaux réseaux Bitcoin
|
||||
- Intégrations tierces
|
||||
- Écosystème d'extensions
|
||||
- Performance avancée
|
||||
|
||||
#### 📋 **Fonctionnalités Planifiées**
|
||||
|
||||
##### **Réseaux Bitcoin**
|
||||
- [ ] **Support mainnet** - Déploiement production
|
||||
- [ ] **Support testnet** - Environnement de test
|
||||
- [ ] **Support regtest** - Tests locaux
|
||||
- [ ] **Multi-réseaux** - Support simultané
|
||||
|
||||
##### **Intégrations**
|
||||
- [ ] **Wallets populaires** - Intégration wallets
|
||||
- [ ] **Exchanges** - Support exchanges
|
||||
- [ ] **Services tiers** - APIs externes
|
||||
- [ ] **Plugins** - Système de plugins
|
||||
|
||||
##### **Performance**
|
||||
- [ ] **Cache distribué** - Cache Redis/Memcached
|
||||
- [ ] **Base de données** - PostgreSQL/MySQL
|
||||
- [ ] **Load balancing** - Équilibrage de charge
|
||||
- [ ] **Auto-scaling** - Mise à l'échelle automatique
|
||||
|
||||
### **Phase 3 : v2.0.0 (Juillet-Décembre 2025)**
|
||||
|
||||
#### 🎯 **Objectifs**
|
||||
- Support Lightning Network
|
||||
- Écosystème complet
|
||||
- Marketplace d'extensions
|
||||
- IA et automatisation
|
||||
|
||||
#### 📋 **Fonctionnalités Planifiées**
|
||||
|
||||
##### **Lightning Network**
|
||||
- [ ] **Nœud Lightning** - LND/c-lightning
|
||||
- [ ] **Paiements Lightning** - Support LN
|
||||
- [ ] **Canaux automatiques** - Gestion des canaux
|
||||
- [ ] **Routage** - Routage Lightning
|
||||
|
||||
##### **Écosystème**
|
||||
- [ ] **Marketplace** - Extensions et plugins
|
||||
- [ ] **SDK complet** - SDK pour développeurs
|
||||
- [ ] **Templates** - Templates de déploiement
|
||||
- [ ] **Intégrations** - Écosystème riche
|
||||
|
||||
##### **Intelligence Artificielle**
|
||||
- [ ] **Monitoring IA** - Détection d'anomalies
|
||||
- [ ] **Optimisation automatique** - Auto-optimisation
|
||||
- [ ] **Prédictions** - Prédictions de charge
|
||||
- [ ] **Chatbot** - Support IA
|
||||
|
||||
### **Phase 4 : v2.1.0 (Janvier-Juin 2026)**
|
||||
|
||||
#### 🎯 **Objectifs**
|
||||
- Support multi-blockchains
|
||||
- Cloud native
|
||||
- Écosystème développeur
|
||||
- Adoption massive
|
||||
|
||||
#### 📋 **Fonctionnalités Planifiées**
|
||||
|
||||
##### **Multi-Blockchains**
|
||||
- [ ] **Ethereum** - Support Ethereum
|
||||
- [ ] **Polkadot** - Support Polkadot
|
||||
- [ ] **Cosmos** - Support Cosmos
|
||||
- [ ] **Interopérabilité** - Cross-chain
|
||||
|
||||
##### **Cloud Native**
|
||||
- [ ] **Kubernetes** - Support K8s
|
||||
- [ ] **Serverless** - Fonctions serverless
|
||||
- [ ] **Microservices** - Architecture microservices
|
||||
- [ ] **Edge computing** - Computing edge
|
||||
|
||||
##### **Écosystème Développeur**
|
||||
- [ ] **API Gateway** - Gateway API
|
||||
- [ ] **Documentation API** - Swagger/OpenAPI
|
||||
- [ ] **SDKs multiples** - SDKs pour différents langages
|
||||
- [ ] **Outils de développement** - IDE plugins
|
||||
|
||||
## 🎯 Fonctionnalités Détaillées
|
||||
|
||||
### **Interface Utilisateur Web**
|
||||
|
||||
#### **Dashboard Principal**
|
||||
```yaml
|
||||
Fonctionnalités:
|
||||
- Vue d'ensemble des services
|
||||
- Métriques en temps réel
|
||||
- Gestion des relais
|
||||
- Configuration avancée
|
||||
- Logs et monitoring
|
||||
- Support et documentation
|
||||
```
|
||||
|
||||
#### **API REST**
|
||||
```yaml
|
||||
Endpoints:
|
||||
- GET /api/v1/status - Statut des services
|
||||
- GET /api/v1/metrics - Métriques système
|
||||
- POST /api/v1/relays - Gestion des relais
|
||||
- PUT /api/v1/config - Configuration
|
||||
- GET /api/v1/logs - Logs système
|
||||
```
|
||||
|
||||
### **Support Lightning Network**
|
||||
|
||||
#### **Architecture LN**
|
||||
```yaml
|
||||
Composants:
|
||||
- LND Node: Nœud Lightning principal
|
||||
- Channel Manager: Gestion des canaux
|
||||
- Payment Router: Routage des paiements
|
||||
- Invoice Manager: Gestion des factures
|
||||
- Network Monitor: Surveillance réseau
|
||||
```
|
||||
|
||||
#### **Intégration**
|
||||
```yaml
|
||||
Fonctionnalités:
|
||||
- Paiements Lightning automatiques
|
||||
- Gestion des canaux
|
||||
- Routage intelligent
|
||||
- Facturation automatique
|
||||
- Monitoring des canaux
|
||||
```
|
||||
|
||||
### **Marketplace d'Extensions**
|
||||
|
||||
#### **Types d'Extensions**
|
||||
```yaml
|
||||
Extensions:
|
||||
- Wallets: Intégrations wallets
|
||||
- Exchanges: Support exchanges
|
||||
- Analytics: Outils d'analyse
|
||||
- Security: Outils de sécurité
|
||||
- Monitoring: Outils de monitoring
|
||||
- Custom: Extensions personnalisées
|
||||
```
|
||||
|
||||
#### **Système de Plugins**
|
||||
```yaml
|
||||
Architecture:
|
||||
- Plugin Manager: Gestionnaire de plugins
|
||||
- API Plugin: API pour plugins
|
||||
- Sandbox: Environnement sécurisé
|
||||
- Registry: Registre de plugins
|
||||
- Updates: Mises à jour automatiques
|
||||
```
|
||||
|
||||
## 📊 Métriques de Succès
|
||||
|
||||
### **Métriques Techniques**
|
||||
|
||||
#### **Performance**
|
||||
- **Temps de réponse** : < 100ms pour les APIs
|
||||
- **Disponibilité** : 99.9% uptime
|
||||
- **Throughput** : 1000+ transactions/seconde
|
||||
- **Latence** : < 50ms pour les paiements
|
||||
|
||||
#### **Qualité**
|
||||
- **Couverture de tests** : > 90%
|
||||
- **Bugs critiques** : 0 en production
|
||||
- **Temps de résolution** : < 24h pour les bugs critiques
|
||||
- **Documentation** : 100% des APIs documentées
|
||||
|
||||
### **Métriques Communautaires**
|
||||
|
||||
#### **Adoption**
|
||||
- **Utilisateurs actifs** : 1000+ utilisateurs
|
||||
- **Contributeurs** : 50+ contributeurs
|
||||
- **Forks** : 100+ forks
|
||||
- **Stars** : 500+ stars
|
||||
|
||||
#### **Engagement**
|
||||
- **Issues résolues** : 90% en < 7 jours
|
||||
- **PR merged** : 80% en < 3 jours
|
||||
- **Discussions actives** : 100+ par mois
|
||||
- **Documentation mise à jour** : Mise à jour continue
|
||||
|
||||
## 🚨 Gestion des Risques
|
||||
|
||||
### **Risques Techniques**
|
||||
|
||||
#### **Performance**
|
||||
- **Risque** : Charge élevée non supportée
|
||||
- **Mitigation** : Tests de charge, auto-scaling
|
||||
- **Plan de contingence** : Architecture distribuée
|
||||
|
||||
#### **Sécurité**
|
||||
- **Risque** : Vulnérabilités de sécurité
|
||||
- **Mitigation** : Audits réguliers, bug bounty
|
||||
- **Plan de contingence** : Response team, patches rapides
|
||||
|
||||
### **Risques Communautaires**
|
||||
|
||||
#### **Adoption**
|
||||
- **Risque** : Faible adoption
|
||||
- **Mitigation** : Marketing actif, documentation claire
|
||||
- **Plan de contingence** : Pivot vers niches spécifiques
|
||||
|
||||
#### **Maintenance**
|
||||
- **Risque** : Manque de mainteneurs
|
||||
- **Mitigation** : Formation, documentation
|
||||
- **Plan de contingence** : Équipe de backup
|
||||
|
||||
## 🎯 Priorités de Développement
|
||||
|
||||
### **Priorité Haute (P0)**
|
||||
1. **Stabilité** - Correction des bugs critiques
|
||||
2. **Sécurité** - Vulnérabilités de sécurité
|
||||
3. **Performance** - Optimisations critiques
|
||||
4. **Documentation** - Documentation essentielle
|
||||
|
||||
### **Priorité Moyenne (P1)**
|
||||
1. **Nouvelles fonctionnalités** - Fonctionnalités majeures
|
||||
2. **Améliorations UX** - Interface utilisateur
|
||||
3. **Intégrations** - Intégrations tierces
|
||||
4. **Monitoring** - Outils de monitoring
|
||||
|
||||
### **Priorité Basse (P2)**
|
||||
1. **Optimisations** - Optimisations mineures
|
||||
2. **Documentation avancée** - Guides avancés
|
||||
3. **Outils de développement** - Outils pour développeurs
|
||||
4. **Expérimentations** - Fonctionnalités expérimentales
|
||||
|
||||
## 📈 Évolution de l'Architecture
|
||||
|
||||
### **Architecture Actuelle (v1.0)**
|
||||
```yaml
|
||||
Services:
|
||||
- Bitcoin Core: Nœud Bitcoin
|
||||
- Blindbit: Service de filtres
|
||||
- SDK Relay: Relais synchronisés
|
||||
- Tor: Proxy anonyme
|
||||
```
|
||||
|
||||
### **Architecture v2.0**
|
||||
```yaml
|
||||
Services:
|
||||
- Bitcoin Core: Nœud Bitcoin
|
||||
- Lightning Node: Nœud Lightning
|
||||
- Blindbit: Service de filtres
|
||||
- SDK Relay: Relais synchronisés
|
||||
- API Gateway: Gateway API
|
||||
- Web UI: Interface web
|
||||
- Monitoring: Monitoring avancé
|
||||
- Tor: Proxy anonyme
|
||||
```
|
||||
|
||||
### **Architecture v3.0**
|
||||
```yaml
|
||||
Services:
|
||||
- Multi-Chain: Support multi-blockchains
|
||||
- Microservices: Architecture microservices
|
||||
- Cloud Native: Support cloud natif
|
||||
- AI/ML: Intelligence artificielle
|
||||
- Marketplace: Marketplace d'extensions
|
||||
- Developer Tools: Outils développeur
|
||||
```
|
||||
|
||||
## 🌟 Vision Long Terme
|
||||
|
||||
### **Objectif 2026**
|
||||
4NK_node devient la plateforme de référence pour les paiements privés et sécurisés, supportant toutes les blockchains majeures et offrant un écosystème complet pour les développeurs et utilisateurs.
|
||||
|
||||
### **Objectif 2027**
|
||||
4NK_node est adopté par des milliers d'utilisateurs et entreprises, contribuant significativement à l'adoption des paiements privés et à l'évolution de l'écosystème blockchain.
|
||||
|
||||
### **Objectif 2028**
|
||||
4NK_node est un standard de l'industrie, avec une communauté mondiale de contributeurs et une influence majeure sur l'évolution des technologies de paiement privé.
|
||||
|
||||
---
|
||||
|
||||
**Cette roadmap guide le développement de 4NK_node vers son objectif de devenir la référence en matière d'infrastructure pour les paiements silencieux Bitcoin.** 🚀
|
||||
|
||||
|
@ -1,200 +0,0 @@
|
||||
# Audit de Sécurité - 4NK_node
|
||||
|
||||
## 🔍 Résumé de l'Audit
|
||||
|
||||
**Date d'audit** : 19 décembre 2024
|
||||
**Auditeur** : Assistant IA
|
||||
**Version du projet** : 1.0.0
|
||||
**Score de sécurité** : 85/100 ✅
|
||||
|
||||
## 📋 Éléments Audités
|
||||
|
||||
### ✅ **Points Sécurisés**
|
||||
|
||||
#### 1. **Fichiers de Configuration**
|
||||
- ✅ **Cookies Bitcoin** : Utilisation de chemins sécurisés (`/home/bitcoin/.bitcoin/signet/.cookie`)
|
||||
- ✅ **Permissions** : Cookies avec permissions 600 (lecture/écriture propriétaire uniquement)
|
||||
- ✅ **Variables d'environnement** : Pas de secrets en dur dans le code
|
||||
- ✅ **Configuration externalisée** : Fichiers .conf séparés du code
|
||||
|
||||
#### 2. **Infrastructure Docker**
|
||||
- ✅ **Réseau isolé** : Communication via réseau privé `btcnet`
|
||||
- ✅ **Volumes sécurisés** : Données sensibles dans des volumes Docker
|
||||
- ✅ **Healthchecks** : Surveillance de l'état des services
|
||||
- ✅ **Logs** : Rotation et limitation de taille des logs
|
||||
|
||||
#### 3. **Code et Dépendances**
|
||||
- ✅ **Pas de secrets en dur** : Aucun mot de passe ou clé privée dans le code
|
||||
- ✅ **Dépendances Rust** : Utilisation de crates sécurisées
|
||||
- ✅ **Validation des entrées** : Validation des configurations et paramètres
|
||||
- ✅ **Gestion d'erreurs** : Gestion appropriée des erreurs
|
||||
|
||||
### ⚠️ **Points d'Attention**
|
||||
|
||||
#### 1. **URLs et Endpoints**
|
||||
- ⚠️ **dev3.4nkweb.com** : URL externe référencée dans la configuration
|
||||
- ⚠️ **git.4nkweb.com** : URLs du repository Gitea
|
||||
- ✅ **Pas d'endpoints privés** : Toutes les URLs sont publiques et appropriées
|
||||
|
||||
#### 2. **Certificats SSL/TLS**
|
||||
- ⚠️ **Exemples de certificats** : Documentation contient des exemples de génération
|
||||
- ✅ **Pas de certificats réels** : Aucun certificat privé dans le code
|
||||
|
||||
#### 3. **Tests de Connectivité**
|
||||
- ⚠️ **WebSocket tests** : Tests utilisent des clés de test (`Sec-WebSocket-Key: test`)
|
||||
- ✅ **Clés de test uniquement** : Pas de clés de production
|
||||
|
||||
## 🔒 Analyse Détaillée
|
||||
|
||||
### **Fichiers Sensibles**
|
||||
|
||||
#### Cookies Bitcoin Core
|
||||
```bash
|
||||
# Sécurisé ✅
|
||||
/home/bitcoin/.bitcoin/signet/.cookie # Permissions 600
|
||||
/home/bitcoin/.4nk/bitcoin.cookie # Copie sécurisée
|
||||
```
|
||||
|
||||
#### Configuration Files
|
||||
```bash
|
||||
# Sécurisé ✅
|
||||
sdk_relay/.conf # Configuration de base
|
||||
sdk_relay/.conf.docker # Configuration Docker
|
||||
sdk_relay/external_nodes.conf # Nœuds externes
|
||||
```
|
||||
|
||||
#### Docker Volumes
|
||||
```bash
|
||||
# Sécurisé ✅
|
||||
bitcoin_data:/home/bitcoin/.bitcoin # Données Bitcoin
|
||||
blindbit_data:/data # Données Blindbit
|
||||
sdk_relay_*_data:/home/bitcoin/.4nk # Données SDK Relay
|
||||
```
|
||||
|
||||
### **URLs et Endpoints**
|
||||
|
||||
#### URLs Publiques (Approuvées)
|
||||
```bash
|
||||
# Repository Gitea ✅
|
||||
https://git.4nkweb.com/4nk/4NK_node
|
||||
https://git.4nkweb.com/4nk/sdk_relay
|
||||
https://git.4nkweb.com/4nk/sdk_common
|
||||
|
||||
# Nœud externe ✅
|
||||
dev3.4nkweb.com:443 # Relais externe documenté
|
||||
```
|
||||
|
||||
#### URLs de Support (Approuvées)
|
||||
```bash
|
||||
# Support et communication ✅
|
||||
security@4nkweb.com # Signalement de vulnérabilités
|
||||
support@4nkweb.com # Support utilisateur
|
||||
https://forum.4nkweb.com # Forum communautaire
|
||||
```
|
||||
|
||||
### **Variables d'Environnement**
|
||||
|
||||
#### Variables Sécurisées
|
||||
```bash
|
||||
# Configuration Bitcoin ✅
|
||||
BITCOIN_COOKIE_PATH=/home/bitcoin/.bitcoin/signet/.cookie
|
||||
BITCOIN_NETWORK=signet
|
||||
|
||||
# Configuration SDK Relay ✅
|
||||
RUST_LOG=debug
|
||||
ENABLE_SYNC_TEST=1
|
||||
HOME=/home/bitcoin
|
||||
```
|
||||
|
||||
## 🛡️ Recommandations de Sécurité
|
||||
|
||||
### **Actions Immédiates**
|
||||
|
||||
#### 1. **Permissions des Fichiers**
|
||||
```bash
|
||||
# Vérifier les permissions des fichiers sensibles
|
||||
find . -name "*.conf" -exec chmod 600 {} \;
|
||||
find . -name "*.cookie" -exec chmod 600 {} \;
|
||||
```
|
||||
|
||||
#### 2. **Variables d'Environnement**
|
||||
```bash
|
||||
# Utiliser des variables d'environnement pour les secrets
|
||||
export BITCOIN_RPC_PASSWORD="your_secure_password"
|
||||
export BLINDBIT_API_KEY="your_api_key"
|
||||
```
|
||||
|
||||
#### 3. **Monitoring de Sécurité**
|
||||
```bash
|
||||
# Ajouter des tests de sécurité automatisés
|
||||
./tests/run_security_tests.sh
|
||||
```
|
||||
|
||||
### **Actions Recommandées**
|
||||
|
||||
#### 1. **Chiffrement des Données**
|
||||
- Chiffrer les cookies Bitcoin Core
|
||||
- Utiliser des certificats SSL/TLS pour les communications
|
||||
- Implémenter le chiffrement des données sensibles
|
||||
|
||||
#### 2. **Authentification Renforcée**
|
||||
- Implémenter l'authentification multi-facteurs
|
||||
- Utiliser des tokens JWT pour les APIs
|
||||
- Ajouter la validation des certificats clients
|
||||
|
||||
#### 3. **Audit Continu**
|
||||
- Mettre en place un audit de sécurité automatisé
|
||||
- Surveiller les vulnérabilités des dépendances
|
||||
- Tester régulièrement la sécurité
|
||||
|
||||
## 📊 Score de Sécurité
|
||||
|
||||
### **Critères d'Évaluation**
|
||||
|
||||
| Critère | Score | Commentaire |
|
||||
|---------|-------|-------------|
|
||||
| **Secrets en dur** | 100/100 | ✅ Aucun secret trouvé |
|
||||
| **Permissions** | 90/100 | ✅ Permissions appropriées |
|
||||
| **Configuration** | 85/100 | ✅ Configuration externalisée |
|
||||
| **Réseau** | 90/100 | ✅ Isolation Docker |
|
||||
| **Dépendances** | 80/100 | ✅ Dépendances sécurisées |
|
||||
| **Documentation** | 85/100 | ✅ Bonnes pratiques documentées |
|
||||
|
||||
### **Score Global : 85/100** ✅
|
||||
|
||||
## 🚨 Plan d'Action
|
||||
|
||||
### **Phase 1 : Immédiat (1-2 jours)**
|
||||
- [x] Audit de sécurité complet
|
||||
- [x] Vérification des permissions
|
||||
- [x] Nettoyage des fichiers GitHub
|
||||
- [ ] Tests de sécurité automatisés
|
||||
|
||||
### **Phase 2 : Court terme (1 semaine)**
|
||||
- [ ] Implémentation du chiffrement des cookies
|
||||
- [ ] Ajout de certificats SSL/TLS
|
||||
- [ ] Monitoring de sécurité
|
||||
|
||||
### **Phase 3 : Moyen terme (1 mois)**
|
||||
- [ ] Authentification renforcée
|
||||
- [ ] Audit de sécurité automatisé
|
||||
- [ ] Formation sécurité équipe
|
||||
|
||||
## 📚 Ressources
|
||||
|
||||
### **Documentation Sécurité**
|
||||
- [Guide de Sécurité Bitcoin](https://bitcoin.org/en/security)
|
||||
- [OWASP Top 10](https://owasp.org/www-project-top-ten/)
|
||||
- [Docker Security Best Practices](https://docs.docker.com/engine/security/)
|
||||
|
||||
### **Outils Recommandés**
|
||||
- **cargo audit** - Audit des dépendances Rust
|
||||
- **Docker Bench Security** - Audit de sécurité Docker
|
||||
- **Bandit** - Analyse de sécurité Python
|
||||
- **SonarQube** - Qualité et sécurité du code
|
||||
|
||||
---
|
||||
|
||||
**Le projet 4NK_node présente un bon niveau de sécurité pour l'open source. Les recommandations ci-dessus permettront de renforcer encore la sécurité.** 🔒
|
||||
|
||||
|
@ -1,131 +0,0 @@
|
||||
# Configuration SSH automatique pour ihm_client
|
||||
|
||||
## Vue d'ensemble
|
||||
|
||||
Le projet `ihm_client` utilise automatiquement les clés SSH pour toutes les opérations Git, que ce soit en local ou dans l'environnement CI/CD Gitea Actions.
|
||||
|
||||
## Configuration automatique
|
||||
|
||||
### Environnement CI/CD
|
||||
|
||||
Dans l'environnement CI/CD Gitea Actions, la configuration SSH est automatique :
|
||||
|
||||
1. **Variable d'environnement** : La clé SSH privée est fournie via la variable `SSH_PRIVATE_KEY`
|
||||
2. **Configuration automatique** : Le workflow CI configure automatiquement SSH pour `git.4nkweb.com`
|
||||
3. **Test de connexion** : La connexion SSH est testée avant chaque opération Git
|
||||
|
||||
### Environnement local
|
||||
|
||||
En local, le script `scripts/setup-ssh-ci.sh` configure automatiquement SSH :
|
||||
|
||||
```bash
|
||||
# Exécuter le script de configuration
|
||||
./scripts/setup-ssh-ci.sh
|
||||
```
|
||||
|
||||
## Configuration manuelle
|
||||
|
||||
Si la configuration automatique ne fonctionne pas, voici les étapes manuelles :
|
||||
|
||||
### 1. Générer une clé SSH
|
||||
|
||||
```bash
|
||||
ssh-keygen -t rsa -b 4096 -C "votre-email@example.com"
|
||||
```
|
||||
|
||||
### 2. Ajouter la clé publique à Gitea
|
||||
|
||||
1. Copier le contenu de `~/.ssh/id_rsa.pub`
|
||||
2. Aller dans les paramètres de votre compte Gitea
|
||||
3. Ajouter la clé SSH dans la section "SSH Keys"
|
||||
|
||||
### 3. Configurer Git pour utiliser SSH
|
||||
|
||||
```bash
|
||||
git config --global url."git@git.4nkweb.com:".insteadOf "https://git.4nkweb.com/"
|
||||
```
|
||||
|
||||
### 4. Tester la connexion
|
||||
|
||||
```bash
|
||||
ssh -T git@git.4nkweb.com
|
||||
```
|
||||
|
||||
## Workflow CI/CD
|
||||
|
||||
Le workflow CI/CD (`.gitea/workflows/ci.yml`) inclut :
|
||||
|
||||
### Étapes SSH automatiques
|
||||
|
||||
1. **Setup SSH for Gitea** : Configure la clé SSH et les paramètres de connexion
|
||||
2. **Checkout code** : Utilise SSH pour cloner le repository
|
||||
3. **Tests et build** : Exécute les tests et builds avec SSH configuré
|
||||
|
||||
### Variables requises
|
||||
|
||||
- `SSH_PRIVATE_KEY` : Clé SSH privée pour l'authentification
|
||||
- `SSH_PUBLIC_KEY` : Clé SSH publique (optionnelle)
|
||||
|
||||
## Sécurité
|
||||
|
||||
### Bonnes pratiques
|
||||
|
||||
- Les clés SSH sont stockées de manière sécurisée dans les secrets Gitea
|
||||
- Les permissions des fichiers SSH sont correctement configurées (600 pour les clés privées)
|
||||
- La vérification des hôtes SSH est configurée pour `git.4nkweb.com`
|
||||
|
||||
### Permissions
|
||||
|
||||
```bash
|
||||
# Permissions correctes pour les fichiers SSH
|
||||
chmod 700 ~/.ssh
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
chmod 644 ~/.ssh/id_rsa.pub
|
||||
chmod 600 ~/.ssh/config
|
||||
```
|
||||
|
||||
## Dépannage
|
||||
|
||||
### Problèmes courants
|
||||
|
||||
1. **Permission denied** : Vérifier les permissions des fichiers SSH
|
||||
2. **Host key verification failed** : Ajouter `git.4nkweb.com` aux hôtes connus
|
||||
3. **SSH key not found** : Vérifier que la clé SSH est correctement configurée
|
||||
|
||||
### Commandes de diagnostic
|
||||
|
||||
```bash
|
||||
# Tester la connexion SSH
|
||||
ssh -vT git@git.4nkweb.com
|
||||
|
||||
# Vérifier la configuration Git
|
||||
git config --global --list | grep url
|
||||
|
||||
# Vérifier les permissions SSH
|
||||
ls -la ~/.ssh/
|
||||
```
|
||||
|
||||
## Intégration avec 4NK_node
|
||||
|
||||
Lors de l'intégration avec `4NK_node`, la configuration SSH est préservée :
|
||||
|
||||
- Les clés SSH sont partagées entre les projets
|
||||
- La configuration Git utilise SSH pour tous les repositories 4NK
|
||||
- Le workflow CI/CD maintient la cohérence SSH
|
||||
|
||||
## Évolution
|
||||
|
||||
### Améliorations futures
|
||||
|
||||
- Support pour plusieurs clés SSH
|
||||
- Rotation automatique des clés
|
||||
- Intégration avec un gestionnaire de secrets externe
|
||||
- Support pour l'authentification par certificats SSH
|
||||
|
||||
### Maintenance
|
||||
|
||||
- Vérification régulière de la validité des clés SSH
|
||||
- Mise à jour des configurations SSH selon les bonnes pratiques
|
||||
- Documentation des changements de configuration SSH
|
||||
|
||||
|
557
docs/TESTING.md
557
docs/TESTING.md
@ -1,557 +0,0 @@
|
||||
# Guide de Tests - 4NK_node
|
||||
|
||||
Ce guide documente l'ensemble des tests disponibles pour l'infrastructure 4NK_node, leur organisation et leur utilisation.
|
||||
|
||||
## Vue d'Ensemble
|
||||
|
||||
L'infrastructure 4NK_node dispose d'une suite de tests complète organisée en plusieurs catégories :
|
||||
|
||||
- **Tests Unitaires** : Tests individuels des composants
|
||||
- **Tests d'Intégration** : Tests d'interaction entre services
|
||||
- **Tests de Connectivité** : Tests réseau et WebSocket
|
||||
- **Tests Externes** : Tests avec des nœuds externes
|
||||
- **Tests de Performance** : Tests de charge et performance (à venir)
|
||||
|
||||
## Structure des Tests
|
||||
|
||||
```
|
||||
tests/
|
||||
├── README.md # Documentation principale des tests
|
||||
├── run_all_tests.sh # Exécution de tous les tests
|
||||
├── run_unit_tests.sh # Tests unitaires uniquement
|
||||
├── run_integration_tests.sh # Tests d'intégration uniquement
|
||||
├── run_connectivity_tests.sh # Tests de connectivité uniquement
|
||||
├── run_external_tests.sh # Tests externes uniquement
|
||||
├── cleanup.sh # Nettoyage des logs et rapports
|
||||
├── logs/ # Logs des tests
|
||||
├── reports/ # Rapports de tests
|
||||
├── unit/ # Tests unitaires
|
||||
│ ├── test_healthcheck.sh
|
||||
│ ├── test_docker.sh
|
||||
│ ├── test_simple.sh
|
||||
│ └── test_final.sh
|
||||
├── integration/ # Tests d'intégration
|
||||
│ ├── test_3_relays.sh
|
||||
│ ├── test_final_sync.sh
|
||||
│ ├── test_sync_logs.sh
|
||||
│ └── test_messages.sh
|
||||
├── connectivity/ # Tests de connectivité
|
||||
│ ├── test_connectivity.sh
|
||||
│ └── test_websocket_messages.py
|
||||
├── external/ # Tests externes
|
||||
│ ├── test_dev3_simple.py
|
||||
│ ├── test_dev3_connectivity.py
|
||||
│ └── test_integration_dev3.sh
|
||||
└── performance/ # Tests de performance (à créer)
|
||||
```
|
||||
|
||||
## Exécution des Tests
|
||||
|
||||
### Test Complet
|
||||
|
||||
Pour exécuter tous les tests :
|
||||
|
||||
```bash
|
||||
cd tests/
|
||||
./run_all_tests.sh
|
||||
```
|
||||
|
||||
Options disponibles :
|
||||
- `--verbose` : Mode verbose avec affichage détaillé
|
||||
- `--debug` : Mode debug complet
|
||||
- `--skip-unit` : Ignorer les tests unitaires
|
||||
- `--skip-integration` : Ignorer les tests d'intégration
|
||||
- `--skip-connectivity` : Ignorer les tests de connectivité
|
||||
- `--skip-external` : Ignorer les tests externes
|
||||
|
||||
### Tests par Catégorie
|
||||
|
||||
#### Tests Unitaires
|
||||
```bash
|
||||
./tests/run_unit_tests.sh [--verbose] [--debug]
|
||||
```
|
||||
|
||||
**Tests inclus :**
|
||||
- `test_healthcheck.sh` : Test du healthcheck de sdk_relay
|
||||
- `test_docker.sh` : Test de la configuration Docker
|
||||
- `test_simple.sh` : Test simple de sdk_relay
|
||||
- `test_final.sh` : Test final de sdk_relay
|
||||
|
||||
**Prérequis :**
|
||||
- Docker installé et fonctionnel
|
||||
- Image sdk_relay disponible
|
||||
|
||||
#### Tests d'Intégration
|
||||
```bash
|
||||
./tests/run_integration_tests.sh [--verbose] [--debug]
|
||||
```
|
||||
|
||||
**Tests inclus :**
|
||||
- `test_3_relays.sh` : Test de 3 instances sdk_relay
|
||||
- `test_final_sync.sh` : Test complet de synchronisation
|
||||
- `test_sync_logs.sh` : Test des logs de synchronisation
|
||||
- `test_messages.sh` : Test des messages entre relais
|
||||
- `scripts/test_ui.sh` : Build UI, déploiement reverse proxy et vérifications HTTPS (headers, index, modules JS)
|
||||
|
||||
**Prérequis :**
|
||||
- Tous les services Docker démarrés (bitcoin, blindbit, sdk_relay)
|
||||
- Infrastructure complète opérationnelle
|
||||
|
||||
#### Tests de Connectivité
|
||||
```bash
|
||||
./tests/run_connectivity_tests.sh [--verbose] [--debug]
|
||||
```
|
||||
|
||||
**Tests inclus :**
|
||||
- `test_connectivity.sh` : Test de connectivité des services
|
||||
- `test_websocket_messages.py` : Test des messages WebSocket
|
||||
- `test_storage_proxy.sh` : Test de l’API sdk_storage via le reverse proxy (`/storage/*`)
|
||||
- `test_signer_proxy.sh` : Test de la connectivité sdk_signer (port 9090 + WSS via `/signer/ws/` + santé `/signer/health`)
|
||||
- Tests externes reverse proxy :
|
||||
```bash
|
||||
curl -kI https://<IP_VM>/
|
||||
curl -kI https://<IP_VM>/api/
|
||||
npx wscat -c wss://<IP_VM>/ws --no-check
|
||||
```
|
||||
|
||||
**Prérequis :**
|
||||
- Services Docker démarrés
|
||||
- Python3 avec websockets installé
|
||||
|
||||
#### Tests Externes
|
||||
```bash
|
||||
./tests/run_external_tests.sh [--verbose] [--debug]
|
||||
```
|
||||
|
||||
**Tests inclus :**
|
||||
- `test_dev3_simple.py` : Test simple de dev3.4nkweb.com
|
||||
- `test_dev3_connectivity.py` : Test de connectivité dev3
|
||||
- `test_integration_dev3.sh` : Test d'intégration dev3
|
||||
|
||||
**Prérequis :**
|
||||
- Connectivité internet
|
||||
- Python3 avec websockets installé
|
||||
- Services locaux optionnels
|
||||
|
||||
### Test Individuel
|
||||
|
||||
Pour exécuter un test spécifique :
|
||||
|
||||
```bash
|
||||
# Test shell
|
||||
./tests/integration/test_3_relays.sh
|
||||
|
||||
# Test Python
|
||||
python3 tests/external/test_dev3_simple.py
|
||||
```
|
||||
|
||||
## Interprétation des Résultats
|
||||
|
||||
### Codes de Sortie
|
||||
|
||||
- `0` : Test réussi
|
||||
- `1` : Test échoué
|
||||
- `2` : Test ignoré (prérequis non satisfaits)
|
||||
|
||||
### Logs
|
||||
|
||||
Les logs détaillés sont écrits dans `tests/logs/` avec le format :
|
||||
```
|
||||
YYYY-MM-DD_HH-MM-SS_category_tests.log
|
||||
```
|
||||
|
||||
Exemples :
|
||||
- `2024-12-19_14-30-25_unit_tests.log`
|
||||
- `2024-12-19_14-35-12_integration_tests.log`
|
||||
|
||||
### Rapports
|
||||
|
||||
Les rapports JSON sont générés dans `tests/reports/` avec le format :
|
||||
```
|
||||
test_report_YYYY-MM-DD_HH-MM-SS.json
|
||||
```
|
||||
|
||||
Structure du rapport :
|
||||
```json
|
||||
{
|
||||
"timestamp": "2024-12-19_14-30-25",
|
||||
"summary": {
|
||||
"total_tests": 10,
|
||||
"successful_tests": 8,
|
||||
"failed_tests": 2,
|
||||
"success_rate": 80.0
|
||||
},
|
||||
"log_file": "tests/logs/test_run_2024-12-19_14-30-25.log",
|
||||
"options": {
|
||||
"verbose": false,
|
||||
"debug": false,
|
||||
"skip_unit": false,
|
||||
"skip_integration": false,
|
||||
"skip_connectivity": false,
|
||||
"skip_external": false,
|
||||
"skip_performance": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Détail des Tests
|
||||
|
||||
### Tests Unitaires
|
||||
|
||||
#### test_healthcheck.sh
|
||||
- **Objectif** : Vérifier le fonctionnement du healthcheck de sdk_relay
|
||||
- **Méthode** : Test du script healthcheck.sh dans un conteneur
|
||||
- **Critères de succès** : Healthcheck retourne un code de sortie approprié
|
||||
|
||||
#### test_docker.sh
|
||||
- **Objectif** : Vérifier la configuration Docker de sdk_relay
|
||||
- **Méthode** : Test de la construction et du démarrage du conteneur
|
||||
- **Critères de succès** : Conteneur démarre correctement
|
||||
|
||||
#### test_simple.sh
|
||||
- **Objectif** : Test simple de sdk_relay
|
||||
- **Méthode** : Démarrage et test basique de sdk_relay
|
||||
- **Critères de succès** : Service répond aux requêtes de base
|
||||
|
||||
#### test_final.sh
|
||||
- **Objectif** : Test final complet de sdk_relay
|
||||
- **Méthode** : Test complet avec toutes les fonctionnalités
|
||||
- **Critères de succès** : Toutes les fonctionnalités opérationnelles
|
||||
|
||||
### Tests d'Intégration
|
||||
|
||||
#### test_3_relays.sh
|
||||
- **Objectif** : Tester 3 instances sdk_relay en parallèle
|
||||
- **Méthode** : Démarrage de 3 relais et vérification de leur interaction
|
||||
- **Critères de succès** : Les 3 relais communiquent correctement
|
||||
|
||||
#### test_final_sync.sh
|
||||
- **Objectif** : Test complet de la synchronisation
|
||||
- **Méthode** : Test de tous les types de synchronisation
|
||||
- **Critères de succès** : Synchronisation fonctionnelle entre tous les relais
|
||||
|
||||
#### test_sync_logs.sh
|
||||
- **Objectif** : Vérifier les logs de synchronisation
|
||||
- **Méthode** : Analyse des logs de synchronisation
|
||||
- **Critères de succès** : Logs cohérents et sans erreurs
|
||||
|
||||
#### test_messages.sh
|
||||
- **Objectif** : Tester l'échange de messages entre relais
|
||||
- **Méthode** : Envoi et réception de messages de test
|
||||
- **Critères de succès** : Messages correctement transmis
|
||||
|
||||
### Tests de Connectivité
|
||||
|
||||
#### test_connectivity.sh
|
||||
- **Objectif** : Vérifier la connectivité entre services
|
||||
- **Méthode** : Test de connectivité réseau entre conteneurs
|
||||
- **Critères de succès** : Tous les services accessibles
|
||||
|
||||
#### test_websocket_messages.py
|
||||
- **Objectif** : Tester les messages WebSocket
|
||||
- **Méthode** : Connexion WebSocket et échange de messages
|
||||
- **Critères de succès** : Communication WebSocket fonctionnelle
|
||||
|
||||
### Tests Externes
|
||||
|
||||
#### test_dev3_simple.py
|
||||
- **Objectif** : Test simple de dev3.4nkweb.com
|
||||
- **Méthode** : Connexion WebSocket simple
|
||||
- **Critères de succès** : Connexion établie
|
||||
|
||||
#### test_dev3_connectivity.py
|
||||
- **Objectif** : Test complet de connectivité dev3
|
||||
- **Méthode** : Tests de protocole et handshake
|
||||
- **Critères de succès** : Tous les protocoles supportés
|
||||
|
||||
#### test_integration_dev3.sh
|
||||
- **Objectif** : Test d'intégration avec dev3
|
||||
- **Méthode** : Test complet d'intégration
|
||||
- **Critères de succès** : Intégration fonctionnelle
|
||||
|
||||
## Dépannage
|
||||
|
||||
### Problèmes Courants
|
||||
|
||||
#### Services non démarrés
|
||||
**Symptôme** : Erreur "Service non trouvé"
|
||||
**Solution** : Démarrer les services avec `./restart_4nk_node.sh`
|
||||
|
||||
#### Connectivité réseau
|
||||
**Symptôme** : Timeout ou erreur de connexion
|
||||
**Solution** : Vérifier les ports et pare-feu
|
||||
|
||||
#### Certificats SSL
|
||||
**Symptôme** : Erreur SSL dans les tests externes
|
||||
**Solution** : Vérifier les certificats et la configuration SSL
|
||||
|
||||
### Dépannage Tor/Bitcoin (signet custom)
|
||||
|
||||
#### Vérifier Tor
|
||||
```bash
|
||||
# État du conteneur Tor
|
||||
sudo docker compose ps tor
|
||||
|
||||
# Derniers logs Tor
|
||||
sudo docker logs tor-proxy --tail=60
|
||||
|
||||
# Test du port SOCKS interne
|
||||
sudo docker exec tor-proxy nc -z 127.0.0.1 9050 && echo SOCKS:OK
|
||||
```
|
||||
|
||||
#### Bridges obfs4 et diagnostics
|
||||
|
||||
- Les bridges obfs4 peuvent être ajoutés dans `tor/torrc` (cf. docs/CONFIGURATION.md). Après ajout, redémarrer le service Tor.
|
||||
- En cas d’échec « general SOCKS server failure », remplacer/ajouter des bridges et re‑tester.
|
||||
- Valider la différence entre :
|
||||
- `nc -vz -w 10 -x 127.0.0.1:9050 -X 5 duckduckgogg42xjoc72x3sjasowoarfbgcmvfimaftt6twagswzczad.onion 80` (référence onion publique)
|
||||
- `nc -vz -w 10 -x 127.0.0.1:9050 -X 5 <onion_signet> 38333` (pair signet cible)
|
||||
|
||||
#### Vérifier Bitcoin Core côté réseau
|
||||
```bash
|
||||
# Connexions réseau
|
||||
sudo docker exec bitcoin-signet bitcoin-cli -signet getnetworkinfo | jq '.connections,.connections_in,.connections_out'
|
||||
|
||||
# Pairs et nombre total
|
||||
sudo docker exec bitcoin-signet bitcoin-cli -signet getpeerinfo | wc -l
|
||||
```
|
||||
|
||||
#### Forcer une tentative de pair (onion existant)
|
||||
```bash
|
||||
ONION=$(awk -F= '/^addnode=/{print $2}' bitcoin/bitcoin.conf | head -n1)
|
||||
sudo docker exec bitcoin-signet bitcoin-cli -signet addnode ${ONION}:38333 onetry
|
||||
sleep 5
|
||||
sudo docker exec bitcoin-signet bitcoin-cli -signet getconnectioncount
|
||||
```
|
||||
|
||||
#### Boucle de retry signet (optionnelle)
|
||||
|
||||
Un script dédié permet de tenter automatiquement l’ajout du pair signet `.onion` et de redémarrer `sdk_relay_1` une fois des connexions établies :
|
||||
|
||||
```bash
|
||||
./scripts/retry_signet_sync.sh
|
||||
```
|
||||
|
||||
Les logs sont conservés sous `tests/logs/signet_sync_*.log`.
|
||||
|
||||
#### Vérifier l’ouverture des ports du relais et l’API
|
||||
```bash
|
||||
# Ports 8090/8091 dans sdk_relay_1 (peuvent s'ouvrir après la phase d'initialisation)
|
||||
sudo docker exec sdk_relay_1 sh -lc 'ss -lntp 2>/dev/null || netstat -tlnp 2>/dev/null' | grep -E ':8090 |:8091 ' || echo en-initialisation
|
||||
|
||||
# Test /api via reverse proxy
|
||||
curl -k -I https://localhost/api/
|
||||
```
|
||||
|
||||
#### Dépendances Python
|
||||
**Symptôme** : ModuleNotFoundError
|
||||
**Solution** : Installer les dépendances avec `pip install websockets`
|
||||
|
||||
### Debug
|
||||
|
||||
#### Mode Verbose
|
||||
```bash
|
||||
./tests/run_all_tests.sh --verbose
|
||||
```
|
||||
|
||||
#### Mode Debug
|
||||
```bash
|
||||
./tests/run_all_tests.sh --debug
|
||||
```
|
||||
|
||||
#### Test spécifique avec debug
|
||||
```bash
|
||||
./tests/integration/test_3_relays.sh --debug
|
||||
```
|
||||
|
||||
## Maintenance
|
||||
|
||||
### Nettoyage Automatique
|
||||
|
||||
#### Nettoyer les logs anciens
|
||||
```bash
|
||||
./tests/cleanup.sh --days 7
|
||||
```
|
||||
|
||||
#### Nettoyer les rapports anciens
|
||||
```bash
|
||||
./tests/cleanup.sh --reports --days 30
|
||||
```
|
||||
|
||||
#### Nettoyage complet
|
||||
```bash
|
||||
./tests/cleanup.sh --all --days 7
|
||||
```
|
||||
|
||||
#### Simulation de nettoyage
|
||||
```bash
|
||||
./tests/cleanup.sh --all --dry-run
|
||||
```
|
||||
|
||||
### Surveillance
|
||||
|
||||
#### Vérifier l'espace disque
|
||||
```bash
|
||||
du -sh tests/logs tests/reports
|
||||
```
|
||||
|
||||
#### Lister les fichiers récents
|
||||
```bash
|
||||
find tests/logs -name "*.log" -mtime -1
|
||||
```
|
||||
|
||||
#### Analyser les échecs
|
||||
```bash
|
||||
grep -r "ERROR\|FAILED" tests/logs/
|
||||
```
|
||||
|
||||
## Ajout de Nouveaux Tests
|
||||
|
||||
### Structure Recommandée
|
||||
|
||||
Pour ajouter un nouveau test :
|
||||
|
||||
1. **Créer le fichier de test** dans le répertoire approprié
|
||||
2. **Ajouter le test** au script d'exécution correspondant
|
||||
3. **Documenter le test** dans ce guide
|
||||
4. **Tester le test** pour s'assurer qu'il fonctionne
|
||||
|
||||
### Template de Test Shell
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
# Test: Description du test
|
||||
# Auteur: Nom
|
||||
# Date: YYYY-MM-DD
|
||||
|
||||
set -e
|
||||
|
||||
# Configuration
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
LOG_FILE="tests/logs/$(date +%Y-%m-%d_%H-%M-%S)_test_name.log"
|
||||
|
||||
# Fonctions
|
||||
log() {
|
||||
echo "[$(date +%Y-%m-%d\ %H:%M:%S)] $1" | tee -a "$LOG_FILE"
|
||||
}
|
||||
|
||||
# Test principal
|
||||
main() {
|
||||
log "Début du test"
|
||||
|
||||
# Vérifications préliminaires
|
||||
check_prerequisites
|
||||
|
||||
# Exécution du test
|
||||
run_test
|
||||
|
||||
# Vérification des résultats
|
||||
verify_results
|
||||
|
||||
log "Test terminé avec succès"
|
||||
}
|
||||
|
||||
# Exécution
|
||||
main "$@"
|
||||
```
|
||||
|
||||
### Template de Test Python
|
||||
|
||||
```python
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Test: Description du test
|
||||
Auteur: Nom
|
||||
Date: YYYY-MM-DD
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import json
|
||||
import logging
|
||||
from datetime import datetime
|
||||
|
||||
# Configuration du logging
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
async def test_function():
|
||||
"""Fonction de test principale"""
|
||||
logger.info("Début du test")
|
||||
|
||||
try:
|
||||
# Logique de test
|
||||
result = await run_test()
|
||||
|
||||
# Vérification
|
||||
if result:
|
||||
logger.info("Test réussi")
|
||||
return True
|
||||
else:
|
||||
logger.error("Test échoué")
|
||||
return False
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Erreur lors du test: {e}")
|
||||
return False
|
||||
|
||||
async def main():
|
||||
"""Fonction principale"""
|
||||
success = await test_function()
|
||||
exit(0 if success else 1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
```
|
||||
|
||||
## Intégration Continue
|
||||
|
||||
### Automatisation
|
||||
|
||||
Les tests peuvent être intégrés dans un pipeline CI/CD :
|
||||
|
||||
```yaml
|
||||
# Exemple GitHub Actions
|
||||
- name: Run Tests
|
||||
run: |
|
||||
cd tests/
|
||||
./run_all_tests.sh --verbose
|
||||
```
|
||||
|
||||
### Surveillance Continue
|
||||
|
||||
Pour une surveillance continue :
|
||||
|
||||
```bash
|
||||
# Cron job pour tests quotidiens
|
||||
0 2 * * * cd /path/to/4NK_node/tests && ./run_all_tests.sh >> /var/log/4nk_tests.log 2>&1
|
||||
```
|
||||
|
||||
## Support
|
||||
|
||||
Pour obtenir de l'aide :
|
||||
|
||||
1. **Consulter les logs** : `tests/logs/`
|
||||
2. **Vérifier la documentation** : `tests/README.md`
|
||||
3. **Utiliser le mode debug** : `--debug`
|
||||
4. **Consulter les rapports** : `tests/reports/`
|
||||
|
||||
## Évolution
|
||||
|
||||
### Tests de Performance (À venir)
|
||||
|
||||
- Tests de charge
|
||||
- Tests de latence
|
||||
- Tests de débit
|
||||
- Tests de stress
|
||||
|
||||
### Tests de Sécurité (À venir)
|
||||
|
||||
- Tests de vulnérabilités
|
||||
- Tests de pénétration
|
||||
- Tests de configuration
|
||||
|
||||
### Tests d'Interface (À venir)
|
||||
|
||||
- Tests d'API REST
|
||||
- Tests d'interface WebSocket
|
||||
- Tests de compatibilité
|
683
docs/USAGE.md
683
docs/USAGE.md
@ -1,683 +0,0 @@
|
||||
# 📖 Guide d'Utilisation - 4NK_node
|
||||
|
||||
Guide complet pour utiliser l'infrastructure 4NK_node au quotidien.
|
||||
|
||||
## 🚀 Démarrage Quotidien
|
||||
|
||||
### 1. Démarrage Rapide
|
||||
|
||||
```bash
|
||||
# Démarrer l’infrastructure (reverse proxy inclus)
|
||||
sudo docker compose up -d --build
|
||||
|
||||
# Vérifier le statut
|
||||
docker ps
|
||||
```
|
||||
|
||||
### 2. Démarrage Séquentiel
|
||||
|
||||
```bash
|
||||
# Démarrer Tor (si utilisé)
|
||||
sudo docker compose up -d tor
|
||||
|
||||
# Démarrer Bitcoin Core
|
||||
sudo docker compose up -d bitcoin
|
||||
|
||||
# Attendre la synchronisation Bitcoin
|
||||
echo "Attendre la synchronisation Bitcoin (10-30 minutes)..."
|
||||
docker logs bitcoin-signet | grep "progress"
|
||||
|
||||
# Démarrer Blindbit
|
||||
sudo docker compose up -d blindbit
|
||||
|
||||
# Démarrer les relais et le reverse proxy
|
||||
sudo docker compose up -d sdk_relay_1 sdk_relay_2 sdk_relay_3 reverse_proxy
|
||||
```
|
||||
|
||||
### 3. Vérification du Démarrage
|
||||
|
||||
```bash
|
||||
# Vérifier tous les services
|
||||
docker ps
|
||||
|
||||
# Vérifier les logs
|
||||
docker-compose logs --tail=50
|
||||
|
||||
# Vérifier la connectivité
|
||||
./test_final_sync.sh
|
||||
```
|
||||
|
||||
## 🔧 Opérations Quotidiennes
|
||||
|
||||
### 1. Surveillance des Services
|
||||
|
||||
```bash
|
||||
# Statut des services
|
||||
docker ps
|
||||
|
||||
# Logs en temps réel
|
||||
docker-compose logs -f
|
||||
|
||||
# Utilisation des ressources
|
||||
docker stats
|
||||
|
||||
# Espace disque
|
||||
docker system df
|
||||
```
|
||||
|
||||
### 2. Monitoring de la Synchronisation
|
||||
|
||||
```bash
|
||||
# Surveillance de la synchronisation
|
||||
./monitor_sync.sh
|
||||
|
||||
# Test de synchronisation
|
||||
./test_sync_logs.sh
|
||||
|
||||
# Test des messages WebSocket
|
||||
python3 test_websocket_messages.py
|
||||
```
|
||||
|
||||
### 3. Gestion des Logs
|
||||
|
||||
```bash
|
||||
# Logs de tous les services
|
||||
docker-compose logs -f
|
||||
|
||||
# Logs d'un service spécifique
|
||||
docker logs bitcoin-signet
|
||||
docker logs blindbit-oracle
|
||||
docker logs sdk_relay_1
|
||||
|
||||
# Logs avec timestamps
|
||||
docker-compose logs -t
|
||||
|
||||
# Logs depuis une date
|
||||
docker-compose logs --since="2024-01-01T00:00:00"
|
||||
|
||||
# Logs des 100 dernières lignes
|
||||
docker-compose logs --tail=100
|
||||
```
|
||||
|
||||
## 🌐 Utilisation via reverse proxy
|
||||
|
||||
### 1. Configuration des Relais
|
||||
|
||||
L'infrastructure utilise 3 relais locaux :
|
||||
|
||||
Les accès externes se font via le reverse proxy unique :
|
||||
|
||||
- UI : `https://<IP_VM>/`
|
||||
- API : `https://<IP_VM>/api/`
|
||||
- WebSocket : `wss://<IP_VM>/ws/`
|
||||
- Signer WS : `wss://<IP_VM>/signer/ws/`
|
||||
- Storage : `https://<IP_VM>/storage/`
|
||||
|
||||
### 2. Test de Connectivité des Relais
|
||||
|
||||
```bash
|
||||
# Test de connectivité de base
|
||||
./test_final_sync.sh
|
||||
|
||||
# Test de synchronisation
|
||||
./test_sync_logs.sh
|
||||
|
||||
# Test des messages WebSocket
|
||||
python3 test_websocket_messages.py
|
||||
|
||||
# Test de charge
|
||||
python3 test_websocket_messages.py --load-test
|
||||
```
|
||||
|
||||
### 3. Utilisation de sdk_storage
|
||||
|
||||
```bash
|
||||
# Stocker une valeur (exemple)
|
||||
curl -k -H 'Content-Type: application/json' \
|
||||
-X POST https://<IP_VM>/storage/store \
|
||||
-d '{"key":"<64 hex>","value":"<hex>","ttl":120}'
|
||||
|
||||
# Récupérer une valeur
|
||||
curl -k https://<IP_VM>/storage/retrieve/<64 hex>
|
||||
```
|
||||
|
||||
### 4. Surveillance de la Synchronisation
|
||||
|
||||
```bash
|
||||
# Surveillance en temps réel
|
||||
./monitor_sync.sh
|
||||
|
||||
# Test de synchronisation forcé
|
||||
./test_sync_logs.sh force
|
||||
|
||||
# Test de synchronisation en continu
|
||||
./test_sync_logs.sh continuous
|
||||
```
|
||||
|
||||
## 🔗 Connexion aux Services
|
||||
|
||||
### 1. Bitcoin Core RPC
|
||||
|
||||
```bash
|
||||
# Connexion via curl
|
||||
curl -u bitcoin:your_password --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getblockchaininfo", "params": []}' -H 'content-type: text/plain;' http://localhost:18443/
|
||||
|
||||
# Connexion via bitcoin-cli
|
||||
docker exec bitcoin-signet bitcoin-cli -signet getblockchaininfo
|
||||
|
||||
# Vérifier la synchronisation
|
||||
docker exec bitcoin-signet bitcoin-cli -signet getblockchaininfo | jq '.verificationprogress'
|
||||
```
|
||||
|
||||
### 2. Blindbit API
|
||||
|
||||
```bash
|
||||
# Test de connectivité
|
||||
curl -s http://localhost:8000/
|
||||
|
||||
# Vérifier le statut
|
||||
curl -s http://localhost:8000/status
|
||||
|
||||
# Obtenir des filtres
|
||||
curl -s http://localhost:8000/filters
|
||||
```
|
||||
|
||||
### 3. sdk_relay WebSocket
|
||||
|
||||
```bash
|
||||
# Test de connectivité WebSocket
|
||||
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 avec Python
|
||||
python3 test_websocket_messages.py
|
||||
```
|
||||
|
||||
## 🧪 Tests et Validation
|
||||
|
||||
### 1. Tests de Base
|
||||
|
||||
```bash
|
||||
# Test de connectivité complet
|
||||
./test_final_sync.sh
|
||||
|
||||
# Test de synchronisation
|
||||
./test_sync_logs.sh
|
||||
|
||||
# Test des messages
|
||||
./test_messages.sh
|
||||
|
||||
# Test des 3 relais
|
||||
./test_3_relays.sh
|
||||
```
|
||||
|
||||
### 2. Tests 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)"
|
||||
|
||||
# Test de performance
|
||||
docker stats --no-stream
|
||||
```
|
||||
|
||||
### 3. Tests de Sécurité
|
||||
|
||||
```bash
|
||||
# Vérifier les ports exposés
|
||||
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
|
||||
```
|
||||
|
||||
## 🔧 Configuration et Maintenance
|
||||
|
||||
### 1. Modification de Configuration
|
||||
|
||||
```bash
|
||||
# Modifier la configuration Bitcoin Core
|
||||
sudo docker-compose down
|
||||
nano bitcoin/bitcoin.conf
|
||||
sudo docker-compose up -d bitcoin
|
||||
|
||||
# Modifier la configuration Blindbit
|
||||
nano blindbit/blindbit.toml
|
||||
sudo docker-compose restart blindbit
|
||||
|
||||
# Modifier la configuration des relais
|
||||
nano sdk_relay/.conf.docker.relay1
|
||||
sudo docker-compose restart sdk_relay_1
|
||||
```
|
||||
|
||||
### 2. Redémarrage des Services
|
||||
|
||||
```bash
|
||||
# Redémarrage complet
|
||||
./restart_4nk_node.sh
|
||||
|
||||
# Redémarrage d'un service spécifique
|
||||
docker-compose restart bitcoin
|
||||
docker-compose restart blindbit
|
||||
docker-compose restart sdk_relay_1
|
||||
|
||||
# Redémarrage avec reconstruction
|
||||
docker-compose down
|
||||
docker-compose build --no-cache
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
### 3. Sauvegarde et Restauration
|
||||
|
||||
```bash
|
||||
# Sauvegarde 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/
|
||||
|
||||
# Sauvegarde 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 /
|
||||
```
|
||||
|
||||
## 🌐 Gestion des Nœuds Externes
|
||||
|
||||
### 1. Ajout de Nœuds Externes
|
||||
|
||||
```bash
|
||||
# Ajouter un nœud externe
|
||||
./add_external_node.sh add external-relay-1 external-relay-1.example.com:8090
|
||||
|
||||
# Lister les nœuds configurés
|
||||
./add_external_node.sh list
|
||||
|
||||
# Tester la connectivité
|
||||
./add_external_node.sh test external-relay-1
|
||||
|
||||
# Supprimer un nœud
|
||||
./add_external_node.sh remove external-relay-1
|
||||
```
|
||||
|
||||
### 2. Configuration Multi-Sites
|
||||
|
||||
```bash
|
||||
# Site principal
|
||||
./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
|
||||
```
|
||||
|
||||
### 3. Test d'Intégration
|
||||
|
||||
```bash
|
||||
# Test d'intégration complet
|
||||
./test_integration_dev3.sh
|
||||
|
||||
# Test de connectivité dev3
|
||||
python3 test_dev3_simple.py
|
||||
|
||||
# Test de connectivité avancé
|
||||
python3 test_dev3_connectivity.py
|
||||
```
|
||||
|
||||
## 📊 Monitoring et Alertes
|
||||
|
||||
### 1. Monitoring de Base
|
||||
|
||||
```bash
|
||||
# Surveillance de la synchronisation
|
||||
./monitor_sync.sh
|
||||
|
||||
# Monitoring en 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
|
||||
```
|
||||
|
||||
### 2. Monitoring Avancé
|
||||
|
||||
```bash
|
||||
# Script de monitoring complet
|
||||
cat > monitor_advanced.sh << 'EOF'
|
||||
#!/bin/bash
|
||||
while true; do
|
||||
clear
|
||||
echo "=== 4NK_node Monitoring ==="
|
||||
echo "Date: $(date)"
|
||||
echo ""
|
||||
|
||||
echo "Services:"
|
||||
docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
|
||||
echo ""
|
||||
|
||||
echo "Ressources:"
|
||||
docker stats --no-stream | grep -E "(sdk_relay|bitcoin|blindbit)"
|
||||
echo ""
|
||||
|
||||
echo "Connexions WebSocket:"
|
||||
netstat -an | grep :8090 | wc -l
|
||||
echo ""
|
||||
|
||||
echo "Espace disque:"
|
||||
df -h | grep -E "(bitcoin|blindbit)"
|
||||
echo ""
|
||||
|
||||
sleep 60
|
||||
done
|
||||
EOF
|
||||
|
||||
chmod +x monitor_advanced.sh
|
||||
./monitor_advanced.sh
|
||||
```
|
||||
|
||||
### 3. Alertes Automatiques
|
||||
|
||||
```bash
|
||||
# Script d'alerte simple
|
||||
cat > alert_monitor.sh << 'EOF'
|
||||
#!/bin/bash
|
||||
|
||||
# Vérifier Bitcoin Core
|
||||
if ! docker ps | grep -q "bitcoin-signet.*Up"; then
|
||||
echo "ALERTE: Bitcoin Core n'est pas en cours d'exécution!"
|
||||
fi
|
||||
|
||||
# Vérifier les relais
|
||||
for i in {1..3}; do
|
||||
if ! docker ps | grep -q "sdk_relay_$i.*Up"; then
|
||||
echo "ALERTE: Relay $i n'est pas en cours d'exécution!"
|
||||
fi
|
||||
done
|
||||
|
||||
# Vérifier l'espace disque
|
||||
if [ $(df / | awk 'NR==2 {print $5}' | sed 's/%//') -gt 90 ]; then
|
||||
echo "ALERTE: Espace disque faible!"
|
||||
fi
|
||||
EOF
|
||||
|
||||
chmod +x alert_monitor.sh
|
||||
|
||||
# Ajouter au cron pour surveillance automatique
|
||||
echo "*/5 * * * * /path/to/alert_monitor.sh" | crontab -
|
||||
```
|
||||
|
||||
## 🔒 Sécurité
|
||||
|
||||
### 1. Vérification de Sécurité
|
||||
|
||||
```bash
|
||||
# Vérifier les ports exposés
|
||||
netstat -tuln | grep -E "(8090|8092|8094)"
|
||||
|
||||
# Vérifier les permissions
|
||||
ls -la sdk_relay/.conf*
|
||||
ls -la bitcoin/bitcoin.conf
|
||||
ls -la blindbit/blindbit.toml
|
||||
|
||||
# Vérifier les logs de sécurité
|
||||
docker logs sdk_relay_1 | grep -E "(ERROR|WARN|SECURITY)" | tail -20
|
||||
```
|
||||
|
||||
### 2. 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
|
||||
```
|
||||
|
||||
### 3. Rotation des Logs
|
||||
|
||||
```bash
|
||||
# Configuration de rotation des logs
|
||||
cat > /etc/logrotate.d/4nk-node << EOF
|
||||
/var/lib/docker/containers/*/*.log {
|
||||
daily
|
||||
rotate 7
|
||||
compress
|
||||
delaycompress
|
||||
missingok
|
||||
notifempty
|
||||
copytruncate
|
||||
}
|
||||
EOF
|
||||
```
|
||||
|
||||
## 🚨 Dépannage
|
||||
|
||||
### 1. Problèmes Courants
|
||||
|
||||
#### Service Ne Démarre Pas
|
||||
|
||||
```bash
|
||||
# Vérifier les logs
|
||||
docker logs <service_name>
|
||||
|
||||
# Vérifier la configuration
|
||||
docker exec <service_name> cat /path/to/config
|
||||
|
||||
# Redémarrer le service
|
||||
docker restart <service_name>
|
||||
```
|
||||
|
||||
#### Problèmes de Connectivité
|
||||
|
||||
```bash
|
||||
# Tester la connectivité réseau
|
||||
docker exec <service_name> ping <target>
|
||||
|
||||
# Vérifier la résolution DNS
|
||||
docker exec <service_name> nslookup <target>
|
||||
|
||||
# Tester les ports
|
||||
docker exec <service_name> nc -z <target> <port>
|
||||
```
|
||||
|
||||
#### Problèmes de Synchronisation
|
||||
|
||||
```bash
|
||||
# Vérifier les logs de synchronisation
|
||||
docker logs sdk_relay_1 | grep -E "(Sync|Relay|Mesh)"
|
||||
|
||||
# Forcer la synchronisation
|
||||
docker restart sdk_relay_1 sdk_relay_2 sdk_relay_3
|
||||
|
||||
# Vérifier la connectivité entre relais
|
||||
./test_sync_logs.sh force
|
||||
```
|
||||
|
||||
### 2. Logs de Debug
|
||||
|
||||
```bash
|
||||
# Logs détaillés
|
||||
docker-compose logs -f --tail=100
|
||||
|
||||
# Logs d'un service spécifique
|
||||
docker logs <service_name> -f
|
||||
|
||||
# Logs avec timestamps
|
||||
docker-compose logs -t
|
||||
|
||||
# Logs depuis une date
|
||||
docker-compose logs --since="2024-01-01T00:00:00"
|
||||
```
|
||||
|
||||
### 3. Outils de Debug
|
||||
|
||||
```bash
|
||||
# Debug du container sdk_relay
|
||||
./sdk_relay/debug_container.sh
|
||||
|
||||
# Test du healthcheck
|
||||
./sdk_relay/test_healthcheck.sh
|
||||
|
||||
# Test de connectivité
|
||||
./sdk_relay/test_connectivity.sh
|
||||
|
||||
# Test simple
|
||||
./sdk_relay/test_simple.sh
|
||||
```
|
||||
|
||||
## 📈 Performance
|
||||
|
||||
### 1. Optimisation
|
||||
|
||||
```bash
|
||||
# Limiter l'utilisation CPU
|
||||
docker-compose up -d --scale bitcoin=1
|
||||
|
||||
# Optimiser la mémoire
|
||||
docker stats --no-stream | grep sdk_relay
|
||||
|
||||
# Nettoyer l'espace disque
|
||||
docker system prune -f
|
||||
```
|
||||
|
||||
### 2. Monitoring de Performance
|
||||
|
||||
```bash
|
||||
# Surveillance des ressources
|
||||
docker stats
|
||||
|
||||
# Surveillance des connexions
|
||||
netstat -an | grep :8090 | wc -l
|
||||
|
||||
# Surveillance de l'espace disque
|
||||
df -h
|
||||
```
|
||||
|
||||
### 3. Tests de Charge
|
||||
|
||||
```bash
|
||||
# Test de charge simple
|
||||
for i in {1..50}; do
|
||||
python3 test_websocket_messages.py &
|
||||
sleep 0.1
|
||||
done
|
||||
wait
|
||||
|
||||
# Test de charge avancé
|
||||
python3 test_websocket_messages.py --load-test --duration=300
|
||||
```
|
||||
|
||||
## 🔄 Maintenance
|
||||
|
||||
### 1. Sauvegarde Régulière
|
||||
|
||||
```bash
|
||||
# Script de sauvegarde automatique
|
||||
cat > backup_4nk.sh << 'EOF'
|
||||
#!/bin/bash
|
||||
DATE=$(date +%Y%m%d_%H%M%S)
|
||||
BACKUP_DIR="/backup/4nk_node_$DATE"
|
||||
|
||||
mkdir -p $BACKUP_DIR
|
||||
|
||||
# Sauvegarder les configurations
|
||||
cp -r sdk_relay/.conf* $BACKUP_DIR/
|
||||
cp external_nodes.conf $BACKUP_DIR/
|
||||
|
||||
# Sauvegarder les données Bitcoin
|
||||
docker exec bitcoin-signet tar czf /tmp/bitcoin-backup.tar.gz /home/bitcoin/.bitcoin
|
||||
docker cp bitcoin-signet:/tmp/bitcoin-backup.tar.gz $BACKUP_DIR/
|
||||
|
||||
echo "Sauvegarde terminée: $BACKUP_DIR"
|
||||
EOF
|
||||
|
||||
chmod +x backup_4nk.sh
|
||||
```
|
||||
|
||||
### 2. Mise à Jour
|
||||
|
||||
```bash
|
||||
# Mise à jour de l'infrastructure
|
||||
git pull origin main
|
||||
./restart_4nk_node.sh
|
||||
|
||||
# Mise à jour des images
|
||||
docker-compose build --no-cache
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
### 3. Nettoyage
|
||||
|
||||
```bash
|
||||
# Nettoyer les conteneurs arrêtés
|
||||
docker container prune -f
|
||||
|
||||
# Nettoyer les images non utilisées
|
||||
docker image prune -f
|
||||
|
||||
# Nettoyer les volumes non utilisés
|
||||
docker volume prune -f
|
||||
|
||||
# Nettoyer tout
|
||||
docker system prune -a -f
|
||||
```
|
||||
|
||||
## 📝 Checklist Quotidienne
|
||||
|
||||
- [ ] Services démarrés et fonctionnels
|
||||
- [ ] Bitcoin Core synchronisé
|
||||
- [ ] Relais connectés et synchronisés
|
||||
- [ ] Tests de connectivité passés
|
||||
- [ ] Logs vérifiés (pas d'erreurs critiques)
|
||||
- [ ] Ressources système OK
|
||||
- [ ] Sauvegarde effectuée (si nécessaire)
|
||||
- [ ] Monitoring actif
|
||||
|
||||
## 🎯 Commandes Rapides
|
||||
|
||||
```bash
|
||||
# Démarrage rapide
|
||||
./restart_4nk_node.sh
|
||||
|
||||
# Statut des services
|
||||
docker ps
|
||||
|
||||
# Logs en temps réel
|
||||
docker-compose logs -f
|
||||
|
||||
# Test de connectivité
|
||||
./test_final_sync.sh
|
||||
|
||||
# Surveillance
|
||||
./monitor_sync.sh
|
||||
|
||||
# Arrêt propre
|
||||
docker-compose down
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**✨ Infrastructure 4NK_node - Utilisation optimale !**
|
||||
|
||||
|
@ -1,179 +0,0 @@
|
||||
# Script de Gestion des Services 4NK Node
|
||||
|
||||
## Description
|
||||
|
||||
Le script `manage_services.sh` est un outil de gestion complet pour arrêter, nettoyer et relancer tous les services de l'infrastructure 4NK Node. Il utilise Docker Compose pour orchestrer les services et fournit des fonctionnalités de nettoyage et de surveillance.
|
||||
|
||||
## Emplacement
|
||||
|
||||
```
|
||||
4NK_dev/4NK_node/scripts/manage_services.sh
|
||||
```
|
||||
|
||||
## Fonctionnalités
|
||||
|
||||
### Commandes Disponibles
|
||||
|
||||
| Commande | Description |
|
||||
|----------|-------------|
|
||||
| `stop` | Arrêter tous les services |
|
||||
| `clean` | Arrêter et nettoyer les conteneurs |
|
||||
| `clean-all` | Arrêter, nettoyer conteneurs et volumes |
|
||||
| `start` | Démarrer tous les services |
|
||||
| `restart` | Arrêter, nettoyer et redémarrer (défaut) |
|
||||
| `status` | Afficher le statut des services |
|
||||
| `logs` | Afficher les logs en temps réel |
|
||||
| `help` | Afficher l'aide |
|
||||
|
||||
### Services Gérés
|
||||
|
||||
Le script gère les services suivants définis dans `docker-compose.yml` :
|
||||
|
||||
- **tor-proxy** : Proxy Tor pour l'anonymat
|
||||
- **bitcoin-signet** : Nœud Bitcoin Core (signet)
|
||||
- **blindbit-oracle** : Oracle BlindBit
|
||||
- **sdk_relay_1/2/3** : Trois instances de relais SDK
|
||||
- **sdk-storage** : Service de stockage
|
||||
- **4nk-ihm-client** : Interface utilisateur
|
||||
- **4nk-reverse-proxy** : Proxy inverse Nginx
|
||||
|
||||
## Utilisation
|
||||
|
||||
### Redémarrage Complet (Recommandé)
|
||||
|
||||
```bash
|
||||
./scripts/manage_services.sh
|
||||
# ou
|
||||
./scripts/manage_services.sh restart
|
||||
```
|
||||
|
||||
### Arrêt des Services
|
||||
|
||||
```bash
|
||||
./scripts/manage_services.sh stop
|
||||
```
|
||||
|
||||
### Nettoyage Complet
|
||||
|
||||
```bash
|
||||
./scripts/manage_services.sh clean-all
|
||||
```
|
||||
|
||||
**⚠️ Attention** : Cette commande supprime TOUTES les données persistantes !
|
||||
|
||||
### Vérification du Statut
|
||||
|
||||
```bash
|
||||
./scripts/manage_services.sh status
|
||||
```
|
||||
|
||||
### Surveillance des Logs
|
||||
|
||||
```bash
|
||||
./scripts/manage_services.sh logs
|
||||
```
|
||||
|
||||
## Fonctionnalités Avancées
|
||||
|
||||
### Nettoyage Intelligent
|
||||
|
||||
Le script effectue un nettoyage intelligent en supprimant :
|
||||
- Conteneurs arrêtés
|
||||
- Images non utilisées
|
||||
- Volumes non utilisés
|
||||
- Réseaux non utilisés
|
||||
|
||||
### Attente des Services Critiques
|
||||
|
||||
Le script attend automatiquement que les services critiques soient prêts :
|
||||
- Tor Proxy
|
||||
- Bitcoin Core
|
||||
- BlindBit Oracle
|
||||
|
||||
### Gestion des Erreurs
|
||||
|
||||
- Vérification de la présence de Docker
|
||||
- Vérification du daemon Docker
|
||||
- Vérification de Docker Compose
|
||||
- Arrêt en cas d'erreur (`set -e`)
|
||||
|
||||
## Configuration
|
||||
|
||||
### Variables d'Environnement
|
||||
|
||||
Le script utilise les variables suivantes :
|
||||
|
||||
```bash
|
||||
PROJECT_NAME="4NK Node"
|
||||
PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
COMPOSE_FILE="$PROJECT_DIR/docker-compose.yml"
|
||||
```
|
||||
|
||||
### Couleurs d'Affichage
|
||||
|
||||
Le script utilise des couleurs pour améliorer la lisibilité :
|
||||
- 🔵 Bleu : En-têtes
|
||||
- 🟢 Vert : Succès
|
||||
- 🟡 Jaune : Avertissements
|
||||
- 🔴 Rouge : Erreurs
|
||||
- 🟣 Violet : Informations
|
||||
- 🔵 Cyan : Étapes en cours
|
||||
|
||||
## Dépannage
|
||||
|
||||
### Problèmes Courants
|
||||
|
||||
1. **Docker non installé**
|
||||
```
|
||||
❌ Docker n'est pas installé ou n'est pas dans le PATH
|
||||
```
|
||||
|
||||
2. **Daemon Docker non démarré**
|
||||
```
|
||||
❌ Docker daemon n'est pas en cours d'exécution
|
||||
```
|
||||
|
||||
3. **Docker Compose non disponible**
|
||||
```
|
||||
❌ Docker Compose n'est pas installé ou n'est pas dans le PATH
|
||||
```
|
||||
|
||||
### Logs de Construction
|
||||
|
||||
En cas de problème lors de la construction des images, utilisez :
|
||||
|
||||
```bash
|
||||
docker compose -f docker-compose.yml build --no-cache --progress=plain
|
||||
```
|
||||
|
||||
## Notes Techniques
|
||||
|
||||
### Services Temporairement Désactivés
|
||||
|
||||
Le service `sdk_signer` est temporairement désactivé en raison de dépendances manquantes (module `../pkg/sdk_client`).
|
||||
|
||||
### Volumes Persistants
|
||||
|
||||
Les volumes suivants sont préservés lors du redémarrage :
|
||||
- `4nk_node_bitcoin_data`
|
||||
- `4nk_node_blindbit_data`
|
||||
- `4nk_node_sdk_relay_1_data`
|
||||
- `4nk_node_sdk_relay_2_data`
|
||||
- `4nk_node_sdk_relay_3_data`
|
||||
- `4nk_node_sdk_storage_data`
|
||||
- `4nk_node_sdk_signer_data`
|
||||
|
||||
### Réseau Docker
|
||||
|
||||
Le script utilise le réseau `4nk_node_btcnet` pour la communication inter-services.
|
||||
|
||||
## Historique des Modifications
|
||||
|
||||
- **2025-08-29** : Création du script avec support Docker Compose v2
|
||||
- Correction des chemins de build pour sdk_storage et sdk_signer
|
||||
- Désactivation temporaire du service sdk_signer
|
||||
- Ajout de la documentation complète
|
||||
|
||||
## Auteur
|
||||
|
||||
Script créé pour l'infrastructure 4NK Node.
|
6771
ihm_client/dist/account-component-DE4nz5rE.mjs
vendored
6771
ihm_client/dist/account-component-DE4nz5rE.mjs
vendored
File diff suppressed because one or more lines are too long
6
ihm_client/dist/document.utils-SxcZpxzG.mjs
vendored
6
ihm_client/dist/document.utils-SxcZpxzG.mjs
vendored
@ -1,6 +0,0 @@
|
||||
function getCorrectDOM(componentTag) {
|
||||
const dom = document?.querySelector(componentTag)?.shadowRoot || document;
|
||||
return dom;
|
||||
}
|
||||
|
||||
export { getCorrectDOM as g };
|
9546
ihm_client/dist/index-C1Gp83RD.mjs
vendored
9546
ihm_client/dist/index-C1Gp83RD.mjs
vendored
File diff suppressed because one or more lines are too long
13
ihm_client/dist/index.html
vendored
13
ihm_client/dist/index.html
vendored
@ -1,13 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>4NK UI</title>
|
||||
<link rel="stylesheet" href="/style.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/index.js"></script>
|
||||
</body>
|
||||
</html>
|
1
ihm_client/dist/index.js
vendored
1
ihm_client/dist/index.js
vendored
@ -1 +0,0 @@
|
||||
export { D as Database, M as MessageType, S as Services } from './index-C1Gp83RD.mjs';
|
14
ihm_client/dist/process-element-BXlOpT8a.mjs
vendored
14
ihm_client/dist/process-element-BXlOpT8a.mjs
vendored
@ -1,14 +0,0 @@
|
||||
import { S as Services } from './index-C1Gp83RD.mjs';
|
||||
import { g as getCorrectDOM } from './document.utils-SxcZpxzG.mjs';
|
||||
|
||||
async function initProcessElement(id, zone) {
|
||||
await getProcesses();
|
||||
getCorrectDOM("process-4nk-component");
|
||||
}
|
||||
async function getProcesses() {
|
||||
const service = await Services.getInstance();
|
||||
const processes = await service.getProcesses();
|
||||
return processes;
|
||||
}
|
||||
|
||||
export { initProcessElement };
|
100
ihm_client/dist/qr-scanner-worker.min-Dy0qkKA4.mjs
vendored
100
ihm_client/dist/qr-scanner-worker.min-Dy0qkKA4.mjs
vendored
@ -1,100 +0,0 @@
|
||||
const createWorker=()=>new Worker(URL.createObjectURL(new Blob([`class x{constructor(a,b){this.width=b;this.height=a.length/b;this.data=a}static createEmpty(a,b){return new x(new Uint8ClampedArray(a*b),a)}get(a,b){return 0>a||a>=this.width||0>b||b>=this.height?!1:!!this.data[b*this.width+a]}set(a,b,c){this.data[b*this.width+a]=c?1:0}setRegion(a,b,c,d,e){for(let f=b;f<b+d;f++)for(let g=a;g<a+c;g++)this.set(g,f,!!e)}}
|
||||
class A{constructor(a,b,c){this.width=a;a*=b;if(c&&c.length!==a)throw Error("Wrong buffer size");this.data=c||new Uint8ClampedArray(a)}get(a,b){return this.data[b*this.width+a]}set(a,b,c){this.data[b*this.width+a]=c}}
|
||||
class ba{constructor(a){this.bitOffset=this.byteOffset=0;this.bytes=a}readBits(a){if(1>a||32<a||a>this.available())throw Error("Cannot read "+a.toString()+" bits");var b=0;if(0<this.bitOffset){b=8-this.bitOffset;var c=a<b?a:b;b-=c;b=(this.bytes[this.byteOffset]&255>>8-c<<b)>>b;a-=c;this.bitOffset+=c;8===this.bitOffset&&(this.bitOffset=0,this.byteOffset++)}if(0<a){for(;8<=a;)b=b<<8|this.bytes[this.byteOffset]&255,this.byteOffset++,a-=8;0<a&&(c=8-a,b=b<<a|(this.bytes[this.byteOffset]&255>>c<<c)>>c,
|
||||
this.bitOffset+=a)}return b}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}var B,C=B||(B={});C.Numeric="numeric";C.Alphanumeric="alphanumeric";C.Byte="byte";C.Kanji="kanji";C.ECI="eci";C.StructuredAppend="structuredappend";var D,E=D||(D={});E[E.Terminator=0]="Terminator";E[E.Numeric=1]="Numeric";E[E.Alphanumeric=2]="Alphanumeric";E[E.Byte=4]="Byte";E[E.Kanji=8]="Kanji";E[E.ECI=7]="ECI";E[E.StructuredAppend=3]="StructuredAppend";let F="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:".split("");
|
||||
function ca(a,b){let c=[],d="";b=a.readBits([8,16,16][b]);for(let e=0;e<b;e++){let f=a.readBits(8);c.push(f)}try{d+=decodeURIComponent(c.map(e=>\`%\${("0"+e.toString(16)).substr(-2)}\`).join(""))}catch(e){}return{bytes:c,text:d}}
|
||||
function da(a,b){a=new ba(a);let c=9>=b?0:26>=b?1:2;for(b={text:"",bytes:[],chunks:[],version:b};4<=a.available();){var d=a.readBits(4);if(d===D.Terminator)return b;if(d===D.ECI)0===a.readBits(1)?b.chunks.push({type:B.ECI,assignmentNumber:a.readBits(7)}):0===a.readBits(1)?b.chunks.push({type:B.ECI,assignmentNumber:a.readBits(14)}):0===a.readBits(1)?b.chunks.push({type:B.ECI,assignmentNumber:a.readBits(21)}):b.chunks.push({type:B.ECI,assignmentNumber:-1});else if(d===D.Numeric){var e=a,f=[];d="";for(var g=
|
||||
e.readBits([10,12,14][c]);3<=g;){var h=e.readBits(10);if(1E3<=h)throw Error("Invalid numeric value above 999");var k=Math.floor(h/100),m=Math.floor(h/10)%10;h%=10;f.push(48+k,48+m,48+h);d+=k.toString()+m.toString()+h.toString();g-=3}if(2===g){g=e.readBits(7);if(100<=g)throw Error("Invalid numeric value above 99");e=Math.floor(g/10);g%=10;f.push(48+e,48+g);d+=e.toString()+g.toString()}else if(1===g){e=e.readBits(4);if(10<=e)throw Error("Invalid numeric value above 9");f.push(48+e);d+=e.toString()}b.text+=
|
||||
d;b.bytes.push(...f);b.chunks.push({type:B.Numeric,text:d})}else if(d===D.Alphanumeric){e=a;f=[];d="";for(g=e.readBits([9,11,13][c]);2<=g;)m=e.readBits(11),k=Math.floor(m/45),m%=45,f.push(F[k].charCodeAt(0),F[m].charCodeAt(0)),d+=F[k]+F[m],g-=2;1===g&&(e=e.readBits(6),f.push(F[e].charCodeAt(0)),d+=F[e]);b.text+=d;b.bytes.push(...f);b.chunks.push({type:B.Alphanumeric,text:d})}else if(d===D.Byte)d=ca(a,c),b.text+=d.text,b.bytes.push(...d.bytes),b.chunks.push({type:B.Byte,bytes:d.bytes,text:d.text});
|
||||
else if(d===D.Kanji){f=a;d=[];e=f.readBits([8,10,12][c]);for(g=0;g<e;g++)k=f.readBits(13),k=Math.floor(k/192)<<8|k%192,k=7936>k?k+33088:k+49472,d.push(k>>8,k&255);f=(new TextDecoder("shift-jis")).decode(Uint8Array.from(d));b.text+=f;b.bytes.push(...d);b.chunks.push({type:B.Kanji,bytes:d,text:f})}else d===D.StructuredAppend&&b.chunks.push({type:B.StructuredAppend,currentSequence:a.readBits(4),totalSequence:a.readBits(4),parity:a.readBits(8)})}if(0===a.available()||0===a.readBits(a.available()))return b}
|
||||
class G{constructor(a,b){if(0===b.length)throw Error("No coefficients.");this.field=a;let c=b.length;if(1<c&&0===b[0]){let d=1;for(;d<c&&0===b[d];)d++;if(d===c)this.coefficients=a.zero.coefficients;else for(this.coefficients=new Uint8ClampedArray(c-d),a=0;a<this.coefficients.length;a++)this.coefficients[a]=b[d+a]}else this.coefficients=b}degree(){return this.coefficients.length-1}isZero(){return 0===this.coefficients[0]}getCoefficient(a){return this.coefficients[this.coefficients.length-1-a]}addOrSubtract(a){if(this.isZero())return a;
|
||||
if(a.isZero())return this;let b=this.coefficients;a=a.coefficients;b.length>a.length&&([b,a]=[a,b]);let c=new Uint8ClampedArray(a.length),d=a.length-b.length;for(var e=0;e<d;e++)c[e]=a[e];for(e=d;e<a.length;e++)c[e]=b[e-d]^a[e];return new G(this.field,c)}multiply(a){if(0===a)return this.field.zero;if(1===a)return this;let b=this.coefficients.length,c=new Uint8ClampedArray(b);for(let d=0;d<b;d++)c[d]=this.field.multiply(this.coefficients[d],a);return new G(this.field,c)}multiplyPoly(a){if(this.isZero()||
|
||||
a.isZero())return this.field.zero;let b=this.coefficients,c=b.length;a=a.coefficients;let d=a.length,e=new Uint8ClampedArray(c+d-1);for(let f=0;f<c;f++){let g=b[f];for(let h=0;h<d;h++)e[f+h]=H(e[f+h],this.field.multiply(g,a[h]))}return new G(this.field,e)}multiplyByMonomial(a,b){if(0>a)throw Error("Invalid degree less than 0");if(0===b)return this.field.zero;let c=this.coefficients.length;a=new Uint8ClampedArray(c+a);for(let d=0;d<c;d++)a[d]=this.field.multiply(this.coefficients[d],b);return new G(this.field,
|
||||
a)}evaluateAt(a){let b=0;if(0===a)return this.getCoefficient(0);let c=this.coefficients.length;if(1===a)return this.coefficients.forEach(d=>{b^=d}),b;b=this.coefficients[0];for(let d=1;d<c;d++)b=H(this.field.multiply(a,b),this.coefficients[d]);return b}}function H(a,b){return a^b}
|
||||
class ea{constructor(a,b,c){this.primitive=a;this.size=b;this.generatorBase=c;this.expTable=Array(this.size);this.logTable=Array(this.size);a=1;for(b=0;b<this.size;b++)this.expTable[b]=a,a*=2,a>=this.size&&(a=(a^this.primitive)&this.size-1);for(a=0;a<this.size-1;a++)this.logTable[this.expTable[a]]=a;this.zero=new G(this,Uint8ClampedArray.from([0]));this.one=new G(this,Uint8ClampedArray.from([1]))}multiply(a,b){return 0===a||0===b?0:this.expTable[(this.logTable[a]+this.logTable[b])%(this.size-1)]}inverse(a){if(0===
|
||||
a)throw Error("Can't invert 0");return this.expTable[this.size-this.logTable[a]-1]}buildMonomial(a,b){if(0>a)throw Error("Invalid monomial degree less than 0");if(0===b)return this.zero;a=new Uint8ClampedArray(a+1);a[0]=b;return new G(this,a)}log(a){if(0===a)throw Error("Can't take log(0)");return this.logTable[a]}exp(a){return this.expTable[a]}}
|
||||
function fa(a,b,c,d){b.degree()<c.degree()&&([b,c]=[c,b]);let e=a.zero;for(var f=a.one;c.degree()>=d/2;){var g=b;let h=e;b=c;e=f;if(b.isZero())return null;c=g;f=a.zero;g=b.getCoefficient(b.degree());for(g=a.inverse(g);c.degree()>=b.degree()&&!c.isZero();){let k=c.degree()-b.degree(),m=a.multiply(c.getCoefficient(c.degree()),g);f=f.addOrSubtract(a.buildMonomial(k,m));c=c.addOrSubtract(b.multiplyByMonomial(k,m))}f=f.multiplyPoly(e).addOrSubtract(h);if(c.degree()>=b.degree())return null}d=f.getCoefficient(0);
|
||||
if(0===d)return null;a=a.inverse(d);return[f.multiply(a),c.multiply(a)]}
|
||||
function ha(a,b){let c=new Uint8ClampedArray(a.length);c.set(a);a=new ea(285,256,0);var d=new G(a,c),e=new Uint8ClampedArray(b),f=!1;for(var g=0;g<b;g++){var h=d.evaluateAt(a.exp(g+a.generatorBase));e[e.length-1-g]=h;0!==h&&(f=!0)}if(!f)return c;d=new G(a,e);d=fa(a,a.buildMonomial(b,1),d,b);if(null===d)return null;b=d[0];g=b.degree();if(1===g)b=[b.getCoefficient(1)];else{e=Array(g);f=0;for(h=1;h<a.size&&f<g;h++)0===b.evaluateAt(h)&&(e[f]=a.inverse(h),f++);b=f!==g?null:e}if(null==b)return null;e=d[1];
|
||||
f=b.length;d=Array(f);for(g=0;g<f;g++){h=a.inverse(b[g]);let k=1;for(let m=0;m<f;m++)g!==m&&(k=a.multiply(k,H(1,a.multiply(b[m],h))));d[g]=a.multiply(e.evaluateAt(h),a.inverse(k));0!==a.generatorBase&&(d[g]=a.multiply(d[g],h))}for(e=0;e<b.length;e++){f=c.length-1-a.log(b[e]);if(0>f)return null;c[f]^=d[e]}return c}
|
||||
let I=[{infoBits:null,versionNumber:1,alignmentPatternCenters:[],errorCorrectionLevels:[{ecCodewordsPerBlock:7,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:10,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:16}]},{ecCodewordsPerBlock:13,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:13}]},{ecCodewordsPerBlock:17,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:9}]}]},{infoBits:null,versionNumber:2,alignmentPatternCenters:[6,18],errorCorrectionLevels:[{ecCodewordsPerBlock:10,ecBlocks:[{numBlocks:1,
|
||||
dataCodewordsPerBlock:34}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:28}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:22}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:16}]}]},{infoBits:null,versionNumber:3,alignmentPatternCenters:[6,22],errorCorrectionLevels:[{ecCodewordsPerBlock:15,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:55}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:18,
|
||||
ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:13}]}]},{infoBits:null,versionNumber:4,alignmentPatternCenters:[6,26],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:80}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:32}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:9}]}]},
|
||||
{infoBits:null,versionNumber:5,alignmentPatternCenters:[6,30],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:43}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:15},{numBlocks:2,dataCodewordsPerBlock:16}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:11},{numBlocks:2,dataCodewordsPerBlock:12}]}]},{infoBits:null,versionNumber:6,alignmentPatternCenters:[6,
|
||||
34],errorCorrectionLevels:[{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:68}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:27}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:15}]}]},{infoBits:31892,versionNumber:7,alignmentPatternCenters:[6,22,38],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:78}]},{ecCodewordsPerBlock:18,
|
||||
ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:31}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:4,dataCodewordsPerBlock:15}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:13},{numBlocks:1,dataCodewordsPerBlock:14}]}]},{infoBits:34236,versionNumber:8,alignmentPatternCenters:[6,24,42],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:97}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:38},
|
||||
{numBlocks:2,dataCodewordsPerBlock:39}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:18},{numBlocks:2,dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:14},{numBlocks:2,dataCodewordsPerBlock:15}]}]},{infoBits:39577,versionNumber:9,alignmentPatternCenters:[6,26,46],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:36},
|
||||
{numBlocks:2,dataCodewordsPerBlock:37}]},{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:16},{numBlocks:4,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:12},{numBlocks:4,dataCodewordsPerBlock:13}]}]},{infoBits:42195,versionNumber:10,alignmentPatternCenters:[6,28,50],errorCorrectionLevels:[{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:68},{numBlocks:2,dataCodewordsPerBlock:69}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,
|
||||
dataCodewordsPerBlock:43},{numBlocks:1,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:19},{numBlocks:2,dataCodewordsPerBlock:20}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:15},{numBlocks:2,dataCodewordsPerBlock:16}]}]},{infoBits:48118,versionNumber:11,alignmentPatternCenters:[6,30,54],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:81}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:1,
|
||||
dataCodewordsPerBlock:50},{numBlocks:4,dataCodewordsPerBlock:51}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:22},{numBlocks:4,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:12},{numBlocks:8,dataCodewordsPerBlock:13}]}]},{infoBits:51042,versionNumber:12,alignmentPatternCenters:[6,32,58],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:92},{numBlocks:2,dataCodewordsPerBlock:93}]},
|
||||
{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:36},{numBlocks:2,dataCodewordsPerBlock:37}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:20},{numBlocks:6,dataCodewordsPerBlock:21}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:14},{numBlocks:4,dataCodewordsPerBlock:15}]}]},{infoBits:55367,versionNumber:13,alignmentPatternCenters:[6,34,62],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:107}]},
|
||||
{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:37},{numBlocks:1,dataCodewordsPerBlock:38}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:20},{numBlocks:4,dataCodewordsPerBlock:21}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:11},{numBlocks:4,dataCodewordsPerBlock:12}]}]},{infoBits:58893,versionNumber:14,alignmentPatternCenters:[6,26,46,66],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:115},
|
||||
{numBlocks:1,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:40},{numBlocks:5,dataCodewordsPerBlock:41}]},{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:16},{numBlocks:5,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:12},{numBlocks:5,dataCodewordsPerBlock:13}]}]},{infoBits:63784,versionNumber:15,alignmentPatternCenters:[6,26,48,70],errorCorrectionLevels:[{ecCodewordsPerBlock:22,
|
||||
ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:87},{numBlocks:1,dataCodewordsPerBlock:88}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:41},{numBlocks:5,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:24},{numBlocks:7,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:12},{numBlocks:7,dataCodewordsPerBlock:13}]}]},{infoBits:68472,versionNumber:16,alignmentPatternCenters:[6,26,50,
|
||||
74],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:98},{numBlocks:1,dataCodewordsPerBlock:99}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:45},{numBlocks:3,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:19},{numBlocks:2,dataCodewordsPerBlock:20}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:15},{numBlocks:13,dataCodewordsPerBlock:16}]}]},{infoBits:70749,
|
||||
versionNumber:17,alignmentPatternCenters:[6,30,54,78],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:107},{numBlocks:5,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:46},{numBlocks:1,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:22},{numBlocks:15,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:17,
|
||||
dataCodewordsPerBlock:15}]}]},{infoBits:76311,versionNumber:18,alignmentPatternCenters:[6,30,56,82],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:120},{numBlocks:1,dataCodewordsPerBlock:121}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:9,dataCodewordsPerBlock:43},{numBlocks:4,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:22},{numBlocks:1,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,
|
||||
dataCodewordsPerBlock:14},{numBlocks:19,dataCodewordsPerBlock:15}]}]},{infoBits:79154,versionNumber:19,alignmentPatternCenters:[6,30,58,86],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:113},{numBlocks:4,dataCodewordsPerBlock:114}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:44},{numBlocks:11,dataCodewordsPerBlock:45}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:21},{numBlocks:4,dataCodewordsPerBlock:22}]},
|
||||
{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:9,dataCodewordsPerBlock:13},{numBlocks:16,dataCodewordsPerBlock:14}]}]},{infoBits:84390,versionNumber:20,alignmentPatternCenters:[6,34,62,90],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:107},{numBlocks:5,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:41},{numBlocks:13,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:24},
|
||||
{numBlocks:5,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:15},{numBlocks:10,dataCodewordsPerBlock:16}]}]},{infoBits:87683,versionNumber:21,alignmentPatternCenters:[6,28,50,72,94],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:116},{numBlocks:4,dataCodewordsPerBlock:117}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:22},
|
||||
{numBlocks:6,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:16},{numBlocks:6,dataCodewordsPerBlock:17}]}]},{infoBits:92361,versionNumber:22,alignmentPatternCenters:[6,26,50,74,98],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:111},{numBlocks:7,dataCodewordsPerBlock:112}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:24},
|
||||
{numBlocks:16,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:34,dataCodewordsPerBlock:13}]}]},{infoBits:96236,versionNumber:23,alignmentPatternCenters:[6,30,54,74,102],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:121},{numBlocks:5,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:47},{numBlocks:14,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:24},
|
||||
{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:16,dataCodewordsPerBlock:15},{numBlocks:14,dataCodewordsPerBlock:16}]}]},{infoBits:102084,versionNumber:24,alignmentPatternCenters:[6,28,54,80,106],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:117},{numBlocks:4,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:45},{numBlocks:14,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,
|
||||
ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:24},{numBlocks:16,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:30,dataCodewordsPerBlock:16},{numBlocks:2,dataCodewordsPerBlock:17}]}]},{infoBits:102881,versionNumber:25,alignmentPatternCenters:[6,32,58,84,110],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:106},{numBlocks:4,dataCodewordsPerBlock:107}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:47},{numBlocks:13,
|
||||
dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:24},{numBlocks:22,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:15},{numBlocks:13,dataCodewordsPerBlock:16}]}]},{infoBits:110507,versionNumber:26,alignmentPatternCenters:[6,30,58,86,114],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:114},{numBlocks:2,dataCodewordsPerBlock:115}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:19,
|
||||
dataCodewordsPerBlock:46},{numBlocks:4,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:28,dataCodewordsPerBlock:22},{numBlocks:6,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:33,dataCodewordsPerBlock:16},{numBlocks:4,dataCodewordsPerBlock:17}]}]},{infoBits:110734,versionNumber:27,alignmentPatternCenters:[6,34,62,90,118],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:122},{numBlocks:4,dataCodewordsPerBlock:123}]},
|
||||
{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:45},{numBlocks:3,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:23},{numBlocks:26,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:15},{numBlocks:28,dataCodewordsPerBlock:16}]}]},{infoBits:117786,versionNumber:28,alignmentPatternCenters:[6,26,50,74,98,122],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:117},
|
||||
{numBlocks:10,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:45},{numBlocks:23,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:24},{numBlocks:31,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:15},{numBlocks:31,dataCodewordsPerBlock:16}]}]},{infoBits:119615,versionNumber:29,alignmentPatternCenters:[6,30,54,78,102,126],errorCorrectionLevels:[{ecCodewordsPerBlock:30,
|
||||
ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:116},{numBlocks:7,dataCodewordsPerBlock:117}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:21,dataCodewordsPerBlock:45},{numBlocks:7,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:23},{numBlocks:37,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:15},{numBlocks:26,dataCodewordsPerBlock:16}]}]},{infoBits:126325,versionNumber:30,alignmentPatternCenters:[6,
|
||||
26,52,78,104,130],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:115},{numBlocks:10,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:47},{numBlocks:10,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:24},{numBlocks:25,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:23,dataCodewordsPerBlock:15},{numBlocks:25,dataCodewordsPerBlock:16}]}]},
|
||||
{infoBits:127568,versionNumber:31,alignmentPatternCenters:[6,30,56,82,108,134],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:115},{numBlocks:3,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:46},{numBlocks:29,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:42,dataCodewordsPerBlock:24},{numBlocks:1,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:23,dataCodewordsPerBlock:15},
|
||||
{numBlocks:28,dataCodewordsPerBlock:16}]}]},{infoBits:133589,versionNumber:32,alignmentPatternCenters:[6,34,60,86,112,138],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:115}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:46},{numBlocks:23,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:24},{numBlocks:35,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,
|
||||
dataCodewordsPerBlock:15},{numBlocks:35,dataCodewordsPerBlock:16}]}]},{infoBits:136944,versionNumber:33,alignmentPatternCenters:[6,30,58,86,114,142],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:115},{numBlocks:1,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:14,dataCodewordsPerBlock:46},{numBlocks:21,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:29,dataCodewordsPerBlock:24},{numBlocks:19,dataCodewordsPerBlock:25}]},
|
||||
{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:15},{numBlocks:46,dataCodewordsPerBlock:16}]}]},{infoBits:141498,versionNumber:34,alignmentPatternCenters:[6,34,62,90,118,146],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:115},{numBlocks:6,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:14,dataCodewordsPerBlock:46},{numBlocks:23,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:44,
|
||||
dataCodewordsPerBlock:24},{numBlocks:7,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:59,dataCodewordsPerBlock:16},{numBlocks:1,dataCodewordsPerBlock:17}]}]},{infoBits:145311,versionNumber:35,alignmentPatternCenters:[6,30,54,78,102,126,150],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:121},{numBlocks:7,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:47},{numBlocks:26,dataCodewordsPerBlock:48}]},
|
||||
{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:39,dataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:15},{numBlocks:41,dataCodewordsPerBlock:16}]}]},{infoBits:150283,versionNumber:36,alignmentPatternCenters:[6,24,50,76,102,128,154],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:121},{numBlocks:14,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,
|
||||
dataCodewordsPerBlock:47},{numBlocks:34,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:46,dataCodewordsPerBlock:24},{numBlocks:10,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:15},{numBlocks:64,dataCodewordsPerBlock:16}]}]},{infoBits:152622,versionNumber:37,alignmentPatternCenters:[6,28,54,80,106,132,158],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:122},{numBlocks:4,dataCodewordsPerBlock:123}]},
|
||||
{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:29,dataCodewordsPerBlock:46},{numBlocks:14,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:49,dataCodewordsPerBlock:24},{numBlocks:10,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:24,dataCodewordsPerBlock:15},{numBlocks:46,dataCodewordsPerBlock:16}]}]},{infoBits:158308,versionNumber:38,alignmentPatternCenters:[6,32,58,84,110,136,162],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,
|
||||
dataCodewordsPerBlock:122},{numBlocks:18,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:46},{numBlocks:32,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:48,dataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:42,dataCodewordsPerBlock:15},{numBlocks:32,dataCodewordsPerBlock:16}]}]},{infoBits:161089,versionNumber:39,alignmentPatternCenters:[6,26,54,82,110,138,166],
|
||||
errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:20,dataCodewordsPerBlock:117},{numBlocks:4,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:40,dataCodewordsPerBlock:47},{numBlocks:7,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:43,dataCodewordsPerBlock:24},{numBlocks:22,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:15},{numBlocks:67,dataCodewordsPerBlock:16}]}]},{infoBits:167017,
|
||||
versionNumber:40,alignmentPatternCenters:[6,30,58,86,114,142,170],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:118},{numBlocks:6,dataCodewordsPerBlock:119}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:18,dataCodewordsPerBlock:47},{numBlocks:31,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:34,dataCodewordsPerBlock:24},{numBlocks:34,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:20,dataCodewordsPerBlock:15},
|
||||
{numBlocks:61,dataCodewordsPerBlock:16}]}]}];function J(a,b){a^=b;for(b=0;a;)b++,a&=a-1;return b}function K(a,b){return b<<1|a}
|
||||
let ia=[{bits:21522,formatInfo:{errorCorrectionLevel:1,dataMask:0}},{bits:20773,formatInfo:{errorCorrectionLevel:1,dataMask:1}},{bits:24188,formatInfo:{errorCorrectionLevel:1,dataMask:2}},{bits:23371,formatInfo:{errorCorrectionLevel:1,dataMask:3}},{bits:17913,formatInfo:{errorCorrectionLevel:1,dataMask:4}},{bits:16590,formatInfo:{errorCorrectionLevel:1,dataMask:5}},{bits:20375,formatInfo:{errorCorrectionLevel:1,dataMask:6}},{bits:19104,formatInfo:{errorCorrectionLevel:1,dataMask:7}},{bits:30660,formatInfo:{errorCorrectionLevel:0,
|
||||
dataMask:0}},{bits:29427,formatInfo:{errorCorrectionLevel:0,dataMask:1}},{bits:32170,formatInfo:{errorCorrectionLevel:0,dataMask:2}},{bits:30877,formatInfo:{errorCorrectionLevel:0,dataMask:3}},{bits:26159,formatInfo:{errorCorrectionLevel:0,dataMask:4}},{bits:25368,formatInfo:{errorCorrectionLevel:0,dataMask:5}},{bits:27713,formatInfo:{errorCorrectionLevel:0,dataMask:6}},{bits:26998,formatInfo:{errorCorrectionLevel:0,dataMask:7}},{bits:5769,formatInfo:{errorCorrectionLevel:3,dataMask:0}},{bits:5054,
|
||||
formatInfo:{errorCorrectionLevel:3,dataMask:1}},{bits:7399,formatInfo:{errorCorrectionLevel:3,dataMask:2}},{bits:6608,formatInfo:{errorCorrectionLevel:3,dataMask:3}},{bits:1890,formatInfo:{errorCorrectionLevel:3,dataMask:4}},{bits:597,formatInfo:{errorCorrectionLevel:3,dataMask:5}},{bits:3340,formatInfo:{errorCorrectionLevel:3,dataMask:6}},{bits:2107,formatInfo:{errorCorrectionLevel:3,dataMask:7}},{bits:13663,formatInfo:{errorCorrectionLevel:2,dataMask:0}},{bits:12392,formatInfo:{errorCorrectionLevel:2,
|
||||
dataMask:1}},{bits:16177,formatInfo:{errorCorrectionLevel:2,dataMask:2}},{bits:14854,formatInfo:{errorCorrectionLevel:2,dataMask:3}},{bits:9396,formatInfo:{errorCorrectionLevel:2,dataMask:4}},{bits:8579,formatInfo:{errorCorrectionLevel:2,dataMask:5}},{bits:11994,formatInfo:{errorCorrectionLevel:2,dataMask:6}},{bits:11245,formatInfo:{errorCorrectionLevel:2,dataMask:7}}],ja=[a=>0===(a.y+a.x)%2,a=>0===a.y%2,a=>0===a.x%3,a=>0===(a.y+a.x)%3,a=>0===(Math.floor(a.y/2)+Math.floor(a.x/3))%2,a=>0===a.x*a.y%
|
||||
2+a.x*a.y%3,a=>0===(a.y*a.x%2+a.y*a.x%3)%2,a=>0===((a.y+a.x)%2+a.y*a.x%3)%2];
|
||||
function ka(a,b,c){c=ja[c.dataMask];let d=a.height;var e=17+4*b.versionNumber;let f=x.createEmpty(e,e);f.setRegion(0,0,9,9,!0);f.setRegion(e-8,0,8,9,!0);f.setRegion(0,e-8,9,8,!0);for(var g of b.alignmentPatternCenters)for(var h of b.alignmentPatternCenters)6===g&&6===h||6===g&&h===e-7||g===e-7&&6===h||f.setRegion(g-2,h-2,5,5,!0);f.setRegion(6,9,1,e-17,!0);f.setRegion(9,6,e-17,1,!0);6<b.versionNumber&&(f.setRegion(e-11,0,3,6,!0),f.setRegion(0,e-11,6,3,!0));b=[];h=g=0;e=!0;for(let k=d-1;0<k;k-=2){6===
|
||||
k&&k--;for(let m=0;m<d;m++){let l=e?d-1-m:m;for(let n=0;2>n;n++){let q=k-n;if(!f.get(q,l)){h++;let r=a.get(q,l);c({y:l,x:q})&&(r=!r);g=g<<1|r;8===h&&(b.push(g),g=h=0)}}}e=!e}return b}
|
||||
function la(a){var b=a.height,c=Math.floor((b-17)/4);if(6>=c)return I[c-1];c=0;for(var d=5;0<=d;d--)for(var e=b-9;e>=b-11;e--)c=K(a.get(e,d),c);d=0;for(e=5;0<=e;e--)for(let g=b-9;g>=b-11;g--)d=K(a.get(e,g),d);a=Infinity;let f;for(let g of I){if(g.infoBits===c||g.infoBits===d)return g;b=J(c,g.infoBits);b<a&&(f=g,a=b);b=J(d,g.infoBits);b<a&&(f=g,a=b)}if(3>=a)return f}
|
||||
function ma(a){let b=0;for(var c=0;8>=c;c++)6!==c&&(b=K(a.get(c,8),b));for(c=7;0<=c;c--)6!==c&&(b=K(a.get(8,c),b));var d=a.height;c=0;for(var e=d-1;e>=d-7;e--)c=K(a.get(8,e),c);for(e=d-8;e<d;e++)c=K(a.get(e,8),c);a=Infinity;d=null;for(let {bits:f,formatInfo:g}of ia){if(f===b||f===c)return g;e=J(b,f);e<a&&(d=g,a=e);b!==c&&(e=J(c,f),e<a&&(d=g,a=e))}return 3>=a?d:null}
|
||||
function na(a,b,c){let d=b.errorCorrectionLevels[c],e=[],f=0;d.ecBlocks.forEach(h=>{for(let k=0;k<h.numBlocks;k++)e.push({numDataCodewords:h.dataCodewordsPerBlock,codewords:[]}),f+=h.dataCodewordsPerBlock+d.ecCodewordsPerBlock});if(a.length<f)return null;a=a.slice(0,f);b=d.ecBlocks[0].dataCodewordsPerBlock;for(c=0;c<b;c++)for(var g of e)g.codewords.push(a.shift());if(1<d.ecBlocks.length)for(g=d.ecBlocks[0].numBlocks,b=d.ecBlocks[1].numBlocks,c=0;c<b;c++)e[g+c].codewords.push(a.shift());for(;0<a.length;)for(let h of e)h.codewords.push(a.shift());
|
||||
return e}function L(a){let b=la(a);if(!b)return null;var c=ma(a);if(!c)return null;a=ka(a,b,c);var d=na(a,b,c.errorCorrectionLevel);if(!d)return null;c=d.reduce((e,f)=>e+f.numDataCodewords,0);c=new Uint8ClampedArray(c);a=0;for(let e of d){d=ha(e.codewords,e.codewords.length-e.numDataCodewords);if(!d)return null;for(let f=0;f<e.numDataCodewords;f++)c[a++]=d[f]}try{return da(c,b.versionNumber)}catch(e){return null}}
|
||||
function M(a,b,c,d){var e=a.x-b.x+c.x-d.x;let f=a.y-b.y+c.y-d.y;if(0===e&&0===f)return{a11:b.x-a.x,a12:b.y-a.y,a13:0,a21:c.x-b.x,a22:c.y-b.y,a23:0,a31:a.x,a32:a.y,a33:1};let g=b.x-c.x;var h=d.x-c.x;let k=b.y-c.y,m=d.y-c.y;c=g*m-h*k;h=(e*m-h*f)/c;e=(g*f-e*k)/c;return{a11:b.x-a.x+h*b.x,a12:b.y-a.y+h*b.y,a13:h,a21:d.x-a.x+e*d.x,a22:d.y-a.y+e*d.y,a23:e,a31:a.x,a32:a.y,a33:1}}
|
||||
function oa(a,b,c,d){a=M(a,b,c,d);return{a11:a.a22*a.a33-a.a23*a.a32,a12:a.a13*a.a32-a.a12*a.a33,a13:a.a12*a.a23-a.a13*a.a22,a21:a.a23*a.a31-a.a21*a.a33,a22:a.a11*a.a33-a.a13*a.a31,a23:a.a13*a.a21-a.a11*a.a23,a31:a.a21*a.a32-a.a22*a.a31,a32:a.a12*a.a31-a.a11*a.a32,a33:a.a11*a.a22-a.a12*a.a21}}
|
||||
function pa(a,b){var c=oa({x:3.5,y:3.5},{x:b.dimension-3.5,y:3.5},{x:b.dimension-6.5,y:b.dimension-6.5},{x:3.5,y:b.dimension-3.5}),d=M(b.topLeft,b.topRight,b.alignmentPattern,b.bottomLeft),e=d.a11*c.a11+d.a21*c.a12+d.a31*c.a13,f=d.a12*c.a11+d.a22*c.a12+d.a32*c.a13,g=d.a13*c.a11+d.a23*c.a12+d.a33*c.a13,h=d.a11*c.a21+d.a21*c.a22+d.a31*c.a23,k=d.a12*c.a21+d.a22*c.a22+d.a32*c.a23,m=d.a13*c.a21+d.a23*c.a22+d.a33*c.a23,l=d.a11*c.a31+d.a21*c.a32+d.a31*c.a33,n=d.a12*c.a31+d.a22*c.a32+d.a32*c.a33,q=d.a13*
|
||||
c.a31+d.a23*c.a32+d.a33*c.a33;c=x.createEmpty(b.dimension,b.dimension);d=(r,u)=>{const p=g*r+m*u+q;return{x:(e*r+h*u+l)/p,y:(f*r+k*u+n)/p}};for(let r=0;r<b.dimension;r++)for(let u=0;u<b.dimension;u++){let p=d(u+.5,r+.5);c.set(u,r,a.get(Math.floor(p.x),Math.floor(p.y)))}return{matrix:c,mappingFunction:d}}let N=(a,b)=>Math.sqrt(Math.pow(b.x-a.x,2)+Math.pow(b.y-a.y,2));function O(a){return a.reduce((b,c)=>b+c)}
|
||||
function qa(a,b,c){let d=N(a,b),e=N(b,c),f=N(a,c),g,h,k;e>=d&&e>=f?[g,h,k]=[b,a,c]:f>=e&&f>=d?[g,h,k]=[a,b,c]:[g,h,k]=[a,c,b];0>(k.x-h.x)*(g.y-h.y)-(k.y-h.y)*(g.x-h.x)&&([g,k]=[k,g]);return{bottomLeft:g,topLeft:h,topRight:k}}
|
||||
function ra(a,b,c,d){d=(O(P(a,c,d,5))/7+O(P(a,b,d,5))/7+O(P(c,a,d,5))/7+O(P(b,a,d,5))/7)/4;if(1>d)throw Error("Invalid module size");b=Math.round(N(a,b)/d);a=Math.round(N(a,c)/d);a=Math.floor((b+a)/2)+7;switch(a%4){case 0:a++;break;case 2:a--}return{dimension:a,moduleSize:d}}
|
||||
function Q(a,b,c,d){let e=[{x:Math.floor(a.x),y:Math.floor(a.y)}];var f=Math.abs(b.y-a.y)>Math.abs(b.x-a.x);if(f){var g=Math.floor(a.y);var h=Math.floor(a.x);a=Math.floor(b.y);b=Math.floor(b.x)}else g=Math.floor(a.x),h=Math.floor(a.y),a=Math.floor(b.x),b=Math.floor(b.y);let k=Math.abs(a-g),m=Math.abs(b-h),l=Math.floor(-k/2),n=g<a?1:-1,q=h<b?1:-1,r=!0;for(let u=g,p=h;u!==a+n;u+=n){g=f?p:u;h=f?u:p;if(c.get(g,h)!==r&&(r=!r,e.push({x:g,y:h}),e.length===d+1))break;l+=m;if(0<l){if(p===b)break;p+=q;l-=k}}c=
|
||||
[];for(f=0;f<d;f++)e[f]&&e[f+1]?c.push(N(e[f],e[f+1])):c.push(0);return c}function P(a,b,c,d){let e=b.y-a.y,f=b.x-a.x;b=Q(a,b,c,Math.ceil(d/2));a=Q(a,{x:a.x-f,y:a.y-e},c,Math.ceil(d/2));c=b.shift()+a.shift()-1;return a.concat(c).concat(...b)}function R(a,b){let c=O(a)/O(b),d=0;b.forEach((e,f)=>{d+=Math.pow(a[f]-e*c,2)});return{averageSize:c,error:d}}
|
||||
function S(a,b,c){try{let d=P(a,{x:-1,y:a.y},c,b.length),e=P(a,{x:a.x,y:-1},c,b.length),f=P(a,{x:Math.max(0,a.x-a.y)-1,y:Math.max(0,a.y-a.x)-1},c,b.length),g=P(a,{x:Math.min(c.width,a.x+a.y)+1,y:Math.min(c.height,a.y+a.x)+1},c,b.length),h=R(d,b),k=R(e,b),m=R(f,b),l=R(g,b),n=(h.averageSize+k.averageSize+m.averageSize+l.averageSize)/4;return Math.sqrt(h.error*h.error+k.error*k.error+m.error*m.error+l.error*l.error)+(Math.pow(h.averageSize-n,2)+Math.pow(k.averageSize-n,2)+Math.pow(m.averageSize-n,2)+
|
||||
Math.pow(l.averageSize-n,2))/n}catch(d){return Infinity}}function T(a,b){for(var c=Math.round(b.x);a.get(c,Math.round(b.y));)c--;for(var d=Math.round(b.x);a.get(d,Math.round(b.y));)d++;c=(c+d)/2;for(d=Math.round(b.y);a.get(Math.round(c),d);)d--;for(b=Math.round(b.y);a.get(Math.round(c),b);)b++;return{x:c,y:(d+b)/2}}
|
||||
function sa(a){var b=[],c=[];let d=[];var e=[];for(let p=0;p<=a.height;p++){var f=0,g=!1;let t=[0,0,0,0,0];for(let v=-1;v<=a.width;v++){var h=a.get(v,p);if(h===g)f++;else{t=[t[1],t[2],t[3],t[4],f];f=1;g=h;var k=O(t)/7;k=Math.abs(t[0]-k)<k&&Math.abs(t[1]-k)<k&&Math.abs(t[2]-3*k)<3*k&&Math.abs(t[3]-k)<k&&Math.abs(t[4]-k)<k&&!h;var m=O(t.slice(-3))/3;h=Math.abs(t[2]-m)<m&&Math.abs(t[3]-m)<m&&Math.abs(t[4]-m)<m&&h;if(k){let z=v-t[3]-t[4],y=z-t[2];k={startX:y,endX:z,y:p};m=c.filter(w=>y>=w.bottom.startX&&
|
||||
y<=w.bottom.endX||z>=w.bottom.startX&&y<=w.bottom.endX||y<=w.bottom.startX&&z>=w.bottom.endX&&1.5>t[2]/(w.bottom.endX-w.bottom.startX)&&.5<t[2]/(w.bottom.endX-w.bottom.startX));0<m.length?m[0].bottom=k:c.push({top:k,bottom:k})}if(h){let z=v-t[4],y=z-t[3];h={startX:y,y:p,endX:z};k=e.filter(w=>y>=w.bottom.startX&&y<=w.bottom.endX||z>=w.bottom.startX&&y<=w.bottom.endX||y<=w.bottom.startX&&z>=w.bottom.endX&&1.5>t[2]/(w.bottom.endX-w.bottom.startX)&&.5<t[2]/(w.bottom.endX-w.bottom.startX));0<k.length?
|
||||
k[0].bottom=h:e.push({top:h,bottom:h})}}}b.push(...c.filter(v=>v.bottom.y!==p&&2<=v.bottom.y-v.top.y));c=c.filter(v=>v.bottom.y===p);d.push(...e.filter(v=>v.bottom.y!==p));e=e.filter(v=>v.bottom.y===p)}b.push(...c.filter(p=>2<=p.bottom.y-p.top.y));d.push(...e);c=[];for(var l of b)2>l.bottom.y-l.top.y||(b=(l.top.startX+l.top.endX+l.bottom.startX+l.bottom.endX)/4,e=(l.top.y+l.bottom.y+1)/2,a.get(Math.round(b),Math.round(e))&&(f=[l.top.endX-l.top.startX,l.bottom.endX-l.bottom.startX,l.bottom.y-l.top.y+
|
||||
1],f=O(f)/f.length,g=S({x:Math.round(b),y:Math.round(e)},[1,1,3,1,1],a),c.push({score:g,x:b,y:e,size:f})));if(3>c.length)return null;c.sort((p,t)=>p.score-t.score);l=[];for(b=0;b<Math.min(c.length,5);++b){e=c[b];f=[];for(var n of c)n!==e&&f.push(Object.assign(Object.assign({},n),{score:n.score+Math.pow(n.size-e.size,2)/e.size}));f.sort((p,t)=>p.score-t.score);l.push({points:[e,f[0],f[1]],score:e.score+f[0].score+f[1].score})}l.sort((p,t)=>p.score-t.score);let {topRight:q,topLeft:r,bottomLeft:u}=qa(...l[0].points);
|
||||
l=U(a,d,q,r,u);n=[];l&&n.push({alignmentPattern:{x:l.alignmentPattern.x,y:l.alignmentPattern.y},bottomLeft:{x:u.x,y:u.y},dimension:l.dimension,topLeft:{x:r.x,y:r.y},topRight:{x:q.x,y:q.y}});l=T(a,q);b=T(a,r);c=T(a,u);(a=U(a,d,l,b,c))&&n.push({alignmentPattern:{x:a.alignmentPattern.x,y:a.alignmentPattern.y},bottomLeft:{x:c.x,y:c.y},topLeft:{x:b.x,y:b.y},topRight:{x:l.x,y:l.y},dimension:a.dimension});return 0===n.length?null:n}
|
||||
function U(a,b,c,d,e){let f,g;try{({dimension:f,moduleSize:g}=ra(d,c,e,a))}catch(l){return null}var h=c.x-d.x+e.x,k=c.y-d.y+e.y;c=(N(d,e)+N(d,c))/2/g;e=1-3/c;let m={x:d.x+e*(h-d.x),y:d.y+e*(k-d.y)};b=b.map(l=>{const n=(l.top.startX+l.top.endX+l.bottom.startX+l.bottom.endX)/4;l=(l.top.y+l.bottom.y+1)/2;if(a.get(Math.floor(n),Math.floor(l))){var q=S({x:Math.floor(n),y:Math.floor(l)},[1,1,1],a)+N({x:n,y:l},m);return{x:n,y:l,score:q}}}).filter(l=>!!l).sort((l,n)=>l.score-n.score);return{alignmentPattern:15<=
|
||||
c&&b.length?b[0]:m,dimension:f}}
|
||||
function V(a){var b=sa(a);if(!b)return null;for(let e of b){b=pa(a,e);var c=b.matrix;if(null==c)c=null;else{var d=L(c);if(d)c=d;else{for(d=0;d<c.width;d++)for(let f=d+1;f<c.height;f++)c.get(d,f)!==c.get(f,d)&&(c.set(d,f,!c.get(d,f)),c.set(f,d,!c.get(f,d)));c=L(c)}}if(c)return{binaryData:c.bytes,data:c.text,chunks:c.chunks,version:c.version,location:{topRightCorner:b.mappingFunction(e.dimension,0),topLeftCorner:b.mappingFunction(0,0),bottomRightCorner:b.mappingFunction(e.dimension,e.dimension),bottomLeftCorner:b.mappingFunction(0,
|
||||
e.dimension),topRightFinderPattern:e.topRight,topLeftFinderPattern:e.topLeft,bottomLeftFinderPattern:e.bottomLeft,bottomRightAlignmentPattern:e.alignmentPattern},matrix:b.matrix}}return null}let ta={inversionAttempts:"attemptBoth",greyScaleWeights:{red:.2126,green:.7152,blue:.0722,useIntegerApproximation:!1},canOverwriteImage:!0};function W(a,b){Object.keys(b).forEach(c=>{a[c]=b[c]})}
|
||||
function X(a,b,c,d={}){let e=Object.create(null);W(e,ta);W(e,d);d="onlyInvert"===e.inversionAttempts||"invertFirst"===e.inversionAttempts;var f="attemptBoth"===e.inversionAttempts||d;var g=e.greyScaleWeights,h=e.canOverwriteImage,k=b*c;if(a.length!==4*k)throw Error("Malformed data passed to binarizer.");var m=0;if(h){var l=new Uint8ClampedArray(a.buffer,m,k);m+=k}l=new A(b,c,l);if(g.useIntegerApproximation)for(var n=0;n<c;n++)for(var q=0;q<b;q++){var r=4*(n*b+q);l.set(q,n,g.red*a[r]+g.green*a[r+1]+
|
||||
g.blue*a[r+2]+128>>8)}else for(n=0;n<c;n++)for(q=0;q<b;q++)r=4*(n*b+q),l.set(q,n,g.red*a[r]+g.green*a[r+1]+g.blue*a[r+2]);g=Math.ceil(b/8);n=Math.ceil(c/8);q=g*n;if(h){var u=new Uint8ClampedArray(a.buffer,m,q);m+=q}u=new A(g,n,u);for(q=0;q<n;q++)for(r=0;r<g;r++){var p=Infinity,t=0;for(var v=0;8>v;v++)for(let w=0;8>w;w++){let aa=l.get(8*r+w,8*q+v);p=Math.min(p,aa);t=Math.max(t,aa)}v=(p+t)/2;v=Math.min(255,1.11*v);24>=t-p&&(v=p/2,0<q&&0<r&&(t=(u.get(r,q-1)+2*u.get(r-1,q)+u.get(r-1,q-1))/4,p<t&&(v=t)));
|
||||
u.set(r,q,v)}h?(q=new Uint8ClampedArray(a.buffer,m,k),m+=k,q=new x(q,b)):q=x.createEmpty(b,c);r=null;f&&(h?(a=new Uint8ClampedArray(a.buffer,m,k),r=new x(a,b)):r=x.createEmpty(b,c));for(b=0;b<n;b++)for(a=0;a<g;a++){c=g-3;c=2>a?2:a>c?c:a;h=n-3;h=2>b?2:b>h?h:b;k=0;for(m=-2;2>=m;m++)for(p=-2;2>=p;p++)k+=u.get(c+m,h+p);c=k/25;for(h=0;8>h;h++)for(k=0;8>k;k++)m=8*a+h,p=8*b+k,t=l.get(m,p),q.set(m,p,t<=c),f&&r.set(m,p,!(t<=c))}f=f?{binarized:q,inverted:r}:{binarized:q};let {binarized:z,inverted:y}=f;(f=V(d?
|
||||
y:z))||"attemptBoth"!==e.inversionAttempts&&"invertFirst"!==e.inversionAttempts||(f=V(d?z:y));return f}X.default=X;let Y="dontInvert",Z={red:77,green:150,blue:29,useIntegerApproximation:!0};
|
||||
self.onmessage=a=>{let b=a.data.id,c=a.data.data;switch(a.data.type){case "decode":(a=X(c.data,c.width,c.height,{inversionAttempts:Y,greyScaleWeights:Z}))?self.postMessage({id:b,type:"qrResult",data:a.data,cornerPoints:[a.location.topLeftCorner,a.location.topRightCorner,a.location.bottomRightCorner,a.location.bottomLeftCorner]}):self.postMessage({id:b,type:"qrResult",data:null});break;case "grayscaleWeights":Z.red=c.red;Z.green=c.green;Z.blue=c.blue;Z.useIntegerApproximation=c.useIntegerApproximation;
|
||||
break;case "inversionMode":switch(c){case "original":Y="dontInvert";break;case "invert":Y="onlyInvert";break;case "both":Y="attemptBoth";break;default:throw Error("Invalid inversion mode");}break;case "close":self.close()}}
|
||||
`]),{type:"application/javascript"}));
|
||||
|
||||
export { createWorker };
|
1528
ihm_client/dist/sdk_client-BJ65BQeE.mjs
vendored
1528
ihm_client/dist/sdk_client-BJ65BQeE.mjs
vendored
File diff suppressed because one or more lines are too long
2104
ihm_client/dist/signature-component-DK4oRzT9.mjs
vendored
2104
ihm_client/dist/signature-component-DK4oRzT9.mjs
vendored
File diff suppressed because one or more lines are too long
877
ihm_client/dist/style.css
vendored
877
ihm_client/dist/style.css
vendored
File diff suppressed because one or more lines are too long
@ -1,2 +0,0 @@
|
||||
export declare function unpair(): Promise<void>;
|
||||
export declare function initHeader(): Promise<void>;
|
@ -1 +0,0 @@
|
||||
export declare function closeConfirmationModal(): Promise<void>;
|
@ -1,10 +0,0 @@
|
||||
export default class QrScannerComponent extends HTMLElement {
|
||||
videoElement: any;
|
||||
wrapper: any;
|
||||
qrScanner: any;
|
||||
constructor();
|
||||
connectedCallback(): void;
|
||||
initializeScanner(): Promise<void>;
|
||||
onQrCodeScanned(result: any): Promise<void>;
|
||||
disconnectedCallback(): void;
|
||||
}
|
@ -1 +0,0 @@
|
||||
export declare function initValidationModal(processDiffs: any): Promise<void>;
|
@ -1,14 +0,0 @@
|
||||
export interface ValidationRule {
|
||||
quorum: number;
|
||||
fields: string[];
|
||||
min_sig_member: number;
|
||||
}
|
||||
/**
|
||||
* Loads and injects the modal HTML into the document if not already loaded.
|
||||
*/
|
||||
export declare function loadValidationRuleModal(templatePath?: string): Promise<void>;
|
||||
/**
|
||||
* Opens the modal and lets the user input a ValidationRule.
|
||||
* Calls the callback with the constructed rule on submit.
|
||||
*/
|
||||
export declare function showValidationRuleModal(onSubmit: (rule: ValidationRule) => void): void;
|
3
ihm_client/dist/types/index.d.ts
vendored
3
ihm_client/dist/types/index.d.ts
vendored
@ -1,3 +0,0 @@
|
||||
export { default as Services } from './services/service';
|
||||
export { default as Database } from './services/database.service';
|
||||
export { MessageType } from './models/process.model';
|
@ -1,24 +0,0 @@
|
||||
import { DocumentSignature } from '~/models/signature.models';
|
||||
export interface Group {
|
||||
id: number;
|
||||
name: string;
|
||||
description: string;
|
||||
roles: Array<{
|
||||
name: string;
|
||||
members: Array<{
|
||||
id: string | number;
|
||||
name: string;
|
||||
}>;
|
||||
documents?: Array<any>;
|
||||
}>;
|
||||
commonDocuments: Array<{
|
||||
id: number;
|
||||
name: string;
|
||||
visibility: string;
|
||||
description: string;
|
||||
createdAt?: string | null;
|
||||
deadline?: string | null;
|
||||
signatures?: DocumentSignature[];
|
||||
status?: string;
|
||||
}>;
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
export interface Member {
|
||||
id: string | number;
|
||||
name: string;
|
||||
email?: string;
|
||||
avatar?: string;
|
||||
processRoles?: Array<{
|
||||
processId: number | string;
|
||||
role: string;
|
||||
}>;
|
||||
}
|
13
ihm_client/dist/types/main.d.ts
vendored
13
ihm_client/dist/types/main.d.ts
vendored
@ -1,13 +0,0 @@
|
||||
import { SignatureComponent } from './pages/signature/signature-component';
|
||||
import { SignatureElement } from './pages/signature/signature';
|
||||
import { AccountComponent } from './pages/account/account-component';
|
||||
import { AccountElement } from './pages/account/account';
|
||||
export { SignatureComponent, SignatureElement, AccountComponent, AccountElement };
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
'signature-component': SignatureComponent;
|
||||
'signature-element': SignatureElement;
|
||||
'account-component': AccountComponent;
|
||||
'account-element': AccountElement;
|
||||
}
|
||||
}
|
@ -1,118 +0,0 @@
|
||||
export declare const ALLOWED_ROLES: string[];
|
||||
export declare const STORAGE_KEYS: {
|
||||
pairing: string;
|
||||
wallet: string;
|
||||
process: string;
|
||||
data: string;
|
||||
};
|
||||
export declare const defaultRows: {
|
||||
column1: string;
|
||||
column2: string;
|
||||
column3: string;
|
||||
}[];
|
||||
export declare const mockNotifications: {
|
||||
[key: string]: Notification[];
|
||||
};
|
||||
export declare const notificationMessages: string[];
|
||||
export declare const mockDataRows: {
|
||||
column1: string;
|
||||
column2: string;
|
||||
column3: string;
|
||||
column4: string;
|
||||
column5: string;
|
||||
column6: string;
|
||||
processName: string;
|
||||
zone: string;
|
||||
}[];
|
||||
export declare const mockProcessRows: ({
|
||||
process: string;
|
||||
role: string;
|
||||
notification: {
|
||||
messages: {
|
||||
id: number;
|
||||
read: boolean;
|
||||
date: string;
|
||||
message: string;
|
||||
}[];
|
||||
unread?: undefined;
|
||||
total?: undefined;
|
||||
};
|
||||
} | {
|
||||
process: string;
|
||||
role: string;
|
||||
notification: {
|
||||
unread: number;
|
||||
total: number;
|
||||
messages: {
|
||||
id: number;
|
||||
read: boolean;
|
||||
date: string;
|
||||
message: string;
|
||||
}[];
|
||||
};
|
||||
})[];
|
||||
export declare const mockContracts: {
|
||||
'Contract #123': {
|
||||
title: string;
|
||||
date: string;
|
||||
parties: string[];
|
||||
terms: string[];
|
||||
content: string;
|
||||
};
|
||||
'Contract #456': {
|
||||
title: string;
|
||||
date: string;
|
||||
parties: string[];
|
||||
terms: string[];
|
||||
content: string;
|
||||
};
|
||||
'Contract #789': {
|
||||
title: string;
|
||||
date: string;
|
||||
parties: string[];
|
||||
terms: string[];
|
||||
content: string;
|
||||
};
|
||||
'Contract #101': {
|
||||
title: string;
|
||||
date: string;
|
||||
parties: string[];
|
||||
terms: string[];
|
||||
content: string;
|
||||
};
|
||||
'Contract #102': {
|
||||
title: string;
|
||||
date: string;
|
||||
parties: string[];
|
||||
terms: string[];
|
||||
content: string;
|
||||
};
|
||||
'Contract #103': {
|
||||
title: string;
|
||||
date: string;
|
||||
parties: string[];
|
||||
terms: string[];
|
||||
content: string;
|
||||
};
|
||||
'Contract #104': {
|
||||
title: string;
|
||||
date: string;
|
||||
parties: string[];
|
||||
terms: string[];
|
||||
content: string;
|
||||
};
|
||||
'Contract #105': {
|
||||
title: string;
|
||||
date: string;
|
||||
parties: string[];
|
||||
terms: string[];
|
||||
content: string;
|
||||
};
|
||||
'Contract #106': {
|
||||
title: string;
|
||||
date: string;
|
||||
parties: string[];
|
||||
terms: string[];
|
||||
content: string;
|
||||
};
|
||||
};
|
@ -1,38 +0,0 @@
|
||||
export interface Row {
|
||||
column1: string;
|
||||
column2: string;
|
||||
column3: string;
|
||||
}
|
||||
export interface Contract {
|
||||
title: string;
|
||||
date: string;
|
||||
parties: string[];
|
||||
terms: string[];
|
||||
content: string;
|
||||
}
|
||||
export interface WalletRow {
|
||||
column1: string;
|
||||
column2: string;
|
||||
column3: string;
|
||||
}
|
||||
export interface DataRow {
|
||||
column1: string;
|
||||
column2: string;
|
||||
column3: string;
|
||||
column4: string;
|
||||
column5: string;
|
||||
column6: string;
|
||||
processName: string;
|
||||
zone: string;
|
||||
}
|
||||
export interface Notification {
|
||||
message: string;
|
||||
timestamp: string;
|
||||
isRead: boolean;
|
||||
}
|
||||
export interface NotificationMessage {
|
||||
id: number;
|
||||
read: boolean;
|
||||
date: string;
|
||||
message: string;
|
||||
}
|
@ -1,119 +0,0 @@
|
||||
export const groupsMock: {
|
||||
id: number;
|
||||
name: string;
|
||||
description: string;
|
||||
commonDocuments: {
|
||||
id: number;
|
||||
name: string;
|
||||
description: string;
|
||||
visibility: string;
|
||||
status: string;
|
||||
createdAt: null;
|
||||
deadline: null;
|
||||
signatures: never[];
|
||||
}[];
|
||||
roles: ({
|
||||
name: string;
|
||||
members: {
|
||||
id: number;
|
||||
name: string;
|
||||
}[];
|
||||
documents: ({
|
||||
id: number;
|
||||
name: string;
|
||||
description: string;
|
||||
visibility: string;
|
||||
createdAt: string;
|
||||
deadline: string;
|
||||
signatures: ({
|
||||
member: {
|
||||
id: number;
|
||||
name: string;
|
||||
};
|
||||
signed: boolean;
|
||||
signedAt: string;
|
||||
} | {
|
||||
member: {
|
||||
id: number;
|
||||
name: string;
|
||||
};
|
||||
signed: boolean;
|
||||
signedAt?: undefined;
|
||||
})[];
|
||||
status?: undefined;
|
||||
} | {
|
||||
id: number;
|
||||
name: string;
|
||||
description: string;
|
||||
visibility: string;
|
||||
createdAt: null;
|
||||
deadline: null;
|
||||
signatures: never[];
|
||||
status?: undefined;
|
||||
} | {
|
||||
id: number;
|
||||
name: string;
|
||||
description: string;
|
||||
visibility: string;
|
||||
status: string;
|
||||
createdAt: null;
|
||||
deadline: null;
|
||||
signatures: never[];
|
||||
})[];
|
||||
} | {
|
||||
name: string;
|
||||
members: {
|
||||
id: number;
|
||||
name: string;
|
||||
}[];
|
||||
documents: ({
|
||||
id: number;
|
||||
name: string;
|
||||
description: string;
|
||||
visibility: string;
|
||||
createdAt: string;
|
||||
deadline: string;
|
||||
signatures: {
|
||||
member: {
|
||||
id: number;
|
||||
name: string;
|
||||
};
|
||||
signed: boolean;
|
||||
signedAt: string;
|
||||
}[];
|
||||
status?: undefined;
|
||||
} | {
|
||||
id: number;
|
||||
name: string;
|
||||
description: string;
|
||||
visibility: string;
|
||||
status: string;
|
||||
createdAt: null;
|
||||
deadline: null;
|
||||
signatures: never[];
|
||||
} | {
|
||||
id: number;
|
||||
name: string;
|
||||
description: string;
|
||||
visibility: string;
|
||||
status: string;
|
||||
createdAt: string;
|
||||
deadline: string;
|
||||
signatures: ({
|
||||
member: {
|
||||
id: number;
|
||||
name: string;
|
||||
};
|
||||
signed: boolean;
|
||||
signedAt: string;
|
||||
} | {
|
||||
member: {
|
||||
id: number;
|
||||
name: string;
|
||||
};
|
||||
signed: boolean;
|
||||
signedAt?: undefined;
|
||||
})[];
|
||||
})[];
|
||||
})[];
|
||||
}[];
|
@ -1,10 +0,0 @@
|
||||
export const membersMock: {
|
||||
id: number;
|
||||
name: string;
|
||||
avatar: string;
|
||||
email: string;
|
||||
processRoles: {
|
||||
processId: number;
|
||||
role: string;
|
||||
}[];
|
||||
}[];
|
@ -1,9 +0,0 @@
|
||||
export declare const messagesMock: {
|
||||
memberId: number;
|
||||
messages: {
|
||||
id: number;
|
||||
sender: string;
|
||||
text: string;
|
||||
time: string;
|
||||
}[];
|
||||
}[];
|
@ -1,6 +0,0 @@
|
||||
import { Device, Process, SecretsStore } from "pkg/sdk_client";
|
||||
export interface BackUp {
|
||||
device: Device;
|
||||
secrets: SecretsStore;
|
||||
processes: Record<string, Process>;
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
export interface INotification {
|
||||
id: number;
|
||||
title: string;
|
||||
description: string;
|
||||
sendToNotificationPage?: boolean;
|
||||
path?: string;
|
||||
}
|
||||
export interface IUser {
|
||||
id: string;
|
||||
information?: any;
|
||||
}
|
||||
export interface IMessage {
|
||||
id: string;
|
||||
message: any;
|
||||
}
|
||||
export interface UserDiff {
|
||||
new_state_merkle_root: string;
|
||||
field: string;
|
||||
previous_value: string;
|
||||
new_value: string;
|
||||
notify_user: boolean;
|
||||
need_validation: boolean;
|
||||
proof: any;
|
||||
}
|
56
ihm_client/dist/types/models/process.model.d.ts
vendored
56
ihm_client/dist/types/models/process.model.d.ts
vendored
@ -1,56 +0,0 @@
|
||||
export interface IProcess {
|
||||
id: number;
|
||||
name: string;
|
||||
description: string;
|
||||
icon?: string;
|
||||
zoneList: IZone[];
|
||||
}
|
||||
export interface IZone {
|
||||
id: number;
|
||||
name: string;
|
||||
path: string;
|
||||
icon?: string;
|
||||
}
|
||||
export interface INotification {
|
||||
id: number;
|
||||
title: string;
|
||||
description: string;
|
||||
sendToNotificationPage?: boolean;
|
||||
path?: string;
|
||||
}
|
||||
export declare enum MessageType {
|
||||
LISTENING = "LISTENING",
|
||||
REQUEST_LINK = "REQUEST_LINK",
|
||||
LINK_ACCEPTED = "LINK_ACCEPTED",
|
||||
CREATE_PAIRING = "CREATE_PAIRING",
|
||||
PAIRING_CREATED = "PAIRING_CREATED",
|
||||
ERROR = "ERROR",
|
||||
VALIDATE_TOKEN = "VALIDATE_TOKEN",
|
||||
RENEW_TOKEN = "RENEW_TOKEN",
|
||||
GET_PAIRING_ID = "GET_PAIRING_ID",
|
||||
GET_PROCESSES = "GET_PROCESSES",
|
||||
GET_MY_PROCESSES = "GET_MY_PROCESSES",
|
||||
PROCESSES_RETRIEVED = "PROCESSES_RETRIEVED",
|
||||
RETRIEVE_DATA = "RETRIEVE_DATA",
|
||||
DATA_RETRIEVED = "DATA_RETRIEVED",
|
||||
DECODE_PUBLIC_DATA = "DECODE_PUBLIC_DATA",
|
||||
PUBLIC_DATA_DECODED = "PUBLIC_DATA_DECODED",
|
||||
GET_MEMBER_ADDRESSES = "GET_MEMBER_ADDRESSES",
|
||||
MEMBER_ADDRESSES_RETRIEVED = "MEMBER_ADDRESSES_RETRIEVED",
|
||||
CREATE_PROCESS = "CREATE_PROCESS",
|
||||
PROCESS_CREATED = "PROCESS_CREATED",
|
||||
UPDATE_PROCESS = "UPDATE_PROCESS",
|
||||
PROCESS_UPDATED = "PROCESS_UPDATED",
|
||||
NOTIFY_UPDATE = "NOTIFY_UPDATE",
|
||||
UPDATE_NOTIFIED = "UPDATE_NOTIFIED",
|
||||
VALIDATE_STATE = "VALIDATE_STATE",
|
||||
STATE_VALIDATED = "STATE_VALIDATED",
|
||||
HASH_VALUE = "HASH_VALUE",
|
||||
VALUE_HASHED = "VALUE_HASHED",
|
||||
GET_MERKLE_PROOF = "GET_MERKLE_PROOF",
|
||||
MERKLE_PROOF_RETRIEVED = "MERKLE_PROOF_RETRIEVED",
|
||||
VALIDATE_MERKLE_PROOF = "VALIDATE_MERKLE_PROOF",
|
||||
MERKLE_PROOF_VALIDATED = "MERKLE_PROOF_VALIDATED",
|
||||
ADD_DEVICE = "ADD_DEVICE",
|
||||
DEVICE_ADDED = "DEVICE_ADDED"
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
export interface Group {
|
||||
id: number;
|
||||
name: string;
|
||||
description?: string;
|
||||
roles: {
|
||||
id?: number;
|
||||
name: string;
|
||||
members: {
|
||||
id: string | number;
|
||||
name: string;
|
||||
}[];
|
||||
documents?: {
|
||||
id: number;
|
||||
name: string;
|
||||
description?: string;
|
||||
visibility: string;
|
||||
createdAt: string | null;
|
||||
deadline: string | null;
|
||||
signatures: DocumentSignature[];
|
||||
status?: string;
|
||||
files?: Array<{
|
||||
name: string;
|
||||
url: string;
|
||||
}>;
|
||||
}[];
|
||||
}[];
|
||||
}
|
||||
export interface Message {
|
||||
id: number;
|
||||
sender: string;
|
||||
text?: string;
|
||||
time: string;
|
||||
type: 'text' | 'file';
|
||||
fileName?: string;
|
||||
fileData?: string;
|
||||
}
|
||||
export interface MemberMessages {
|
||||
memberId: string;
|
||||
messages: Message[];
|
||||
}
|
||||
export interface DocumentSignature {
|
||||
signed: boolean;
|
||||
member: {
|
||||
name: string;
|
||||
};
|
||||
signedAt?: string;
|
||||
}
|
||||
export interface RequestParams {
|
||||
processId: number;
|
||||
processName: string;
|
||||
roleId: number;
|
||||
roleName: string;
|
||||
documentId: number;
|
||||
documentName: string;
|
||||
}
|
||||
export interface Notification {
|
||||
memberId: string;
|
||||
text: string;
|
||||
time: string;
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
import { AccountElement } from './account';
|
||||
declare class AccountComponent extends HTMLElement {
|
||||
_callback: any;
|
||||
accountElement: AccountElement | null;
|
||||
constructor();
|
||||
connectedCallback(): void;
|
||||
fetchData(): Promise<void>;
|
||||
set callback(fn: any);
|
||||
get callback(): any;
|
||||
render(): void;
|
||||
}
|
||||
export { AccountComponent };
|
98
ihm_client/dist/types/pages/account/account.d.ts
vendored
98
ihm_client/dist/types/pages/account/account.d.ts
vendored
@ -1,98 +0,0 @@
|
||||
declare global {
|
||||
interface Window {
|
||||
initAccount: () => void;
|
||||
showContractPopup: (contractId: string) => void;
|
||||
showPairing: () => Promise<void>;
|
||||
showWallet: () => void;
|
||||
showData: () => void;
|
||||
addWalletRow: () => void;
|
||||
confirmWalletRow: () => void;
|
||||
cancelWalletRow: () => void;
|
||||
openAvatarPopup: () => void;
|
||||
closeAvatarPopup: () => void;
|
||||
editDeviceName: (cell: HTMLTableCellElement) => void;
|
||||
showNotifications: (processName: string) => void;
|
||||
closeNotificationPopup: (event: Event) => void;
|
||||
markAsRead: (processName: string, messageId: number, element: HTMLElement) => void;
|
||||
exportRecovery: () => void;
|
||||
confirmDeleteAccount: () => void;
|
||||
deleteAccount: () => void;
|
||||
updateNavbarBanner: (bannerUrl: string) => void;
|
||||
saveBannerToLocalStorage: (bannerUrl: string) => void;
|
||||
loadSavedBanner: () => void;
|
||||
cancelAddRowPairing: () => void;
|
||||
saveName: (cell: HTMLElement, input: HTMLInputElement) => void;
|
||||
showProcessNotifications: (processName: string) => void;
|
||||
handleLogout: () => void;
|
||||
initializeEventListeners: () => void;
|
||||
showProcess: () => void;
|
||||
showProcessCreation: () => void;
|
||||
showDocumentValidation: () => void;
|
||||
updateNavbarName: (name: string) => void;
|
||||
updateNavbarLastName: (lastName: string) => void;
|
||||
showAlert: (title: string, text?: string, icon?: string) => void;
|
||||
addRowPairing: () => void;
|
||||
confirmRowPairing: () => void;
|
||||
cancelRowPairing: () => void;
|
||||
deleteRowPairing: (button: HTMLButtonElement) => void;
|
||||
generateRecoveryWords: () => string[];
|
||||
exportUserData: () => void;
|
||||
updateActionButtons: () => void;
|
||||
showQRCodeModal: (pairingId: string) => void;
|
||||
}
|
||||
}
|
||||
declare class AccountElement extends HTMLElement {
|
||||
private dom;
|
||||
constructor();
|
||||
connectedCallback(): void;
|
||||
private showAlert;
|
||||
private confirmDeleteAccount;
|
||||
private deleteAccount;
|
||||
private updateNavbarBanner;
|
||||
private saveBannerToLocalStorage;
|
||||
private loadSavedBanner;
|
||||
private closeNotificationPopup;
|
||||
private markAsRead;
|
||||
private calculateNotifications;
|
||||
private exportRecovery;
|
||||
private generateRecoveryWords;
|
||||
private exportUserData;
|
||||
private updateActionButtons;
|
||||
private getConfirmFunction;
|
||||
private getCancelFunction;
|
||||
private addRowPairing;
|
||||
private updateTableContent;
|
||||
private confirmRowPairing;
|
||||
private cancelRowPairing;
|
||||
private resetButtonContainer;
|
||||
private deleteRowPairing;
|
||||
private editDeviceName;
|
||||
private finishEditing;
|
||||
private handleAvatarUpload;
|
||||
private showProcessCreation;
|
||||
private showDocumentValidation;
|
||||
private showProcess;
|
||||
private showProcessNotifications;
|
||||
private handleLogout;
|
||||
private showContractPopup;
|
||||
private hideAllContent;
|
||||
private showPairing;
|
||||
private showWallet;
|
||||
private updateWalletTableContent;
|
||||
private showData;
|
||||
private addWalletRow;
|
||||
private confirmWalletRow;
|
||||
private cancelWalletRow;
|
||||
private updateDataTableContent;
|
||||
private openAvatarPopup;
|
||||
private setupEventListeners;
|
||||
private closeAvatarPopup;
|
||||
private loadAvatar;
|
||||
private loadUserInfo;
|
||||
private updateNavbarName;
|
||||
private updateNavbarLastName;
|
||||
private updateProfilePreview;
|
||||
private initializeEventListeners;
|
||||
private showQRCodeModal;
|
||||
}
|
||||
export { AccountElement };
|
@ -1,33 +0,0 @@
|
||||
export interface Vin {
|
||||
txid: string;
|
||||
vout: number;
|
||||
prevout: {
|
||||
scriptpubkey: string;
|
||||
scriptpubkey_asm: string;
|
||||
scriptpubkey_type: string;
|
||||
scriptpubkey_address: string;
|
||||
value: number;
|
||||
};
|
||||
scriptsig: string;
|
||||
scriptsig_asm: string;
|
||||
witness: string[];
|
||||
is_coinbase: boolean;
|
||||
sequence: number;
|
||||
}
|
||||
export interface TransactionInfo {
|
||||
txid: string;
|
||||
version: number;
|
||||
locktime: number;
|
||||
vin: Vin[];
|
||||
vout: any[];
|
||||
size: number;
|
||||
weight: number;
|
||||
fee: number;
|
||||
status: {
|
||||
confirmed: boolean;
|
||||
block_height: number;
|
||||
block_hash: string;
|
||||
block_time: number;
|
||||
};
|
||||
}
|
||||
export declare function getDocumentValidation(container: HTMLElement): void;
|
@ -1,8 +0,0 @@
|
||||
import type { RoleDefinition } from '../../../pkg/sdk_client';
|
||||
export declare function createKeyValueSection(title: string, id: string, isRoleSection?: boolean): {
|
||||
element: HTMLDivElement;
|
||||
getData: () => Record<string, RoleDefinition> | Record<string, string | {
|
||||
type: string;
|
||||
data: Uint8Array;
|
||||
}>;
|
||||
};
|
@ -1 +0,0 @@
|
||||
export declare function getProcessCreation(container: HTMLElement): Promise<void>;
|
@ -1,4 +0,0 @@
|
||||
export declare function createProcessTab(container: HTMLElement, processes: {
|
||||
name: string;
|
||||
publicData: Record<string, any>;
|
||||
}[]): HTMLElement;
|
@ -1,8 +0,0 @@
|
||||
export declare class LoginComponent extends HTMLElement {
|
||||
_callback: any;
|
||||
constructor();
|
||||
connectedCallback(): void;
|
||||
set callback(fn: any);
|
||||
get callback(): any;
|
||||
render(): void;
|
||||
}
|
4
ihm_client/dist/types/pages/home/home.d.ts
vendored
4
ihm_client/dist/types/pages/home/home.d.ts
vendored
@ -1,4 +0,0 @@
|
||||
import QrScannerComponent from '../../components/qrcode-scanner/qrcode-scanner-component';
|
||||
export { QrScannerComponent };
|
||||
export declare function initHomePage(): Promise<void>;
|
||||
export declare function openModal(myAddress: string, receiverAddress: string): Promise<void>;
|
@ -1,10 +0,0 @@
|
||||
export declare class ProcessListComponent extends HTMLElement {
|
||||
_callback: any;
|
||||
id: string;
|
||||
zone: string;
|
||||
constructor();
|
||||
connectedCallback(): void;
|
||||
set callback(fn: any);
|
||||
get callback(): any;
|
||||
render(): void;
|
||||
}
|
@ -1 +0,0 @@
|
||||
export declare function initProcessElement(id: string, zone: string): Promise<void>;
|
@ -1,12 +0,0 @@
|
||||
import { SignatureElement } from './signature';
|
||||
declare class SignatureComponent extends HTMLElement {
|
||||
_callback: any;
|
||||
signatureElement: SignatureElement | null;
|
||||
constructor();
|
||||
connectedCallback(): void;
|
||||
fetchData(): Promise<void>;
|
||||
set callback(fn: any);
|
||||
get callback(): any;
|
||||
render(): void;
|
||||
}
|
||||
export { SignatureComponent };
|
@ -1,71 +0,0 @@
|
||||
declare global {
|
||||
interface Window {
|
||||
toggleUserList: () => void;
|
||||
switchUser: (userId: string | number) => void;
|
||||
closeProcessDetails: (groupId: number) => void;
|
||||
loadMemberChat: (memberId: string | number) => void;
|
||||
closeRoleDocuments: (roleName: string) => void;
|
||||
newRequest: (params: RequestParams) => void;
|
||||
submitRequest: () => void;
|
||||
closeNewRequest: () => void;
|
||||
closeModal: (button: HTMLElement) => void;
|
||||
submitDocumentRequest: (documentId: number) => void;
|
||||
submitNewDocument: (event: Event) => void;
|
||||
submitCommonDocument: (event: Event) => void;
|
||||
signDocument: (documentId: number, processId: number, isCommonDocument: boolean) => void;
|
||||
confirmSignature: (documentId: number, processId: number, isCommonDocument: boolean) => void;
|
||||
}
|
||||
}
|
||||
import { RequestParams } from '../../models/signature.models';
|
||||
declare class SignatureElement extends HTMLElement {
|
||||
private selectedMemberId;
|
||||
private messagesMock;
|
||||
private dom;
|
||||
private notifications;
|
||||
private notificationBadge;
|
||||
private notificationBoard;
|
||||
private notificationBell;
|
||||
private selectedSignatories;
|
||||
private allMembers;
|
||||
private showAlert;
|
||||
private signDocument;
|
||||
constructor();
|
||||
private initMessageEvents;
|
||||
private initFileUpload;
|
||||
private calculateDuration;
|
||||
private canUserAccessDocument;
|
||||
private canUserSignDocument;
|
||||
private closeProcessDetails;
|
||||
private removeNotification;
|
||||
private renderNotifications;
|
||||
private updateNotificationBadge;
|
||||
private addNotification;
|
||||
private sendMessage;
|
||||
private showProcessDetails;
|
||||
private scrollToBottom;
|
||||
private loadMemberChat;
|
||||
private toggleMembers;
|
||||
private toggleRoles;
|
||||
private loadGroupList;
|
||||
private toggleUserList;
|
||||
private switchUser;
|
||||
private updateCurrentUserDisplay;
|
||||
private generateAutoReply;
|
||||
private sendFile;
|
||||
private fileList;
|
||||
private getFileList;
|
||||
private showRoleDocuments;
|
||||
private closeRoleDocuments;
|
||||
private handleFiles;
|
||||
private newRequest;
|
||||
private closeModal;
|
||||
private submitNewDocument;
|
||||
private submitCommonDocument;
|
||||
private submitRequest;
|
||||
private closeNewRequest;
|
||||
private submitDocumentRequest;
|
||||
private confirmSignature;
|
||||
private initializeEventListeners;
|
||||
connectedCallback(): void;
|
||||
}
|
||||
export { SignatureElement };
|
5
ihm_client/dist/types/router.d.ts
vendored
5
ihm_client/dist/types/router.d.ts
vendored
@ -1,5 +0,0 @@
|
||||
import '../public/style/4nk.css';
|
||||
export declare let currentRoute: string;
|
||||
export declare function navigate(path: string): Promise<void>;
|
||||
export declare function init(): Promise<void>;
|
||||
export declare function registerAllListeners(): Promise<void>;
|
@ -1,43 +0,0 @@
|
||||
export declare class Database {
|
||||
private static instance;
|
||||
private db;
|
||||
private dbName;
|
||||
private dbVersion;
|
||||
private serviceWorkerRegistration;
|
||||
private messageChannel;
|
||||
private messageChannelForGet;
|
||||
private serviceWorkerCheckIntervalId;
|
||||
private storeDefinitions;
|
||||
private constructor();
|
||||
static getInstance(): Promise<Database>;
|
||||
private init;
|
||||
getDb(): Promise<IDBDatabase>;
|
||||
getStoreList(): {
|
||||
[key: string]: string;
|
||||
};
|
||||
registerServiceWorker(path: string): Promise<void>;
|
||||
private waitForServiceWorkerActivation;
|
||||
private checkForUpdates;
|
||||
private handleServiceWorkerMessage;
|
||||
private handleDownloadList;
|
||||
private handleAddObjectResponse;
|
||||
private handleGetObjectResponse;
|
||||
addObject(payload: {
|
||||
storeName: string;
|
||||
object: any;
|
||||
key: any;
|
||||
}): Promise<void>;
|
||||
batchWriting(payload: {
|
||||
storeName: string;
|
||||
objects: {
|
||||
key: any;
|
||||
object: any;
|
||||
}[];
|
||||
}): Promise<void>;
|
||||
getObject(storeName: string, key: string): Promise<any | null>;
|
||||
dumpStore(storeName: string): Promise<Record<string, any>>;
|
||||
deleteObject(storeName: string, key: string): Promise<void>;
|
||||
clearStore(storeName: string): Promise<void>;
|
||||
requestStoreByIndex(storeName: string, indexName: string, request: string): Promise<any[]>;
|
||||
}
|
||||
export default Database;
|
@ -1,28 +0,0 @@
|
||||
import type { RoleDefinition } from 'pkg/sdk_client';
|
||||
interface ConfirmationModalOptions {
|
||||
title: string;
|
||||
content: string;
|
||||
confirmText?: string;
|
||||
cancelText?: string;
|
||||
}
|
||||
export default class ModalService {
|
||||
private static instance;
|
||||
private stateId;
|
||||
private processId;
|
||||
private constructor();
|
||||
private paired_addresses;
|
||||
private modal;
|
||||
static getInstance(): Promise<ModalService>;
|
||||
openLoginModal(myAddress: string, receiverAddress: string): void;
|
||||
injectModal(members: any[]): Promise<void>;
|
||||
injectCreationModal(members: any[]): Promise<void>;
|
||||
injectWaitingModal(): Promise<void>;
|
||||
injectValidationModal(processDiff: any): Promise<void>;
|
||||
closeValidationModal(): Promise<void>;
|
||||
openPairingConfirmationModal(roleDefinition: Record<string, RoleDefinition>, processId: string, stateId: string): Promise<void>;
|
||||
confirmLogin(): void;
|
||||
closeLoginModal(): Promise<void>;
|
||||
showConfirmationModal(options: ConfirmationModalOptions, fullscreen?: boolean): Promise<boolean>;
|
||||
closeConfirmationModal(): Promise<void>;
|
||||
}
|
||||
export {};
|
167
ihm_client/dist/types/services/service.d.ts
vendored
167
ihm_client/dist/types/services/service.d.ts
vendored
@ -1,167 +0,0 @@
|
||||
import type { ApiReturn, Device, Member, MerkleProofResult, Process, ProcessState, RoleDefinition, SecretsStore, UserDiff } from '../../pkg/sdk_client';
|
||||
import { BackUp } from '~/models/backup.model';
|
||||
export declare const U32_MAX = 4294967295;
|
||||
export default class Services {
|
||||
private static initializing;
|
||||
private static instance;
|
||||
private processId;
|
||||
private stateId;
|
||||
private sdkClient;
|
||||
private processesCache;
|
||||
private myProcesses;
|
||||
private notifications;
|
||||
private subscriptions;
|
||||
private database;
|
||||
private routingInstance;
|
||||
private relayAddresses;
|
||||
private membersList;
|
||||
private currentBlockHeight;
|
||||
private constructor();
|
||||
static getInstance(): Promise<Services>;
|
||||
init(): Promise<void>;
|
||||
setProcessId(processId: string | null): void;
|
||||
setStateId(stateId: string | null): void;
|
||||
getProcessId(): string | null;
|
||||
getStateId(): string | null;
|
||||
/**
|
||||
* Calls `this.addWebsocketConnection` for each `wsurl` in relayAddresses.
|
||||
* Waits for at least one handshake message before returning.
|
||||
*/
|
||||
connectAllRelays(): Promise<void>;
|
||||
addWebsocketConnection(url: string): Promise<void>;
|
||||
/**
|
||||
* Add or update a key/value pair in relayAddresses.
|
||||
* @param wsurl - The WebSocket URL (key).
|
||||
* @param spAddress - The SP Address (value).
|
||||
*/
|
||||
updateRelay(wsurl: string, spAddress: string): void;
|
||||
/**
|
||||
* Retrieve the spAddress for a given wsurl.
|
||||
* @param wsurl - The WebSocket URL to look up.
|
||||
* @returns The SP Address if found, or undefined if not.
|
||||
*/
|
||||
getSpAddress(wsurl: string): string | undefined;
|
||||
/**
|
||||
* Get all key/value pairs from relayAddresses.
|
||||
* @returns An array of objects containing wsurl and spAddress.
|
||||
*/
|
||||
getAllRelays(): {
|
||||
wsurl: string;
|
||||
spAddress: string;
|
||||
}[];
|
||||
/**
|
||||
* Print all key/value pairs for debugging.
|
||||
*/
|
||||
printAllRelays(): void;
|
||||
isPaired(): boolean;
|
||||
unpairDevice(): Promise<void>;
|
||||
getSecretForAddress(address: string): Promise<string | null>;
|
||||
getAllSecrets(): Promise<SecretsStore>;
|
||||
getAllDiffs(): Promise<Record<string, UserDiff>>;
|
||||
getDiffByValue(value: string): Promise<UserDiff | null>;
|
||||
private getTokensFromFaucet;
|
||||
checkConnections(members: Member[]): Promise<void>;
|
||||
connectAddresses(addresses: string[]): Promise<ApiReturn>;
|
||||
private ensureSufficientAmount;
|
||||
private waitForAmount;
|
||||
createPairingProcess(userName: string, pairWith: string[]): Promise<ApiReturn>;
|
||||
private isFileBlob;
|
||||
private splitData;
|
||||
createProcess(privateData: Record<string, any>, publicData: Record<string, any>, roles: Record<string, RoleDefinition>): Promise<ApiReturn>;
|
||||
updateProcess(process: Process, privateData: Record<string, any>, publicData: Record<string, any>, roles: Record<string, RoleDefinition> | null): Promise<ApiReturn>;
|
||||
createPrdUpdate(processId: string, stateId: string): Promise<ApiReturn>;
|
||||
createPrdResponse(processId: string, stateId: string): Promise<ApiReturn>;
|
||||
approveChange(processId: string, stateId: string): Promise<ApiReturn>;
|
||||
rejectChange(processId: string, stateId: string): Promise<ApiReturn>;
|
||||
resetDevice(): Promise<void>;
|
||||
sendNewTxMessage(message: string): void;
|
||||
sendCommitMessage(message: string): void;
|
||||
sendCipherMessages(ciphers: string[]): void;
|
||||
sendFaucetMessage(message: string): void;
|
||||
parseCipher(message: string): Promise<void>;
|
||||
parseNewTx(newTxMsg: string): Promise<void>;
|
||||
handleApiReturn(apiReturn: ApiReturn): Promise<void>;
|
||||
openPairingConfirmationModal(processId: string): Promise<void>;
|
||||
confirmPairing(): Promise<void>;
|
||||
updateDevice(): Promise<void>;
|
||||
pairDevice(): Promise<void>;
|
||||
getAmount(): BigInt;
|
||||
getDeviceAddress(): string;
|
||||
dumpDeviceFromMemory(): Device;
|
||||
dumpNeuteredDevice(): Device | null;
|
||||
getPairingProcessId(): string;
|
||||
saveDeviceInDatabase(device: Device): Promise<void>;
|
||||
getDeviceFromDatabase(): Promise<Device | null>;
|
||||
getMemberFromDevice(): Promise<string[] | null>;
|
||||
isChildRole(parent: any, child: any): boolean;
|
||||
rolesContainsUs(roles: Record<string, RoleDefinition>): boolean;
|
||||
rolesContainsMember(roles: Record<string, RoleDefinition>, pairingProcessId: string): boolean;
|
||||
dumpWallet(): Promise<any>;
|
||||
createFaucetMessage(): any;
|
||||
createNewDevice(): Promise<string>;
|
||||
restoreDevice(device: Device): void;
|
||||
updateDeviceBlockHeight(): Promise<void>;
|
||||
private removeProcess;
|
||||
batchSaveProcessesToDb(processes: Record<string, Process>): Promise<void>;
|
||||
saveProcessToDb(processId: string, process: Process): Promise<void>;
|
||||
saveBlobToDb(hash: string, data: Blob): Promise<void>;
|
||||
getBlobFromDb(hash: string): Promise<Blob | null>;
|
||||
saveDataToStorage(hash: string, data: Blob, ttl: number | null): Promise<void>;
|
||||
fetchValueFromStorage(hash: string): Promise<any | null>;
|
||||
testDataInStorage(hash: string): Promise<Record<string, boolean | null> | null>;
|
||||
saveDiffsToDb(diffs: UserDiff[]): Promise<void>;
|
||||
getProcess(processId: string): Promise<Process | null>;
|
||||
getProcesses(): Promise<Record<string, Process>>;
|
||||
restoreProcessesFromBackUp(processes: Record<string, Process>): Promise<void>;
|
||||
restoreProcessesFromDB(): Promise<void>;
|
||||
clearSecretsFromDB(): Promise<void>;
|
||||
restoreSecretsFromBackUp(secretsStore: SecretsStore): Promise<void>;
|
||||
restoreSecretsFromDB(): Promise<void>;
|
||||
decodeValue(value: number[]): any | null;
|
||||
decryptAttribute(processId: string, state: ProcessState, attribute: string): Promise<any | null>;
|
||||
getNotifications(): any[] | null;
|
||||
setNotifications(notifications: any[]): void;
|
||||
importJSON(backup: BackUp): Promise<void>;
|
||||
createBackUp(): Promise<BackUp | null>;
|
||||
device1: boolean;
|
||||
device2Ready: boolean;
|
||||
resetState(): void;
|
||||
handleHandshakeMsg(url: string, parsedMsg: any): Promise<void>;
|
||||
private lookForStateId;
|
||||
/**
|
||||
* Waits for at least one handshake message to be received from any connected relay.
|
||||
* This ensures that the relay addresses are fully populated and the member list is updated.
|
||||
* @returns A promise that resolves when at least one handshake message is received.
|
||||
*/
|
||||
private waitForHandshakeMessage;
|
||||
/**
|
||||
* Retourne la liste de tous les membres ordonnés par leur process id
|
||||
* @returns Un tableau contenant tous les membres
|
||||
*/
|
||||
getAllMembersSorted(): Record<string, Member>;
|
||||
getAllMembers(): Record<string, Member>;
|
||||
getAddressesForMemberId(memberId: string): string[] | null;
|
||||
compareMembers(memberA: string[], memberB: string[]): boolean;
|
||||
handleCommitError(response: string): Promise<void>;
|
||||
getRoles(process: Process): Record<string, RoleDefinition> | null;
|
||||
getPublicData(process: Process): Record<string, any> | null;
|
||||
getProcessName(process: Process): string | null;
|
||||
getMyProcesses(): Promise<string[] | null>;
|
||||
requestDataFromPeers(processId: string, stateIds: string[], roles: Record<string, RoleDefinition>[]): Promise<void>;
|
||||
hexToBlob(hexString: string): Blob;
|
||||
hexToUInt8Array(hexString: string): Uint8Array;
|
||||
blobToHex(blob: Blob): Promise<string>;
|
||||
getHashForFile(commitedIn: string, label: string, fileBlob: {
|
||||
type: string;
|
||||
data: Uint8Array;
|
||||
}): string;
|
||||
getMerkleProofForFile(processState: ProcessState, attributeName: string): MerkleProofResult;
|
||||
validateMerkleProof(proof: MerkleProofResult, hash: string): boolean;
|
||||
getLastCommitedState(process: Process): ProcessState | null;
|
||||
getLastCommitedStateIndex(process: Process): number | null;
|
||||
getUncommitedStates(process: Process): ProcessState[];
|
||||
getStateFromId(process: Process, stateId: string): ProcessState | null;
|
||||
getNextStateAfterId(process: Process, stateId: string): ProcessState | null;
|
||||
isPairingProcess(roles: Record<string, RoleDefinition>): boolean;
|
||||
updateMemberPublicName(process: Process, newName: string): Promise<ApiReturn>;
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
import { AxiosResponse } from 'axios';
|
||||
export declare function storeData(servers: string[], key: string, value: Blob, ttl: number | null): Promise<AxiosResponse | null>;
|
||||
export declare function retrieveData(servers: string[], key: string): Promise<ArrayBuffer | null>;
|
||||
export declare function testData(servers: string[], key: string): Promise<Record<string, boolean | null> | null>;
|
17
ihm_client/dist/types/services/token.d.ts
vendored
17
ihm_client/dist/types/services/token.d.ts
vendored
@ -1,17 +0,0 @@
|
||||
interface TokenPair {
|
||||
accessToken: string;
|
||||
refreshToken: string;
|
||||
}
|
||||
export default class TokenService {
|
||||
private static instance;
|
||||
private readonly SECRET_KEY;
|
||||
private readonly ACCESS_TOKEN_EXPIRATION;
|
||||
private readonly REFRESH_TOKEN_EXPIRATION;
|
||||
private readonly encoder;
|
||||
private constructor();
|
||||
static getInstance(): Promise<TokenService>;
|
||||
generateSessionToken(origin: string): Promise<TokenPair>;
|
||||
validateToken(token: string, origin: string): Promise<boolean>;
|
||||
refreshAccessToken(refreshToken: string, origin: string): Promise<string | null>;
|
||||
}
|
||||
export {};
|
@ -1 +0,0 @@
|
||||
export declare function getCorrectDOM(componentTag: string): Node;
|
4
ihm_client/dist/types/utils/html.utils.d.ts
vendored
4
ihm_client/dist/types/utils/html.utils.d.ts
vendored
@ -1,4 +0,0 @@
|
||||
export declare function interpolate(template: string, data: {
|
||||
[key: string]: string;
|
||||
}): string;
|
||||
export declare function getCorrectDOM(componentTag: string): Node;
|
12
ihm_client/dist/types/utils/messageMock.d.ts
vendored
12
ihm_client/dist/types/utils/messageMock.d.ts
vendored
@ -1,12 +0,0 @@
|
||||
declare class MessageStore {
|
||||
private readonly STORAGE_KEY;
|
||||
private messages;
|
||||
constructor();
|
||||
private loadFromLocalStorage;
|
||||
getMessages(): any[];
|
||||
setMessages(messages: any[]): void;
|
||||
private saveToLocalStorage;
|
||||
addMessage(memberId: string | number, message: any): void;
|
||||
}
|
||||
export declare const messageStore: MessageStore;
|
||||
export {};
|
@ -1,23 +0,0 @@
|
||||
interface INotification {
|
||||
id: number;
|
||||
title: string;
|
||||
description: string;
|
||||
time?: string;
|
||||
memberId?: string;
|
||||
}
|
||||
declare class NotificationStore {
|
||||
private static instance;
|
||||
private notifications;
|
||||
private constructor();
|
||||
static getInstance(): NotificationStore;
|
||||
addNotification(notification: INotification): void;
|
||||
removeNotification(index: number): void;
|
||||
getNotifications(): INotification[];
|
||||
private saveToLocalStorage;
|
||||
private loadFromLocalStorage;
|
||||
private updateUI;
|
||||
private renderNotificationBoard;
|
||||
refreshNotifications(): void;
|
||||
}
|
||||
export declare const notificationStore: NotificationStore;
|
||||
export {};
|
@ -1,5 +0,0 @@
|
||||
export declare function splitPrivateData(data: Record<string, any>, privateFields: string[]): {
|
||||
privateData: Record<string, any>;
|
||||
publicData: Record<string, any>;
|
||||
};
|
||||
export declare function isValid32ByteHex(value: string): boolean;
|
@ -1,8 +0,0 @@
|
||||
export declare function copyToClipboard(fullAddress: string): Promise<void>;
|
||||
export declare function generateEmojiList(): string[];
|
||||
export declare function addressToEmoji(text: string): Promise<string>;
|
||||
export declare function displayEmojis(text: string): Promise<void>;
|
||||
export declare function initAddressInput(): void;
|
||||
export declare function prepareAndSendPairingTx(): Promise<void>;
|
||||
export declare function generateQRCode(spAddress: string): Promise<void>;
|
||||
export declare function generateCreateBtn(): Promise<void>;
|
@ -1,2 +0,0 @@
|
||||
export declare function cleanSubscriptions(): void;
|
||||
export declare function addSubscription(element: Element | Document, event: any, eventHandler: EventListenerOrEventListenerObject): void;
|
5
ihm_client/dist/types/websockets.d.ts
vendored
5
ihm_client/dist/types/websockets.d.ts
vendored
@ -1,5 +0,0 @@
|
||||
import type { AnkFlag } from 'pkg/sdk_client';
|
||||
export declare function initWebsocket(url: string): Promise<void>;
|
||||
export declare function sendMessage(flag: AnkFlag, message: string): void;
|
||||
export declare function getUrl(): string;
|
||||
export declare function close(): void;
|
@ -1,26 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="author" content="4NK">
|
||||
<meta name="description" content="4NK Web5 Platform">
|
||||
<meta name="keywords" content="4NK web5 bitcoin blockchain decentralize dapps relay contract">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="./style/4nk.css">
|
||||
<script src="https://unpkg.com/html5-qrcode"></script>
|
||||
<title>4NK Application</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="header-container"></div>
|
||||
<div id="containerId" class="container">
|
||||
<!-- 4NK Web5 Solution -->
|
||||
</div>
|
||||
<!-- <script type="module" src="/src/index.ts"></script> -->
|
||||
<script type="module">
|
||||
import { init } from '/src/router.ts';
|
||||
(async () => {
|
||||
await init();
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
1
ihm_client/node_modules/.bin/acorn
generated
vendored
1
ihm_client/node_modules/.bin/acorn
generated
vendored
@ -1 +0,0 @@
|
||||
../acorn/bin/acorn
|
1
ihm_client/node_modules/.bin/ansi-html
generated
vendored
1
ihm_client/node_modules/.bin/ansi-html
generated
vendored
@ -1 +0,0 @@
|
||||
../ansi-html-community/bin/ansi-html
|
1
ihm_client/node_modules/.bin/browserslist
generated
vendored
1
ihm_client/node_modules/.bin/browserslist
generated
vendored
@ -1 +0,0 @@
|
||||
../browserslist/cli.js
|
1
ihm_client/node_modules/.bin/ejs
generated
vendored
1
ihm_client/node_modules/.bin/ejs
generated
vendored
@ -1 +0,0 @@
|
||||
../ejs/bin/cli.js
|
1
ihm_client/node_modules/.bin/envinfo
generated
vendored
1
ihm_client/node_modules/.bin/envinfo
generated
vendored
@ -1 +0,0 @@
|
||||
../envinfo/dist/cli.js
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user