Overview
Compute jobs are the fundamental unit of work in ComputeNet. This guide explains how to prepare, submit, and track compute jobs on the network.
Job Structure
A compute job consists of:
- Runtime — The execution environment (e.g., WASM)
- Module — The code to execute
- Inputs — Data passed to the computation
- Verification level — Required proof type
- Resources — Compute limits and timeouts
Supported Runtimes
ComputeNet currently supports (or plans to support):
| Runtime | Status | Notes |
|---|---|---|
| wasm | experimental | WebAssembly modules |
| docker | planned | Container-based execution |
| zkvm | planned | Zero-knowledge VM execution |
Submitting a Job
submit-job.ts
const job = await client.submit({
// Execution runtime
runtime: 'wasm',
// WASM module (as bytes or URL)
module: wasmBytes,
// Input data
inputs: {
data: inputData,
params: { threshold: 0.5 }
},
// Verification requirements
verification: 'full', // 'full' | 'optimistic' | 'attestation'
// Resource limits
resources: {
maxGas: 1000000,
timeout: 60000 // ms
}
});
// Job submitted - returns job ID
console.log('Job ID:', job.id);Job States
Jobs progress through the following states:
- Pending — Submitted, awaiting validator assignment
- Assigned — Validator selected, execution starting
- Executing — Computation in progress
- Proving — Generating verification proof
- Verifying — Attestations being collected
- Completed — Result finalized with receipt
- Failed — Execution or verification failed
Tracking Progress
track-job.ts
// Poll for status
const status = await client.getJobStatus(job.id);
console.log('State:', status.state);
// Or use event subscription
job.on('stateChange', (newState) => {
console.log('Job state:', newState);
});
// Wait for completion
const result = await job.waitForCompletion({
timeout: 120000
});