# Execution Flow

This section outlines **Optimex’s swap execution process** using an example where a user swaps **BTC for ETH** while maintaining **full custody** of their BTC—without relying on intermediaries or wrapped assets.

### <mark style="color:orange;">Fixed-Rate Swap</mark>

1. **BTC Deposit & Swap Intent**
   * The user deposits BTC into the **Optimex Vault** on the Bitcoin network.
   * This deposit signals their commitment to swap, though they can reclaim their BTC after a **timelock (T)** expires (e.g., 24 hours).
2. **Quote Request & Selection**
   * The user requests quotes from **market makers (MMs)** via the **Solver**.
   * Since BTC is already in the Vault, MMs provide **competitive, market-aligned quotes**.
   * The user selects the best quote and **confirms the swap** by signing a transaction that authorizes the Vault to send BTC to the chosen MM (pending final approval).
3. **ETH Payment & Swap Settlement**
   * The MM sends the ETH payment to the user based on the agreed rate.
   * Once confirmed on-chain, the **Settlement Committee authorizes** the Vault to release BTC to the MM, completing the swap.

#### **Security Mechanisms**

If the **Validator Network or MM acts maliciously**, **Optimex** ensures fairness through:

* **Blocking BTC Release**: If the MM doesn’t send ETH, the **Settlement Committee’s security deposit** covers user losses.
* **Unauthorized BTC Transfers**: If the Committee colludes with the MM to take BTC without payment, both the **MM and the Committee** are penalized.
* **Swap Failure**: If the MM fails to fulfill the swap, part of its **security deposit is slashed** and paid as compensation to the user. The user can then reclaim BTC after the timelock expires.

### <mark style="color:orange;">Turbo Swap</mark> <mark style="color:orange;"></mark><mark style="color:orange;">**(Faster Settlements)**</mark>

The Fixed-Rate Swap **requires Bitcoin confirmations**, which can take **\~30 minutes**. To streamline execution, **Optimex enables an "Turbo Swap"**, allowing users to **pre-confirm swaps** while their BTC deposit is still pending.

1. **Indicative Quotes & Pre-Confirmation**
   * The user requests **indicative quotes** from MMs via the Solver.
   * Solver selects the best two quotes (from two MMs) and informs the User.
   * The User sets a **minimum acceptable rate** and an **expiry time** for the swap.
   * The user deposits BTC into the Vault and **pre-signs a transaction** allowing settlement to one of the selected MMs if conditions are met.
2. **Final Quote & Execution**
   * Once the BTC deposit is confirmed, the Solver fetches **committed, binding quotes** from the selected MMs.
   * If a quote meets the **user’s minimum acceptable rate**, the swap is executed immediately.

This **reduces wait times** and enables **one-shot swap execution**, improving the user experience. The **number of pre-signed market makers can be increased beyond two** for additional flexibility.<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.optimex.com/optimex-revolutionizing-bitcoin-finance/optimex-swap/optimex-swap-how-it-work/execution-flow.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
