Skip to content

Verifying Proofs

How to independently verify proof hashes using the PacSpace verification utilities.

PacSpace provides everything you need to independently verify proof hashes. When you receive a delta.verified webhook, the payload includes the proof data required for verification.

What You Receive

Every delta.verified webhook includes a proof object:

json
{
  "proof": {
    "proofHash": "0x8f3a9b...",
    "contentHash": "0x2d4e7f...",
    "itemHashes": ["0x2d4e7f...", "0x9f1a..."],
    "previousProofHash": "0x1c7b2e..."
  }
}
FieldDescription
proofHashCryptographic proof covering the verified delta
contentHashHash of your individual delta payload
itemHashesContent hashes for items included in the verification
previousProofHashProof hash of the preceding delta (forms the verification chain)

Verification Steps

1. Confirm your content hash

Verify that your contentHash appears in the itemHashes array. This proves your delta was included in the verification.

javascript
const { contentHash, itemHashes } = webhookData.proof;

assert(
  itemHashes.includes(contentHash),
  'Content hash not found in verification set'
);

2. Confirm the proof hash

Compare the proofHash from the webhook against the value you received when you originally submitted the delta (via the receiptId field in the emit response). If they match, the verification is confirmed.

javascript
const { proofHash } = webhookData.proof;

assert(
  proofHash === storedReceiptId,
  'Proof hash does not match original receipt'
);

If you stored the previous delta's proof hash, confirm it matches previousProofHash to verify chain continuity. A mismatch means the chain was broken.

javascript
const { previousProofHash } = webhookData.proof;

assert(
  previousProofHash === storedPreviousProofHash,
  'Chain broken — previous proof hash does not match'
);

Full Verification Example

javascript
function verifyReceipt(receipt, storedPreviousHash) {
  const { contentHash, proofHash, itemHashes, previousProofHash } = receipt.proof;

  // 1. Verify content hash is in the verification set
  if (!itemHashes.includes(contentHash)) {
    return { verified: false, reason: 'Content hash not found in itemHashes' };
  }

  // 2. Validate chain link if previous hash is available
  if (storedPreviousHash && previousProofHash !== storedPreviousHash) {
    return { verified: false, reason: 'Chain link broken — previousProofHash mismatch' };
  }

  return { verified: true };
}

// Usage with a delta.verified webhook payload
const result = verifyReceipt(webhookData, myStoredPreviousHash);
console.log(result); // { verified: true }

Verification Summary

CheckWhat it proves
Content hash presenceYour delta was included in the verification
Proof hash comparisonThe committed proof matches your original receipt
Chain link validationNo deltas were inserted, removed, or reordered

Next Steps