sdk_relay/docs/ANALYSE.md
Omar Oughriss ba40d40fa5
All checks were successful
build-and-push-int-dev / build_push (push) Successful in 1m22s
Replace 'ext' tag with 'int-dev'
2025-09-22 15:02:56 +02:00

2.7 KiB
Raw Blame History

Analyse détaillée

Périmètre

Service Rust sdk_relay interfaçant Bitcoin (RPC), Blindbit et WebSocket, avec configuration injectée.

Stack

  • Langage: Rust 2021
  • Dépendances: tokio, tokio-tungstenite, zeromq, bitcoincore-rpc, serde[_json], env_logger, futures-util, sdk_common (git, branche dev, features parallel, blindbit-backend).

Build et image

  • Docker multiétapes: build dans rust:latest avec SSH pour deps privées, exécution debian:bookworm-slim.
  • Binaire: /usr/local/bin/sdk_relay.
  • Conf: buildarg CONF écrit dans /home/bitcoin/.conf.
  • Volumes: /home/bitcoin/.4nk, /home/bitcoin/.bitcoin.

Réseau et healthcheck

  • WebSocket: serveur lié sur Config.ws_url (ex. 0.0.0.0:8090) via tokio_tungstenite.
  • Health: serveur TCP léger interne sur port 8091 retournant {"status":"ok"}.
  • Ports exposés: 8090 (WS), 8091 (HTTP /health) dans le Dockerfile.

Références code:

async fn handle_health_endpoint(mut stream: TcpStream) {
    let response = "HTTP/1.1 200 OK\r\nContent-Type: application/json\r\nContent-Length: 15\r\n\r\n{\"status\":\"ok\"}";
    let _ = stream.write_all(response.as_bytes()).await;
    let _ = stream.shutdown().await;
}

async fn start_health_server(port: u16) { /* ... */ }

// Start health server on port 8091
tokio::spawn(start_health_server(8091));

Configuration:

core_url=""
ws_url=""
wallet_name="default"
network="signet"
electrum_url="tcp://localhost:60601"
blindbit_url="tcp://localhost:8000"
zmq_url=""

Logs

  • RUST_LOG géré par env; dans lecoffre_node, sortie tee vers /home/bitcoin/.4nk/logs/sdk_relay.log.

Risques et points dattention

  • Dépendance sdk_common via git/branche dev: geler par tag/commit pour reproductibilité.
  • Image dexécution embarque strace; vérifier nécessité en prod.
  • Permissions volume Windows: note de chown partiel dans compose parent.

Actions proposées

  • Pinner sdk_common sur un commit ou tag; documenter politique de mise à jour.
  • Séparer images -dev et -prod si strace non requis.
  • Documenter format du fichier de conf (sdk_relay.conf) et valeurs par défaut.

CI / Image

  • Pipeline build-and-push-int-dev construit et pousse limage avec un tag calculé depuis le message de commit (préfixe ci: docker_tag= sinon dev-test).
  • Limage expose 8090 8091 et lance sdk_relay --config /home/bitcoin/.conf.

Références:

EXPOSE 8090 8091
ENTRYPOINT ["sdk_relay", "--config", "/home/bitcoin/.conf"]
name: build-and-push-int-dev