multisig-hsm/reference/demo_rig.sh
mineracks 7a17ffd12e Initial public release — multisig HSM reference + recipe book
Open-source 2-of-3 policy-enforced threshold HSM: auto-signs cold→hot treasury
refills under on-device Coldcard policy, no human in the loop. Includes the full
operator manual + quick-start, the reference coordinator/signing code, and a
signer-host bootstrap. No keys, seeds, or secrets — placeholders only.

Live signet demo: https://multisighsm.mineracks.com

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 13:56:51 +10:00

46 lines
2.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# Demo rig: GUI Coldcard Mk5 sims (segregated => distinct per-PID sockets), clipped + streamed via x11vnc +
# websockify for noVNC. Each signer N uses display :10N, VNC 591N, WS 691N, socket symlink /tmp/cksim-N.sock.
# demo_rig.sh -> (re)start ALL 3 signers (used by /policy + every re-arm)
# demo_rig.sh 2 -> (re)start ONLY signer 2 (boot-to-signing-ready / reboot demo; others keep running)
set -uo pipefail
export PATH="$HOME/gccshim:$PATH"
CLIP="${CLIP:-192x328+96+90}"
RUN=~/cksim
TARGETS="${*:-1 2 3}"
cd ~/coldcard-firmware/unix
# --- kill ONLY the targeted signers' processes (so a single-N restart leaves the others alone) ---
for n in $TARGETS; do
DISP=$((100+n)); VNC=$((5910+n)); WS=$((6910+n))
oldsock=$(readlink "/tmp/cksim-$n.sock" 2>/dev/null || true)
pkill -f -- "--seed $(cat "$RUN/seeds/$n.txt")" 2>/dev/null || true
pkill -f "rfbport $VNC" 2>/dev/null || true
pkill -f "websockify $WS" 2>/dev/null || true
kill "$(cat "/tmp/.X$DISP-lock" 2>/dev/null)" 2>/dev/null || true
rm -f "/tmp/.X$DISP-lock" "/tmp/cksim-$n.sock" ${oldsock:+"$oldsock"}
done
sleep 2
# --- (re)launch the targeted signers ---
for n in $TARGETS; do
DISP=$((100+n)); VNC=$((5910+n)); WS=$((6910+n))
Xvfb :$DISP -screen 0 900x720x24 >/tmp/xvfb$n.log 2>&1 &
sleep 2
SEED=$(cat "$RUN/seeds/$n.txt")
before=$(ls /tmp/ckcc-simulator-*.sock 2>/dev/null | sort)
DISPLAY=:$DISP setsid ~/ccsim-venv/bin/python simulator.py --mk5 --segregate --seed "$SEED" >/tmp/guisim$n.log 2>&1 &
sock=""
for i in $(seq 1 25); do
now=$(ls /tmp/ckcc-simulator-*.sock 2>/dev/null | sort)
sock=$(comm -13 <(echo "$before") <(echo "$now") | grep -v '^$' | head -1)
[ -n "$sock" ] && break
sleep 1
done
ln -sf "$sock" "/tmp/cksim-$n.sock"
x11vnc -display :$DISP -clip "$CLIP" -rfbport $VNC -forever -shared -nopw -quiet -bg >/tmp/x11vnc$n.log 2>&1
setsid websockify $WS localhost:$VNC </dev/null >/tmp/ws$n.log 2>&1 &
echo "$n $sock /tmp/cksim-$n.sock :$DISP $WS"
done
echo DEMO_RIG_UP