Skip to main content

Preimages (ζP\zeta_P)

The Preimages transition manages hash preimage storage, allowing services to request and retrieve external data by its hash.

Purpose

  • Data Availability: Make external data available on-chain
  • Hash Lookup: Services request data by hash, preimages provide the actual data
  • Storage Management: Track preimage lifetimes and cleanup

How It Works

Preimage Request

Services request data by hash during execution.

Lookup Extrinsic

Block authors include preimages in the lookup extrinsic:

lookup_extrinsic: [(ServiceId, Bytes)]

Integration

for (service_id, preimage_data) in block.extrinsic.lookup:
hash = blake2b(preimage_data)
if hash in service.requested_preimages:
service.preimages[hash] = preimage_data

Lifetime

Preimages are retained for a specified period, then pruned to save space.

References: Gray Paper Section on Preimages

Implementation: tessera/jam/state/transitions/preimages/