Concepts
Verification and trust
What a reader checks, what it still trusts, and what Portaldot's validators guarantee.
Integrity: trust nothing
Every read path goes through one function. It asks a node for a block by CID and refuses the bytes unless their blake2b-256 hash equals the CID's digest:
export async function getBlock(cid: CID | string): Promise<Uint8Array> {
const bytes = hexToU8a(await rpc("bitswap_v1_get", [cid.toString()]));
if (!verifyBytes(cid, bytes)) throw new IntegrityError(cid.toString());
return bytes;
}A root links its children by CID, so verifying the root and then each child verifies the whole file. A node, the PotDrive gateway or anyone in between can withhold data, but it cannot change data without being caught. On a file page this happens in your browser, straight against the Portaldot node (its RPC sends Access-Control-Allow-Origin: *), and the grid of squares shows each block as it passes.
What you still trust
| Question | Who answers | Can they lie? |
|---|---|---|
| Are these the right bytes? | Your hash check | No |
| Is the data available? | The RPC node you query | It can withhold. Query another node. |
| When does it expire? | Chain state read through that node | A dishonest RPC could misreport. A light client or state proof removes this trust. |
| Do validators still hold it? | The runtime, via checkProof in every block | Not without producing invalid blocks |
| Who owns it? | The registry contract | No. The record is on chain. |
Storage proofs
For data stored at block N, the author of block N + 100,800 must include a proof of a random 256-byte chunk. PotDrive's proof monitor reads recent blocks, finds the checkProof inherent and the ProofChecked event, and shows when the next proof is due based on the oldest held data.
const hasInherent = block.extrinsics.some(
(x) => x.method.section === "transactionStorage" && x.method.method === "checkProof",
);
const proved = events.some(({ event }) => event.method === "ProofChecked");
const due = storedBlocks.has(number - RETENTION); // this block had to prove something