mirror of
https://github.com/JGoyd/JGoyd.git
synced 2026-06-25 09:09:57 +02:00
4ed1ae48b1
Cases
25 lines
870 B
Bash
25 lines
870 B
Bash
#!/usr/bin/env bash
|
|
# upgrade_ots.sh — Walk every .ots in /evidence and run `ots upgrade` to pull
|
|
# the latest Bitcoin attestation into the file. Safe to run on a cron.
|
|
#
|
|
# Usage: ./upgrade_ots.sh /path/to/evidence/root
|
|
#
|
|
# A fresh `ots stamp` produces an incomplete proof referencing a calendar
|
|
# server. After the next Bitcoin block confirms (~10 min) and a few more
|
|
# confirmations land, `ots upgrade` rewrites the .ots file in-place to include
|
|
# the full Bitcoin-attested proof. Once upgraded, the .ots file is permanently
|
|
# verifiable even if every calendar server disappears.
|
|
|
|
set -euo pipefail
|
|
|
|
ROOT="${1:-./evidence}"
|
|
if [[ ! -d "$ROOT" ]]; then
|
|
echo "not a directory: $ROOT" >&2
|
|
exit 66
|
|
fi
|
|
|
|
find "$ROOT" -name '*.ots' -print0 | while IFS= read -r -d '' f; do
|
|
echo "upgrading: $f"
|
|
ots upgrade "$f" || echo " (still pending — try again later)"
|
|
done
|