Initial commit: VaultMesh Skills collection

Collection of operational skills for VaultMesh infrastructure including:
- backup-sovereign: Backup and recovery operations
- btc-anchor: Bitcoin anchoring
- cloudflare-tunnel-manager: Cloudflare tunnel management
- container-registry: Container registry operations
- disaster-recovery: Disaster recovery procedures
- dns-sovereign: DNS management
- eth-anchor: Ethereum anchoring
- gitea-bootstrap: Gitea setup and configuration
- hetzner-bootstrap: Hetzner server provisioning
- merkle-forest: Merkle tree operations
- node-hardening: Node security hardening
- operator-bootstrap: Operator initialization
- proof-verifier: Cryptographic proof verification
- rfc3161-anchor: RFC3161 timestamping
- secrets-vault: Secrets management

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Vault Sovereign
2025-12-27 00:25:00 +00:00
commit eac77ef7b4
213 changed files with 11724 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
source "$SCRIPT_DIR/_common.sh"
main() {
need bitcoin-cli
need xxd
need jq
# connectivity
flag="$(net_flag)"
bitcoin-cli $flag getblockchaininfo >/dev/null 2>&1 || die "bitcoin-cli cannot reach node (check RPC creds, network)."
log_info "Preflight OK. Network=$BTC_NETWORK"
}
main "$@"

View File

@@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
source "$SCRIPT_DIR/_common.sh"
: "${BTC_NETWORK:=testnet}"
: "${BTC_FEE_RATE:=5}"
: "${OP_RETURN_PREFIX:=VM}"
main() {
root_hex="$(read_root_hex)"
prefix_hex="$(ascii_to_hex "$OP_RETURN_PREFIX")"
payload="${prefix_hex}${root_hex}"
# OP_RETURN payload max is 80 bytes standard; we keep under 80 bytes (160 hex chars)
payload="${payload:0:160}"
echo "[PLAN] $(date -Iseconds) BTC Anchor"
echo "[PLAN] Network: $BTC_NETWORK"
echo "[PLAN] Fee rate (sat/vB): $BTC_FEE_RATE"
echo "[PLAN] Prefix: $OP_RETURN_PREFIX (hex: $prefix_hex)"
echo "[PLAN] Root hex (raw): $root_hex"
echo "[PLAN] OP_RETURN payload hex: $payload"
echo "[PLAN] Will create OP_RETURN tx via wallet RPCs: createrawtransaction -> walletcreatefundedpsbt -> walletprocesspsbt -> finalizepsbt -> sendrawtransaction"
echo "[PLAN] Next: export DRY_RUN=0 && ./scripts/11_apply.sh"
}
main "$@"

View File

