genesis.py
python
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
3 days ago
| 1 | """Ledger genesis constant and entry factory (§K9.7).""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | import hashlib |
| 6 | from datetime import datetime, timezone |
| 7 | from typing import Any |
| 8 | |
| 9 | from tools.honesty.canonical import compute_entry_hash |
| 10 | |
| 11 | _GENESIS_SEED = b"overseer-kit-honesty-ledger-v1" |
| 12 | GENESIS_PREV = hashlib.sha256(_GENESIS_SEED).hexdigest().lower() |
| 13 | |
| 14 | |
| 15 | def utc_now_z() -> str: |
| 16 | """Return ISO-8601 UTC timestamp with ``Z`` suffix.""" |
| 17 | return datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ") |
| 18 | |
| 19 | |
| 20 | def build_genesis_entry(ts: str | None = None) -> dict[str, Any]: |
| 21 | """Construct a genesis ledger entry with server-filled hashes.""" |
| 22 | timestamp = ts or utc_now_z() |
| 23 | body: dict[str, Any] = { |
| 24 | "v": 1, |
| 25 | "ts": timestamp, |
| 26 | "kind": "genesis", |
| 27 | "prev_hash": GENESIS_PREV, |
| 28 | } |
| 29 | body["entry_hash"] = compute_entry_hash(body) |
| 30 | return body |
File History
2 commits
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
3 days ago
sha256:4671b7f787ddbe63ced31c895b688c77ab495653b65a730b423329f26b3c1439
feat: K1-P1 complete — agent provenance, build-verification…
Sonnet 4.6
patch
54 days ago