#!/usr/bin/env bash # JesusOS BTC V3 OFFLINE SIGNER installer. No money movement. # Original Android Termux: DO NOT replace original wallet/reporter/HeavenCoin. set -euo pipefail umask 077 wallet="$HOME/jesusos-sovereign-wallet" path="$wallet/jesusos-sovereign-btc-spend-v3.mjs" expect='86d4eeaca28a2f4eac1e4c10bc8faf0fb8dfcfd85959b8c7d849ba2d6c4774eb' source_url='https://jesusos.online/_cdn/static/jesusos-sovereign-btc-spend-v3.txt' echo '=== JesusOS MAIN / owner BTC V3 OFFLINE signer ===' echo 'Original HeavenCoin, Bitcoin mining reporter, and existing running services will NOT be modified.' echo 'This installer NEVER asks for recovery words and does NOT sign or broadcast any transaction.' for cmd in node npm curl sha256sum; do command -v "$cmd" >/dev/null || { echo "Missing $cmd; no changes." >&2;exit 2; } done if [[ ! -d "$wallet" || -L "$wallet" ]];then echo 'Original owner BTC wallet directory absent. Activate V2 first. No wallet is created here.' >&2 exit 2 fi if [[ ! -f "$wallet/watch.json" || -L "$wallet/watch.json" ]];then echo 'Original owner BTC watch-only wallet not activated. V3 is not necessary yet.' >&2 exit 2 fi if [[ -L "$path" ]]; then echo 'Refusing existing script symlink.' >&2;exit 3;fi tmp='' cleanup(){ if [[ -n "$tmp" ]];then rm -f "$tmp";fi; } trap cleanup EXIT if [[ -f "$path" ]]; then printf '%s %s\n' "$expect" "$path" | sha256sum -c --status || { echo 'Existing V3 script differs. No replacement performed.' >&2;exit 3; } echo 'Existing pinned V3 source reused.' else tmp="$(mktemp "$wallet/.btc-v3-XXXXXXXX")" curl --fail --silent --show-error --location --max-time 25 "$source_url" -o "$tmp" printf '%s %s\n' "$expect" "$tmp" | sha256sum -c --status || { echo 'Downloaded V3 script checksum mismatch.' >&2;exit 3; } chmod 600 "$tmp" mv -n "$tmp" "$path" tmp='' fi printf '%s %s\n' "$expect" "$path" | sha256sum -c --status || { echo 'V3 script checksum mismatch. Nothing executed.' >&2;exit 3; } node --check "$path" echo 'Installing published pure-JS Bitcoin transaction signer, package scripts disabled.' npm install --prefix "$wallet" --save-exact --ignore-scripts --no-audit --no-fund '@scure/btc-signer@2.0.1' node "$path" --selftest node "$path" --audit echo 'V3 OFFLINE SIGNING capability installed. No transaction prepared, signed, or broadcast.' echo 'Spend planning, signing, and broadcasting are NOT started by this installer.' echo 'Production sending/broadcasting remains DISABLED in V3 pending independent security review.'