Hash Chain
Every event in Trailproof is linked to the previous one through a SHA-256 hash. This creates a chain where modifying any event breaks every link after it.The hash chain design is adopted from Attesta’s proven production implementation.
How It Works
- The first event uses a genesis hash — 64 zeros (
"0" x 64) — as itsprev_hash - Each event’s
hashis computed asSHA-256(prev_hash + canonical_json(event)) - The next event’s
prev_hashis set to the current event’shash
Why It Catches Tampering
If someone modifies event 5 in a chain of 100:- Event 5’s recomputed hash no longer matches its stored
hash - Event 6’s
prev_hashno longer matches event 5’s new hash - Events 6 through 100 all fail verification — cascading break
Verification
Trailproof walks the entire chain and recomputes every hash:{ intact: true, total: 0, broken: [] }.
Cross-SDK Parity
Both the Python and TypeScript SDKs produce identical hashes for the same event data. This is guaranteed by:- Shared canonical JSON algorithm (sorted keys, compact format, no nulls)
- Shared genesis hash
- Shared test vectors in
fixtures/test-vectors.json
Next Steps
Canonical JSON
How events are serialized for deterministic hashing.
Verification Guide
Practical guide to verifying chain integrity.