@@ -0,0 +1,75 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
SKILL_ROOT="$(dirname "$SCRIPT_DIR")"
source "$SCRIPT_DIR/_common.sh"
: "${BTC_NETWORK:=testnet}"
: "${BTC_FEE_RATE:=5}"
: "${OP_RETURN_PREFIX:=VM}"
: "${LABEL:=btc-anchor}"
main() {
confirm_gate
flag="$(net_flag)"
mkdir -p "$SKILL_ROOT/outputs/runs"
ts="$(date -Iseconds | tr ':' '-')"
run_dir="$SKILL_ROOT/outputs/runs/${LABEL}_${ts}"
mkdir -p "$run_dir"
root_hex="$(read_root_hex)"
echo "$root_hex" > "$run_dir/root_hex.txt"
prefix_hex="$(ascii_to_hex "$OP_RETURN_PREFIX")"
payload="${prefix_hex}${root_hex}"
payload="${payload:0:160}"
echo "$payload" > "$run_dir/op_return_hex.txt"
# 1) create raw tx with single OP_RETURN output (no inputs yet)
raw="$(bitcoin-cli $flag createrawtransaction "[]" "{\"data\":\"$payload\"}")"
# 2) fund via PSBT
funded="$(bitcoin-cli $flag walletcreatefundedpsbt "[]" "{\"data\":\"$payload\"}" 0 "{\"fee_rate\":$BTC_FEE_RATE}")"
psbt="$(echo "$funded" | jq -r '.psbt')"
[[ -n "$psbt" && "$psbt" != "null" ]] || die "walletcreatefundedpsbt did not return psbt"
# 3) process (sign) psbt
processed="$(bitcoin-cli $flag walletprocesspsbt "$psbt")"
psbt2="$(echo "$processed" | jq -r '.psbt')"
# 4) finalize
finalized="$(bitcoin-cli $flag finalizepsbt "$psbt2")"
hex="$(echo "$finalized" | jq -r '.hex')"
complete="$(echo "$finalized" | jq -r '.complete')"
[[ "$complete" == "true" ]] || die "finalizepsbt not complete"
echo "$hex" > "$run_dir/rawtx.hex"
# 5) send
txid="$(bitcoin-cli $flag sendrawtransaction "$hex")"
[[ -n "$txid" ]] || die "Failed to send tx"
echo "$txid" > "$run_dir/txid.txt"
# proof
cat > "$run_dir/PROOF.json" <<EOF
{
"skill": "btc-anchor",
"version": "1.0.0",
"timestamp": "$(date -Iseconds)",
"network": "$BTC_NETWORK",
"fee_rate_sat_vb": "$BTC_FEE_RATE",
"op_return_prefix": "$(json_escape "$OP_RETURN_PREFIX")",
"op_return_hex": "$(json_escape "$payload")",
"root_hex": "$(json_escape "$root_hex")",
"txid": "$(json_escape "$txid")",
"artifacts": {
"root_hex_file": "root_hex.txt",
"op_return_hex_file": "op_return_hex.txt",
"rawtx": "rawtx.hex",
"txid_file": "txid.txt"
}
}
EOF
echo "$run_dir" > "$SKILL_ROOT/outputs/last_run_dir.txt"
log_info "Anchored on BTC ($BTC_NETWORK). txid=$txid"
log_info "Run dir: $run_dir"
}
main "$@"

View File

@@ -0,0 +1,48 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
SKILL_ROOT="$(dirname "$SCRIPT_DIR")"
source "$SCRIPT_DIR/_common.sh"
: "${BTC_NETWORK:=testnet}"
main() {
[[ -f "$SKILL_ROOT/outputs/last_run_dir.txt" ]] || die "No last run."
run_dir="$(cat "$SKILL_ROOT/outputs/last_run_dir.txt")"
status="$run_dir/status_matrix.json"
flag="$(net_flag)"
ok_proof=false; ok_txid=false; ok_seen=false
[[ -f "$run_dir/PROOF.json" ]] && ok_proof=true
if [[ -f "$run_dir/txid.txt" ]]; then
txid="$(cat "$run_dir/txid.txt")"
[[ -n "$txid" ]] && ok_txid=true
if bitcoin-cli $flag getrawtransaction "$txid" >/dev/null 2>&1; then
ok_seen=true
fi
fi
blockers="[]"
if [[ "$ok_txid" != "true" ]]; then blockers='["missing_txid"]'
elif [[ "$ok_seen" != "true" ]]; then blockers='["tx_not_found_yet_mempool_or_index"]'
fi
cat > "$status" <<EOF
{
"skill": "btc-anchor",
"timestamp": "$(date -Iseconds)",
"run_dir": "$(json_escape "$run_dir")",
"checks": [
{"name":"proof_present", "ok": $ok_proof},
{"name":"txid_present", "ok": $ok_txid},
{"name":"tx_seen_by_node", "ok": $ok_seen}
],
"blockers": $blockers,
"warnings": [],
"next_steps": ["proof-verifier"]
}
EOF
log_info "Wrote $status"
cat "$status"
}
main "$@"

View File

