Skip to content

Task specification

A TaskSpec is the off-chain JSON document that defines an OCH-1.1 task. The delegator commits its exact content with specHash when creating the task.

Use this object as the structural starting point. Set taskNonce, delegator, the input commitment and locator, economics, deadlines, and verifier parameters for the task you are creating.

{
"schema": "openclaw.taskSpec.v1_1",
"hubContract": "0x219f6a4206A38f05897257e40ceA3B211eA5e592",
"taskNonce": "0x1111111111111111111111111111111111111111111111111111111111111111",
"chainId": 42161,
"delegator": {
"address": "0x1111111111111111111111111111111111111111",
"did": "did:pkh:eip155:42161:0x1111111111111111111111111111111111111111"
},
"verifierName": "STATS_V1",
"verifierId": "0x87964240a746236cc99fb5d3ff344e5110b6429980582b953c2de786a74347b4",
"input": {
"plaintextCommitment": {
"hashAlg": "keccak256",
"hash": "0x2222222222222222222222222222222222222222222222222222222222222222"
},
"encryptedBlob": {
"uri": "ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf3xkqjmgwk7p4d2oo5ezi5g5aa",
"encryption": "xchacha20poly1305"
},
"constraints": {
"maxBytes": 262144
}
},
"economics": {
"maxRewardUSDC": 5000000,
"minBondUSDC": 10000000
},
"deadlines": {
"acceptDeadline": 2000000000,
"maxComputeWindowSec": 3600
},
"privacy": {
"onChain": "commitments_only",
"offChain": "encrypted_payloads",
"logs": "no_plaintext"
},
"verifierParams": {
"programVersion": 1,
"notes": "STATS_V1 input uses uint64 values."
}
}

Use integer or string scalar values in a TaskSpec; OCH-1.1 disallows floating-point values. In JavaScript, use JSON numbers only through the safe-integer bound 2^53 - 1 (9_007_199_254_740_991) and encode larger exact values as strings. This keeps the commitment stable across JSON implementations and preserves exact USDC microunits and Unix timestamps.

The commitment rule is:

canonicalBytes = UTF8(RFC8785_JCS(taskSpecJson))
specHash = keccak256(canonicalBytes)

RFC 8785 JSON Canonicalization Scheme (JCS) gives the same property order, string escaping, and number serialization to every conforming implementation. Hash the canonical UTF-8 bytes and pass the resulting raw bytes32 value to createTask.

The TaskSpec can live at the emitted specURI; its canonical content defines specHash independently of that storage location.

Address strings are part of those committed bytes. Use EIP-55 checksum casing for Ethereum addresses and keep it unchanged before canonicalization. JCS does not normalize address case, so changing only the letter case produces a different specHash.

TaskSpec value On-chain connection
hubContract Identifies the intended OCH-1.1 hub.
chainId Documents the intended chain; signing code reads the runtime chain from the wallet or provider.
verifierId Uses keccak256(bytes(verifierFamilyName)), such as the hash of STATS_V1.
input.plaintextCommitment.hash Matches the inputHash passed to createTask.
economics.maxRewardUSDC Matches maxRewardUSDC, expressed in six-decimal USDC microunits.
economics.minBondUSDC Matches the task’s minimum delegatee bond.
deadlines.acceptDeadline Matches the last timestamp for bid selection.
deadlines.maxComputeWindowSec Caps the compute window a delegatee can offer.

The on-chain specHash travels into every signed bid, binding selection to the same task instructions the delegator committed at creation.