Explainer 04 · 10 scenes · about 8 min

Receipts you can't fake: how a hash chain works

A fingerprint for any text, a chain of receipts that each hold the fingerprint of the one before, and a seal only the business holds. Change an old record and watch every later fingerprint move. It is how INDRA's signed receipts work.

Hands on Fingerprint your own text, try to forge an old receipt, and run the verifier yourself.

Example
d80357cc

d80357cc23be07157410e5131be6e5d07da687a0654039c2afaa884750bf2e5a

  1. 01/ 10

    A fingerprint for any text

    A hash function turns any text, a word or a whole book, into a fingerprint of fixed size. SHA-256 gives 256 bits, written as 64 hexadecimal digits. The stage draws them as 64 ticks round a dial.

    The same text always gives the same fingerprint. Type into the box and watch it.

  2. 02/ 10

    Change one letter

    Change a single letter and the fingerprint changes completely, not a little. On average about half of the 256 bits flip. Cryptographers call it the avalanche effect.

    So you can't nudge a record and keep its fingerprint. Any change, however small, shows.

  3. 03/ 10

    You can't work backwards

    Going from text to fingerprint is instant. Going back is not: the only known way to find a text with a chosen fingerprint is to guess, again and again.

    Try it: ask your own browser to find a text whose fingerprint starts with a few zeros, and watch how fast the work grows.

  4. 04/ 10

    Receipts in a chain

    Now give every receipt one extra line: the fingerprint of the receipt before it. Then fingerprint the whole receipt, that line included.

    Each receipt is now tied to everything that came before. Nobody needs to trust the order; it is written into the fingerprints.

  5. 05/ 10

    Edit an old receipt

    Say someone changes receipt 2 after the fact: ₹800 becomes ₹8,000. Its fingerprint changes. Receipt 3 holds the old one, so if you rebuilt the chain, receipt 3's fingerprint would change too, then 4's, then 5's.

    One edit moves every fingerprint after it. Edit any receipt on the stage and watch the dials re-cut.

  6. 06/ 10

    Then rebuild everything after it?

    A careful forger would do exactly that: change the receipt, then recompute every later fingerprint so all the links check out again.

    It works, with one catch: the chain now ends on a different fingerprint. If a copy of the latest fingerprint was kept somewhere else (sent to the owner each night, or to an auditor), the rewrite shows.

  7. 07/ 10

    A seal only the business can make

    The second defence is a digital signature. The business signs each fingerprint with a private key it never shares. Anyone can check a signature with the matching public key, but nobody can make one without the private key.

    The forger can recompute fingerprints, but can't re-sign them. The stage made a real key pair in your browser, just now.

  8. 08/ 10

    Anyone can check

    Verifying needs no trust in whoever stored the receipts: recompute each fingerprint, check each link, check each seal with the public key, and compare the end with the copy held elsewhere.

    Run the verifier on the stage, then tamper and run it again.

  9. 09/ 10

    How INDRA writes its receipts

    In INDRA, every action by a person, an agent or the system becomes a receipt. Its fields are written as one line of JSON with the keys in a fixed order, fingerprinted with SHA-256, linked to the receipt before, and signed with the business's Ed25519 key.

    An auditor can take an export with the receipts, the public key and the rules for checking, and verify it offline. On screen, gold means one thing: the signature verified. Open the INDRA live demo.

  10. 10/ 10

    What it can't prove

    A chain of signed receipts proves that the record wasn't changed after it was written, and who wrote it. It doesn't prove the record was true. That is what the person's approval, and the evidence beside it, are for.

    It is also our name: वृत्तान्त, vṛttānta, means an account of what happened.

01In plain words

The short version.

  1. A hash function gives any text a fixed-size fingerprint. Change one letter and about half the fingerprint's bits flip.

  2. You can't work backwards from a fingerprint; the only known way is guessing, and for SHA-256 that would take longer than the age of the universe.

  3. Put each receipt's fingerprint into the next receipt and you get a chain: change an old record and every later fingerprint moves.

  4. A forger could rebuild the chain, so two more defences: a signature only the business can make, and a copy of the latest fingerprint kept somewhere else.

  5. It proves the record wasn't changed after it was written. Whether it was true is the job of the person who approved it.

02Sources

Where the facts come from.

  1. FIPS 180-4: Secure Hash Standard (SHS)

    NIST · August 2015 · defines SHA-256

  2. How to time-stamp a digital document

    Stuart Haber and W. Scott Stornetta, Journal of Cryptology 3(2) · 1991 · chaining records by hash

  3. RFC 8032: Edwards-Curve Digital Signature Algorithm (EdDSA)

    IETF (Josefsson, Liusvaara) · January 2017 · Ed25519 signatures

  4. RFC 9162: Certificate Transparency Version 2.0

    IETF (Laurie, Messeri, Stradling) · December 2021 · public append-only logs whose latest state others keep copies of

Example

The receipts on the stage are examples. The fingerprints are real SHA-256 and the seals are real signatures, both made in your browser; nothing is sent anywhere. INDRA's receipt fields are shown with example values.

Want this working in your business?

Tell us the job. A person reads every request and replies by email.