Documentation / 08
Telegram Evidence: Hash Chains & Signatures
Messages change. Your record of what you saw shouldn't, and anyone should be able to check that.
Two small experiments below. Fake messages, everything runs in your browser, nothing goes to Telegram.
From a chat export to a verifiable record
A Telegram Desktop export saves the history you can see right now as HTML or JSON. TgWitness adds a running journal of changes, signatures on every record and checkpoints others can compare against.
| Task | Telegram Desktop export | TgWitness |
|---|---|---|
| Read saved conversations | HTML or JSON with selected media | Saved chats, searchable journal and offline reports |
| Follow a change over time | The history available when exported | Old versions, later edits and deletions, all kept |
| Check files after handover | Standard HTML/JSON export files are unsigned | Signed manifest, signed records and sealed reports, checked against a trusted key |
| Compare with an earlier retained state | Keep a separate reference copy or hash | Signed checkpoints, a separate witness and optional external timestamps |
The comparison is based on the Telegram Desktop export code as of 2 November 2026.
One message, three observations
A new message, an edit and a deletion become three separate records. The edit doesn't overwrite the first one, and the deletion doesn't erase it.
The message has disappeared from the chat view.
- 01✓
message.newMeet at 10:00
- 02✓
message.editedMeet at 11:00
- 03✓
message.deletedDeletion notice for #42
All three received observations remain in the journal.
Change a record. Follow the hash.
Every record contains the hash of the one before it. A checkpoint kept somewhere else pins the journal length and the last hash.
h₁ = SHA-256(e₁)Links to 64 zeroesh₂ = SHA-256(e₂)Includes h₁h₃ = SHA-256(e₃)Includes h₂h₃Compare this fixed boundary with the supplied journal.Altering an event changes its hash. Rebuilding the chain changes its head. Removing the tail makes it shorter than the retained checkpoint.
Inspect record 2 and the full hashes
This is the exact UTF-8 JSON hashed in this example. Values are fictional; the nine fields and serialization match the journal format.
- Saved record 2 hash
- Recalculated record 2 hash
The actual rules, in a few lines
hi = hex(SHA-256(C(ei)))
σi = Ed25519.Sign(sk, unhex(hi))
C is the nine event fields as UTF-8 JSON: sorted keys, no extra whitespace, no ASCII escaping, no NaN/infinity. previous_hash is hi−1, h0 is 64 zeros, signatures cover the 32 raw digest bytes.
The fields: seq, observed_at, source_at, kind, chat_id, message_id, actor_id, payload, previous_hash. Full spec: event encoding.
hexport[Ncheckpoint] = Hcheckpoint
Check the checkpoint signature against the pinned key, then compare it with the journal. A later export can be longer, but it has to match at the checkpoint.
Three questions, three different checks
Hashes and signatures against a key you trust.
02 / CONTINUITYWhat was retained earlier?Compare the export with checkpoints a witness kept.
03 / DELIVERYDid these test events arrive?Send, edit and delete test messages and see what each account caught.
Signatures answer "was it changed", checkpoints answer "does it match what was there before", test messages answer "did we catch everything". What verification proves.
Next: a whole-account investigation from start to case package.
Export Clinic: watch the controlled Desktop experiment. Compare the two-minute film, the original recording and seven pairs of test exports. Local modification is disclosed.