Overview
ComputeNet supports smart contracts that can trigger and verify compute jobs on-chain. This enables trustless integration of verified computation into decentralized applications.
Contract Interface
// ComputeNet contract interface (Solidity-like)
interface IComputeNet {
// Submit a compute job
function submitJob(
bytes32 programHash,
bytes calldata input
) external returns (bytes32 jobId);
// Verify a compute receipt
function verifyReceipt(
bytes32 jobId,
bytes calldata receipt
) external view returns (bool valid);
// Get job result after verification
function getResult(
bytes32 jobId
) external view returns (bytes memory output);
}Example Integration
contract VerifiedMLModel {
IComputeNet public computenet;
bytes32 public modelHash;
mapping(bytes32 => bool) public verifiedPredictions;
function predict(bytes calldata input) external returns (bytes32) {
// Submit prediction job to ComputeNet
bytes32 jobId = computenet.submitJob(modelHash, input);
return jobId;
}
function finalizePrediction(
bytes32 jobId,
bytes calldata receipt
) external {
require(computenet.verifyReceipt(jobId, receipt), "Invalid receipt");
verifiedPredictions[jobId] = true;
bytes memory output = computenet.getResult(jobId);
// Process verified output...
}
}Experimental
Smart contract integration is experimental. The interface and supported chains may change. Currently testing on EVM-compatible testnets.