# Execution Phase (Off-Chain)

After a user submits an inference request, an **executor node** picks it up from the job queue and performs the AI computation off-chain. To ensure verifiability, the executor runs the model as a zk-circuit and produces a cryptographic proof of correctness.

This phase is computation-heavy and forms the **core trust-minimized processing layer** of the Orby AI protocol.

***

**🛠️ Execution Workflow:**

1. Executor receives the request tied to a `model_hash`.
2. Loads the zk-circuit and model weights.
3. Fetches the input payload using its `input_hash` (off-chain).
4. Performs the AI inference using zk-compatible logic.
5. Generates a **zk-proof** of the execution.
6. Hashes the output and wraps the result into a verifiable package.

***

**📦 Result Package Submitted to Verifier:**

```json
{
  "output": ["validator_07", "validator_21"],
  "zk_proof": "0xabc123...",
  "proof_hash": "0xdef456...",
  "output_hash": "0xghi789..."
}
```

* `zk_proof`: The full cryptographic proof for the inference
* `output_hash`: SHA-256 hash of the inference result
* `proof_hash`: Hash of the zk-proof data structure

***

**⚠️ Integrity Notes:**

* If the output doesn’t match the model’s registered circuit logic, the proof will fail on-chain.
* Only registered models with valid verification keys can be executed.
* No inference = no reward.

***

**🌍 RWA Integration:**

* **Yield Trigger Point:** This is where tokenized AI models generate the raw material for RWA-based revenue.
* **Executor Accountability:** Performance metrics (e.g., latency, proof size, error rate) impact future task allocation and reputation.
* **Pre-validation for Royalty Rights:** Only output packages that pass structural pre-checks will proceed to revenue distribution on-chain.

> The execution phase is where AI meets cryptographic enforcement — creating the only kind of work that can be trusted, tokenized, and monetized.
