Skip to content

Delegatee workflow

As a delegatee, you choose the terms you will honor, sign them off-chain, and retain control of the transaction that starts your compute window.

The transaction fragments below use ethers v6 contract instances connected to the selected delegatee’s signer. The task ID, bond, proof, public values, and output URI come from the selected task and its verifier program.

Read the task directly from the hub and confirm its state is OPEN. Use its exact taskId, specHash, verifierId, inputHash, deadline, reward ceiling, bond floor, and compute-window ceiling when evaluating the work.

Read bidNonce[yourAddress], choose a unique salt, and sign the complete bid with EIP-712:

OpenclawHub / 1.1 / runtime chainId / deployed hub address

Include the task commitments, your delegatee address, the USDC reward and bond in 6-decimal integer units, computeWindowSec, validUntil, the current nonce, and the salt. Deliver the bid and signature to the delegator off-chain.

Signed bids defines the exact domain, type, and field order.

After TaskSelected names your address, recover and test the delivered key. Obtain the complete task input, keep a locally usable copy for the full compute and submission window, and recompute the verifier-family inputHash from that local copy.

For STATS_V1, compute keccak256(abi.encode(values)) over the complete uint64[] input. See STATS_V1 for the exact computation.

Complete these checks while the task remains SELECTED:

  • the selected terms and delegatee address match your signed bid;
  • the key decrypts the task input;
  • the complete local input matches the on-chain inputHash;
  • the proof path, gas, and deadline margin are ready; and
  • your USDC balance and hub allowance cover the full bondUSDC.

This is the activation gate: call activateTask only after you control the complete, commitment-matched input locally.

Approve the hub for the selected bond, re-read the task and activateDeadline, then activate:

await (await usdc.approve(hubAddress, bondUSDC)).wait();
await (await hub.activateTask(taskId)).wait();

Activation transfers the bond into the hub, records activatedAt, and sets submitDeadline = activatedAt + computeWindowSec.

Run the selected verifier program over the commitment-matched input. For STATS_V1, submit its proof with the exact 224-byte static publicValues payload:

await (
await hub.submitResult(taskId, proof, publicValues, outputURI)
).wait();

Submit from the selected delegatee address before submitDeadline. The hub matches taskId and inputHash, records the non-zero outputHash, verifies the proof through the task’s snapshotted verifier, pays the reward less the snapshotted fee, and returns the full bond.

Read proof binding for the hub checks and contracts for the active STATS_V1 route.

To revoke every previously signed bid at the current nonce, call incrementBidNonce(). New bids use the updated bidNonce[yourAddress].