Verifying Results

Validating compute receipts and results

Experimental Feature

This feature is experimental and may change significantly in future versions.

Overview

After a compute job completes, you receive a result with an associated compute receipt. This guide explains how to verify that results are authentic and correctly computed.

Verification Levels

ComputeNet supports multiple verification approaches:

Full Verification

Cryptographic proof verification. The client independently verifies the SNARK/STARK proof without trusting any network participant.

Attestation Verification

Verify that sufficient validators have attested to the result. Faster but requires trusting the validator set.

Receipt Validation

Check that the receipt is properly signed and anchored in the consensus layer.

Verifying a Receipt

verify.ts
// Get the result with receipt
const result = await job.waitForCompletion();

// Full cryptographic verification
const isValid = await client.verifyReceipt(result.receipt, {
  mode: 'full',
  checkConsensus: true
});

if (isValid) {
  console.log('Receipt verified cryptographically');
  console.log('Output:', result.output);
} else {
  throw new Error('Verification failed');
}

Offline Verification

Receipts can be verified offline without network access:

offline-verify.ts
import { verifyReceiptOffline } from '@computenet/sdk';

// Verify without network access
const isValid = verifyReceiptOffline(receipt, {
  // Trusted validator keys (must be obtained separately)
  validatorKeys: trustedKeys,
  
  // Check proof validity
  verifyProof: true
});

Receipt Fields

Key fields to inspect when verifying:

  • job_id — Matches your submitted job
  • input_commitment — Hash of inputs provided
  • output_hash — Hash of computation output
  • proof — Cryptographic proof data
  • attestations — Validator signatures
  • timestamp — When the result was finalized

Error Handling

Common verification errors and their meanings:

  • INVALID_PROOF — Cryptographic proof does not verify
  • INSUFFICIENT_ATTESTATIONS — Not enough validator signatures
  • INPUT_MISMATCH — Input commitment does not match
  • EXPIRED_RECEIPT — Receipt timestamp too old