Receipt Verification
Every compute job produces a receipt that can be independently verified. Verification confirms that the computation was performed correctly without needing to re-execute it.
Basic Verification
import { ComputeNet, verifyReceipt } from '@computenet/sdk';
const client = new ComputeNet({ network: 'testnet' });
// Get a receipt
const receipt = await client.getReceipt(jobId);
// Verify the receipt
const isValid = await verifyReceipt(receipt);
if (isValid) {
console.log('Receipt is valid!');
console.log('Output:', receipt.output);
} else {
console.error('Receipt verification failed');
}Verification Steps
- 1Check proof validity
Verify the cryptographic proof against the input/output hashes
- 2Validate attestations
Confirm sufficient validator signatures are present and valid
- 3Check consensus anchor
Verify the receipt was included in a finalized consensus block
Offline Verification
Receipts can be verified offline without network access:
import { verifyReceiptOffline } from '@computenet/sdk';
// Verify without network (requires trusted validator keys)
const isValid = verifyReceiptOffline(receipt, {
trustedValidators: validatorPublicKeys
});