@@ -0,0 +1,36 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
SKILL_ROOT="$(dirname "$SCRIPT_DIR")"
source "$SCRIPT_DIR/_common.sh"
main() {
[[ -f "$SKILL_ROOT/outputs/last_run_dir.txt" ]] || die "No last run."
run_dir="$(cat "$SKILL_ROOT/outputs/last_run_dir.txt")"
report="$run_dir/audit_report.md"
status="$run_dir/status_matrix.json"
txid="$(cat "$run_dir/txid.txt" 2>/dev/null || true)"
root_hex="$(cat "$run_dir/root_hex.txt" 2>/dev/null || true)"
cat > "$report" <<EOF
# BTC Anchor Audit Report
**Generated:** $(date -Iseconds)
**Run Dir:** \`$run_dir\`
**TXID:** \`$txid\`
**Root Hex:** \`$root_hex\`
**Skill Version:** 1.0.0
## Status Matrix
$(if [[ -f "$status" ]]; then echo '```json'; cat "$status"; echo '```'; else echo "_Missing status_matrix.json_"; fi)
## EU Compliance
EU (Ireland - Dublin), Irish jurisdiction. Anchors are public chain data.
EOF
log_info "Wrote $report"
cat "$report"
}
main "$@"

View File

@@ -0,0 +1,55 @@
#!/usr/bin/env bash
set -euo pipefail
log_info(){ echo "[INFO] $(date -Iseconds) $*"; }
log_warn(){ echo "[WARN] $(date -Iseconds) $*" >&2; }
log_error(){ echo "[ERROR] $(date -Iseconds) $*" >&2; }
die(){ log_error "$*"; exit 1; }
need(){ command -v "$1" >/dev/null 2>&1 || die "Missing required tool: $1"; }
confirm_gate() {
: "${DRY_RUN:=1}"
: "${REQUIRE_CONFIRM:=1}"
: "${CONFIRM_PHRASE:=I UNDERSTAND THIS WILL BROADCAST A BITCOIN TX}"
[[ "$DRY_RUN" == "0" ]] || die "DRY_RUN=$DRY_RUN (set DRY_RUN=0)."
if [[ "$REQUIRE_CONFIRM" == "1" ]]; then
echo "Type to confirm:"
echo " $CONFIRM_PHRASE"
read -r input
[[ "$input" == "$CONFIRM_PHRASE" ]] || die "Confirmation phrase mismatch."
fi
}
json_escape() {
local s="$1"
s="${s//\\/\\\\}"; s="${s//\"/\\\"}"; s="${s//$'\n'/\\n}"
printf "%s" "$s"
}
read_root_hex() {
: "${ROOT_HEX:=}"
: "${ROOT_FILE:=}"
if [[ -n "$ROOT_HEX" ]]; then
echo "${ROOT_HEX#0x}"
return 0
fi
[[ -n "$ROOT_FILE" ]] || die "Set ROOT_HEX or ROOT_FILE."
[[ -f "$ROOT_FILE" ]] || die "ROOT_FILE not found: $ROOT_FILE"
rh="$(grep '^root_hex=' "$ROOT_FILE" | head -n1 | cut -d= -f2)"
[[ -n "$rh" ]] || die "Could not parse root_hex from ROOT_FILE."
echo "${rh#0x}"
}
net_flag() {
: "${BTC_NETWORK:=testnet}"
case "$BTC_NETWORK" in
mainnet) echo "" ;;
testnet) echo "-testnet" ;;
signet) echo "-signet" ;;
*) die "BTC_NETWORK must be mainnet|testnet|signet" ;;
esac
}
ascii_to_hex() {
# portable: use xxd
echo -n "$1" | xxd -p -c 256 | tr -d '\n'
}

View File

@@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
SKILL_ROOT="$(dirname "$(dirname "$SCRIPT_DIR")")"
source "$SKILL_ROOT/scripts/_common.sh"
main() {
confirm_gate
if [[ ! -f "$SKILL_ROOT/outputs/last_run_dir.txt" ]]; then
log_warn "No last run; nothing to undo."
exit 0
fi
run_dir="$(cat "$SKILL_ROOT/outputs/last_run_dir.txt")"
log_warn "Removing last run artifacts (cannot undo broadcast tx): $run_dir"
rm -rf "$run_dir" || true
rm -f "$SKILL_ROOT/outputs/last_run_dir.txt" || true
log_info "Local rollback complete (chain tx remains)."
}
main "$@"