Mental model
Decentralized data provenance ties an outside observation to the exact bytes and model that used it. An oracle supplies an answer and update time; a content identifier names data blocks; a storage protocol records a provider’s commitment; and a provenance manifest records which agents and activities produced a dataset or model. Each layer backs a different claim, and none alone proves that the final result is correct.
Theory
Oracle read and freshness
An oracle bridges information that a blockchain cannot observe directly, such as an exchange price or weather reading. In a Chainlink Data Feed, independent nodes collect off-chain observations and an oracle network publishes an aggregated answer to an on-chain aggregator. A proxy provides the consumer contract with a stable address while the underlying aggregator can be upgraded. That architecture gives a smart contract a queryable answer; it does not turn an external measurement into ground truth.
The consumer calls latestRoundData() and receives a round identifier, signed answer, round start time, update time, and a legacy answeredInRound field. Current integrations should use updatedAt to enforce application-specific freshness rather than assuming that a nonzero answer is current. Read decimals() as well: an answer of 250000000000 with eight decimals represents 2,500, while treating the integer as a whole number is a large unit error. Check the configured proxy address, chain, feed description, sign, and acceptable value range at deployment and operation time.
Feeds can update after either a deviation threshold is exceeded or a heartbeat expires. Therefore an on-chain answer can legitimately remain unchanged during a quiet market and can become stale if the network or feed stops updating. A heartbeat is a configured trigger, not a guarantee that every application may safely use the answer for that entire interval. Lending, liquidation, and settlement systems need different maximum ages and circuit breakers based on the cost of acting on old data.
Content identifiers and storage commitments
IPFS addresses content by a CID. A CID encodes more than a raw file hash: its version, codec, and multihash identify how to interpret and verify the addressed block. Files and directories can be chunked into a DAG, so a root CID commits to the encoded graph. If the retrieved blocks do not match the hashes in that graph, a conforming client rejects them. This check proves byte integrity relative to the CID; it does not prove who created the bytes, when they were published, or whether anyone will continue serving them.
Availability is a separate promise. A node may fetch and validate an IPFS object today, then find no reachable provider later. Pinning services and gateways affect retrieval, but a successful pin response is not an independent proof that an object will remain available for a stated term. Filecoin storage deals add an economic and protocol commitment: a provider seals client data and submits Proof-of-Replication, then submits periodic Proofs-of-Spacetime for stored sectors. Those proofs attest to storage obligations under the deal and protocol; an application still needs to test retrieval, renew or replace expiring deals, and monitor provider faults.
Keep these claims distinct in a system report:
| Evidence | What it supports | What it does not establish |
|---|---|---|
| Oracle round and updatedAt | Which answer a contract read and when the feed updated it | That the source measurement was truthful |
| CID multihash verification | Retrieved blocks match the CID’s content commitment | Continued retrieval or provenance |
| Storage deal and periodic proofs | A provider met defined storage protocol obligations | Fast retrieval by a particular consumer |
| Signed provenance manifest | A named signer asserted a chain of derivations | That the signer’s claims are honest |
Provenance manifest
The W3C PROV model represents provenance through entities, activities, and agents, with relations such as used, wasGeneratedBy, and wasAssociatedWith. For model-data lineage, entities can include a raw observation file, a normalized dataset, a training configuration, and the resulting model artifact. Activities describe fetch, transformation, training, evaluation, and release; agents identify the oracle adapter, data steward, training job, or release service responsible for each activity.
A useful manifest records feed address and chain identifier, round ID, answer and decimals, updatedAt, the finalized block hash, source-data CID, transformed-dataset CID, schema version, preprocessing code commit, model artifact CID, evaluation report CID, and signer key ID. Sign a canonical serialization and publish its CID or digest alongside the release. Avoid putting credentials, private source records, or personal data on a public chain. A digest can bind these fields together without publishing the full manifest, but auditors must still retrieve the manifest, validate the signature, and verify each referenced object.
Freshness calculation and worked example
For a read at block timestamp and a feed’s updatedAt timestamp , calculate the age in seconds and apply a maximum-age policy:
Here and are Unix timestamps in seconds, is the answer’s age in seconds, and is the application’s maximum permitted age in seconds. Suppose a block timestamp is 1,800,000,000, the feed updated at 1,799,999,945, and a lending market sets . The answer is 55 seconds old, so it passes this freshness predicate. At block timestamp 1,800,000,040 the same update is 95 seconds old and must be rejected. A passing timestamp check does not validate the price source, decimals, or underlying market conditions.
To make an audit record tamper-evident, bind the context fields with an unambiguous ABI encoding:
is a 32-byte digest; answer is the signed feed integer interpreted with decimals, updatedAt is Unix seconds, and manifestDigest is the 32-byte digest of the signed lineage manifest. An auditor can recompute from a recorded event and detect a changed field. The hash proves only that the fields were bound together; it does not prove that the observation was accurate or that the manifest is still retrievable.
Implementation example
This Solidity guard is for a positive price feed. The deployment must pin the intended proxy address, chain, asset pair, and maximum age. It checks the round timestamp and emits a digest binding the round to a manifest digest; it deliberately does not claim to retrieve IPFS content or validate a signer.
soliditypragma solidity ^0.8.24;interface AggregatorV3 {function decimals() external view returns (uint8);function latestRoundData() external view returns (uint80, int256, uint256, uint256, uint80);}contract FeedProvenanceGate {error InvalidConfig();error InvalidAnswer();error InvalidTimestamp();error StaleAnswer();error InvalidManifest();error UnsupportedDecimals();AggregatorV3 public immutable feed;uint256 public immutable maxAge;event ProvenanceBound(uint80 indexed roundId,bytes32 indexed binding,bytes32 manifestDigest,int256 answer,uint8 decimals,uint256 updatedAt);constructor(address feed_, uint256 maxAge_) {if (feed_ == address(0) || maxAge_ == 0) revert InvalidConfig();feed = AggregatorV3(feed_);maxAge = maxAge_;}function validateAndAnchor(bytes32 manifestDigest)external returns (uint80 roundId, int256 answer, uint8 places, uint256 updatedAt, bytes32 binding){if (manifestDigest == bytes32(0)) revert InvalidManifest();(roundId, answer, , updatedAt, ) = feed.latestRoundData();if (answer <= 0) revert InvalidAnswer();if (updatedAt == 0 || updatedAt > block.timestamp) revert InvalidTimestamp();if (block.timestamp - updatedAt > maxAge) revert StaleAnswer();places = feed.decimals();if (places > 18) revert UnsupportedDecimals();binding = keccak256(abi.encode(block.chainid, address(feed), roundId, answer, places, updatedAt, manifestDigest));emit ProvenanceBound(roundId, binding, manifestDigest, answer, places, updatedAt);}}
Failure modes and misconceptions
A fresh answer is a trustworthy answer. Freshness only bounds age. A feed may reflect a bad upstream market, a wrong asset pair, or a value that is valid for a different chain. Verify the proxy and decimals, set plausible bounds, monitor source status, and define when the consumer must pause.
A CID guarantees permanent storage. It lets a client validate addressed bytes after retrieval. It does not make a provider keep a copy or guarantee that a gateway can find one. Track pins and storage deal terms, test retrieval from independent providers, and alert before a deal expires.
A storage proof proves availability to my application. Filecoin proofs attest to protocol storage obligations for sectors and periods. They are not a latency service-level agreement, and they do not mean a specific retrieval path is reachable at request time. Test the full read path and keep a recovery source.
A hash proves the model’s result. A manifest digest makes edits detectable only when the expected digest is anchored somewhere the auditor trusts. The digest does not vouch for training data quality, code correctness, or honest signers. Retain the signed manifest, signer rotation and revocation records, and evaluation artifacts.
Trade-offs
Publishing the full manifest on-chain improves public audit access but costs gas and exposes metadata. Storing it off-chain and anchoring a digest reduces chain writes, yet auditors depend on the referenced storage remaining retrievable. More lineage fields improve reproducibility but create a signing and schema-maintenance burden. Define a canonical serialization, schema version, key rotation procedure, retention window, and a clear way to find the manifest from the release identifier.
Oracle reads add another trust and failure boundary to a data pipeline. A strict age limit reduces stale-input exposure but can halt a contract during feed delays; a loose limit preserves service while increasing the chance of using old information. Choose maxAge from the downstream loss model, not an arbitrary universal duration. For high-impact actions, fail closed and route to a pause or human review instead of silently reusing an old answer.
Decision scenario
A lending service receives an ETH/USD answer with eight decimals and a timestamp 140 seconds behind the current block; its configured limit is 90 seconds. The attached dataset CID verifies, and a storage provider has a current Filecoin proof, but the model manifest points to a different preprocessing commit than the release record. Do not use the price to liquidate accounts or promote the model release. Reject the stale round, retrieve and verify the manifest chain, reconcile the commit and dataset CIDs, then resume only after the feed and lineage checks pass. Storage proof does not compensate for a stale price or mismatched artifact.
Learning outcomes
- Distinguish oracle correctness, feed freshness, content integrity, storage commitments, and data availability.
- Calculate a feed answer’s age and apply an explicit maximum-age predicate.
- Explain what a CID and a Filecoin storage proof establish, and what they leave unproven.
- Build a PROV-style lineage record connecting data, transformations, model artifacts, and responsible agents.