┌──────────────────┐
│ CORE LN │
│ │
│ │
│ - lightningd │
│ - channeld │
│ - openingd │
│ │
└────────▲─────────┘
│
│
│ UNIX FILE DESCRIPTORS
│
HSMD │
┌─────────────────────────────┼──────────────────────────────────────┐
│ │ │
│ ┌──────────┼───────────┐ │
│ │ │ │ │
│ │ ┌────────▼─────────┐ │ │
│ │ │ CLN CLIENT │ │ │
│ │ │ │ │ │
│ │ │ │ │ │
│ BROKER │ │ SIGNER LOOP │ │ --------- BITCOIND │
│ │ └────────▲─────────┘ │ │
│ │ │ │ │
│ │ │ │ │
│ │ | MPSC │ │
│ │ │ │ │
│ │ │ │ │
│ │ ┌──────▼──────┐ │ │
│ │ │ MQTT BROKER │ │ │
│ │ └──────▲──────┘ │ │
│ │ │ │ │
│ └──────────┼───────────┘ │
│ │ │
│ │ │
│ │ MQTT │
│ │ │
│ │ │
│ ┌────────────┼────────────┐ │
│ │ │ │ │
│ │ ┌──────▼──────┐ │ │
│ │ │ MQTT CLIENT │ │ │
│ │ └──────▲──────┘ │ │
│ │ │ │ │
│ SPHINX-KEY │ │ │ │
│ │ │ MPSC │ │
│ │ │ │ │
│ │ │ │ │
│ │ ┌──────────▼──────────┐ │ │
│ │ │ VLS PROTOCOL SIGNER │ │ │
│ │ └──────────▲──────────┘ │ │
│ │ │ │ │
│ │ │ │ │
│ │ │ HAL SPI │ │
│ │ │ │ │
│ │ │ │ │
│ │ ┌───────▼───────┐ │ │
│ │ │ SD CARD, LEDs │ │ │
│ │ └───────────────┘ │ │
│ │ │ │
│ └─────────────────────────┘ │
│ │
└────────────────────────────────────────────────────────────────────┘
HSMD
: Daemon taken out of Core Lightning that handles private key material, and serves signing requests remotely.BROKER
: Proxies HSMD requests fromCORE LN
toSPHINX-KEY
via MQTT.SPHINX-KEY
: Stores the private keys, and responds to signing requests.
CORE LN
: Sends HSMD requests toCLN CLIENT
via UNIX file descriptors.CLN CLIENT
: Reads and writes HSMD requests and responses via UNIX file descriptors. Lives inbroker/unix_fd.rs
.SIGNER LOOP
: Loops on HSMD requests received onCLN CLIENT
, and sends them toMQTT BROKER
via ruststd::sync::mpsc
thread communication channels. Lives inbroker/unix_fd.rs
.MQTT BROKER
: Receives requests fromSIGNER LOOP
viampsc
channels, and sends them toSPHINX KEY
over the internet via authenticated MQTT. Lives inbroker/mqtt.rs
.BITCOIND
: Provides on-chain data toBROKER
for validation of the operations ofVLS PROTOCOL SIGNER
.MQTT CLIENT
: Receives MQTT messages fromMQTT BROKER
over the internet and sends them toVLS PROTOCOL SIGNER
viampsc
channels.MQTT CLIENT
lives insphinx-key/src/conn/mqtt.rs
andVLS PROTOCOL SIGNER
lives insigner/src/lib.rs
.SD CARD
: Persists data fromVLS PROTOCOL SIGNER
. Communicates withVLS PROTOCOL SIGNER
via the SPI protocol implemented inesp_idf_hal::spi
.LEDs
: Show users and engineers the state of the sphinx-key, for both UX and debugging. Also communicate withVLS PROTOCOL SIGNER
viaesp_idf_hal::spi
.
Paste the code block above into asciiblock.com
to make edits. Then press the download button on the top right of the pane to bring it back here.