LOGBOOK

HELP

Quiz Entry - updated: 2026.07.30

What is the Off-Chain Data Storage pattern, and what exactly does anchoring a hash on-chain protect?

Store bulky data off-chain but write only its hash (a fixed-size fingerprint) on-chain — the chain then guarantees the hash's integrity, letting anyone detect if the off-chain data was tampered with, though it cannot recover or prevent the loss of that data.

Flow: bulky raw data kept off-chain runs through a hash function to a fixed-size digest, which is anchored immutably on-chain; re-hashing the data later and comparing digests reveals whether it matches (intact) or differs (tampered).

* Anchor only the digest on-chain — re-hash and compare to detect any off-chain tampering. *

  • Problem. Full replication caps on-chain storage, and block-size limits make large data infeasible to embed (Bitcoin's OP_RETURN allowed up to 80 bytes, later cut to 40; Ethereum's gas limit caps transaction data). You still want the chain's integrity guarantee for large datasets.
  • Solution. Run the raw data through a hash function (e.g. from the SHA-2 family) — a one-way function that maps arbitrary-size input to a fixed-size digest, easy to compute but infeasible to invert, where flipping a single input bit changes the whole output. Store only that digest on-chain; keep the raw data off-chain. The on-chain hash guarantees the raw data hasn't changed.
  • Benefits. Integrity (compare off-chain data against the on-chain hash to detect any change) and cost (fixed, low storage cost regardless of data size).
  • Drawbacks. The off-chain store may be less secure (you can detect a change but can neither recover the original nor prevent the alteration); data loss (off-chain data can be deleted, leaving only its orphaned hash); data sharing needs extra off-chain machinery.

Go deeper:

From Quiz: IOTHACK / Design Patterns for Blockchain Applications | Updated: Jul 30, 2026