Minimal Integration
This page provides a minimal, conceptual sketch for integrating off-chain compute with an actor.Note: Examples and names in this page are conceptual and illustrative (non-normative). Final interfaces and usage should follow the SDK and Developer Guide; normative behavior follows the Off-chain architecture documents.
Quick Path (Conceptual)
- Define task and mandatory result_schema
- Include size and format constraints (e.g., max_return_bytes, data_format)
- Provide task-specific parameters runners need
- Submit task with callback (CIP‑2)
- Call
submit_task(task_definition, result_schema, callback, num_runners, timeout_blocks, proof_type_requested) - Choose
num_runners (N),timeout_blocks, and a verification mode viaproof_type_requested
- Handle deferred callback and finalize payment (CIP‑1 + CIP‑2)
- In the callback, determine acceptance (e.g., quorum for N‑of‑M, or validate proofs/attestations)
- Call
consume_result(task_id, consumed_runner_address)to finalize payment and persist state
Common Pitfalls (and fixes)
- Missing or too‑permissive result_schema → define
max_return_bytesand strict format - Timeout too short for the workload → increase
timeout_blocksbased on expected execution - Callback does not call
consume_result→ ensure finalize step is invoked to pay winners - Large or nested return payloads → return compact summaries; fetch details on demand

