Deterministic Graph Hashing with RFC 8785 and Ed25519
How Consyllus guarantees that the same curriculum graph produces the exact same SHA-256 content hash across Electron, Node CLI, and Cloudflare Workers.
When sharing curriculum graphs across a decentralized community marketplace, a subtle engineering challenge arises: standard JSON.stringify() is not deterministic across runtimes or key insertion orders.
Why Canonical JSON Matters for Knowledge Graphs
If a creator signs a Linear Algebra graph on Windows Desktop and a learner verifies that signature in memory before saving to disk, a single reordered property key or whitespace difference would invalidate the Ed25519 signature.
Consyllus solves this by enforcing RFC 8785 (JSON Canonicalization Scheme) combined with a strict 5-field metadata whitelist (subject, subject_type, references, author_id, gen_by):
- Deterministic Array Ordering: Nodes are sorted by hierarchical ID (
id), edges by(from, to), and concepts byid. - Recursive Lexicographical Key Sorting: Every JSON object key is sorted by UTF-16 code units with zero whitespace.
- Volatile Metadata Exclusion: Fields like
last_updated,content_hash, andsignatureare excluded from the hashable payload, allowing the main process to writemeta.signatureback intograph.jsonwithout mutatingcontent_hashor breaking localprogress.jsonbindings.