> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mob.exchange/llms.txt
> Use this file to discover all available pages before exploring further.

# Executors & Rebalancers

> Decentralized state relays (Executors) and offchain keepers (Rebalancers) that maintain cross-chain account health.

Mobius relies on two distinct offchain roles — **Executors** and **Rebalancers** — to bridge information and maintain solvency across chains and venues.

## Executors

Executors are a **decentralized state relay** between trading venues and the Mobius risk engine. They are the information backbone of the protocol: without accurate, timely state data flowing from venues back to the hub, the Credit Account cannot compute a correct Health Factor.

### Core Functions

When users initiate risk-impacting actions — such as opening positions on a venue or withdrawing from a Credit Account — Executors perform three functions:

1. **State Verification:** Fetch the current Venue Account equity, open positions, and margin data from the venue.
2. **Cryptographic Attestation:** Sign a **State Snapshot** of the Venue Account, producing a verifiable proof of the account's state at a given point in time.
3. **Relay:** Deliver the signed snapshot to the Mobius risk engine onchain, enabling the hub to compute an up-to-date global Health Factor.

Beyond relaying information, Executors also bridge **actions** from the hub to venues:

| Module     | Responsibility                                                                                        |
| ---------- | ----------------------------------------------------------------------------------------------------- |
| **Binder** | Provisions accounts at the venue and finalizes the onchain binding                                    |
| **Reader** | Polls the venue API for account state (equity, margin, positions) and pushes signed snapshots onchain |
| **Writer** | Executes orders and trades at the venue and confirms action outcomes onchain                          |

### Request Lifecycle

```text theme={null}
Onchain event (PENDING)
        |
    Executor picks up
        |
    Calls venue API
        |
    +-----------+-----------+
    |           |           |
CONFIRMED    FAILED     EXPIRED
```

All requests carry a deadline. If the Executor does not confirm before the deadline, the request can be marked as expired by anyone.

### Security Model

Executors operate as a **multi-party computation (MPC) network** to prevent single-point manipulation:

* **Threshold signatures:** A quorum of Executor nodes must sign each State Snapshot. No individual Executor can falsify data.
* **No custody:** Executors never hold user funds. Tokens are always held by a hub-chain contract or at the venue.
* **Confirm-only:** Executors can only confirm hub-initiated requests — they cannot create new ones or move funds independently.
* **Fail-closed staleness:** If Executors stop reporting, snapshots go stale and the hub automatically tightens the account's leverage limits. Silence hurts the account, not the protocol.
* **Rotation:** The hub owner can rotate the Executor address onchain if a key is compromised.

For native-bridge venues, Executors are not needed — reads and actions are verified directly against the venue's own state.

## Rebalancers

Rebalancers are **offchain keepers** focused on transaction execution and account maintenance. Unlike Executors, Rebalancers do not relay information — they act on the information that Executors have already delivered.

### Core Functions

* **Transaction re-submission:** Cross-layer sends are non-atomic. Rebalancers retry dropped Venue Account actions using idempotent identifiers. Before resubmitting, they read Venue Account state to ensure the action has not already executed, preventing double-runs.
* **Liquidation:** Serve as primary liquidators when Credit Accounts drop below $HF < 1$.
* **Automation & solvency management:** Execute user-defined triggers to keep Venue Accounts funded and harvest profits.
  * Example: "If Venue Account margin ratio > X%, bridge stablecoins from the Credit Account to the Venue Account."
  * Example: "If Venue Account unrealized PnL > threshold, realize profits and bridge back to the programmable layer to repay debt."

## Executors vs. Rebalancers

|                     | Executors                                              | Rebalancers                                                |
| ------------------- | ------------------------------------------------------ | ---------------------------------------------------------- |
| **Primary role**    | Information relay & action bridging                    | Transaction execution & account maintenance                |
| **State relay**     | Yes — fetch, attest, and deliver venue state snapshots | No — consume state that Executors provide                  |
| **Action bridging** | Yes — bridge onchain intents to venue APIs             | No — operate within the hub chain                          |
| **Liquidation**     | No                                                     | Yes — primary liquidators                                  |
| **Automation**      | No                                                     | Yes — user-defined triggers, margin management             |
| **Tx retry**        | No                                                     | Yes — resubmit dropped cross-layer transactions            |
| **Trust model**     | MPC network with threshold signatures                  | Permissionless keepers incentivized by liquidation bonuses |
