# Native Bitcoin Vault

The **Optimex Vault** is a non-custodial escrow mechanism that temporarily holds users' assets while trades are in process. It ensures security, decentralization, and compatibility across multiple blockchains, including Bitcoin, Ethereum, and Solana.

For Bitcoin, **Optimex** has designed a **native Bitcoin vault** using existing Bitcoin scripting, making it fully compatible with the Bitcoin network. This vault acts as a **non-custodial "smart account"**, allowing users to manage assets and execute DeFi actions directly on Bitcoin.

### <mark style="color:orange;">Key Features</mark>

* **Multisig Authorization**: Uses a **2-of-2 multisig**, where the two signers are the **User** and the **Validator Network**.
* **Timelock Security**: If no action is taken within a specified time **T**, the user can reclaim funds unilaterally.

### <mark style="color:orange;">Vault Functionality</mark>

1. **Trade Execution (Within T-Hour Window)**
   * User deposits BTC into a Pay To Taproot (P2TR) address controlled by the Vault.
   * A transaction can be authorized using two **ECDSA signatures**—one from the **User** and another from the **Validator Network**.
   * The Validator Network utilizes **tECDSA** (threshold ECDSA), ensuring no single party has full control over the private key.
2. **Timelock Protection (After T-Hour Window)**
   * If no trade execution occurs within time **T**, the user can reclaim their BTC using only their own signature.
   * This ensures that user funds remain secure and cannot be held indefinitely.

### <mark style="color:orange;">Bitcoin Vault Script</mark>

In the following, we give more technical details on our implementation of the **Bitcoin Vault** using **Taproot (P2TR)**.

The Bitcoin Vault is essentially a Script that facilitates conditional BTC custody through a Taproot address. The Taproot output can only be spent through a script spending paths. The key spending path is disabled by using the "Nothing Up My Sleeve" (NUMS) point as internal key.\
\
The script spending paths comprise of:

<figure><img src="/files/nLZBmqtg0AlnCmX27rSb" alt=""><figcaption></figcaption></figure>

1. **Multi-sig spending Path**

`<SettlementCommitteePK> OP_CHECKSIG`\
`<UserPK> OP_CHECKSIGADD`\
`OP_2 OP_NUMEQUAL`&#x20;

Where:

* `SettlementCommitteePK`is the Settlement Committee's tECDSA public key
* `UserPK`  is the User's pubic key

Example transaction that spends the Vault via the Multi-sig spending path can be found [here](https://mempool.space/tx/46922e7a8f3c93434b58ce0f79fb4e711313d468a5f4ea60f120c411f5d93964).

2. **User-controlled withdrawal after timelock Path**

`<TimelockBlocks> OP_CHECKSEQUENCEVERIFY OP_DROP`\
`<UserPK> OP_CHECKSIG`&#x20;

Where:

* `TimelockBlocks` determines the Vault's expiry time. It is set to 144 blocks which is approximately 24 hours. After this duration has elapsed, the User can close the vault and withdraw the deposit from the vault at their discretion.
* `<UserPK>`  is the User's pubic key

Example transaction of the user close vault and withdraw after 144 Bitcoin blocks can be found [here](https://mempool.space/tx/afc088196f1b3fdffdf16983f89ef40c01dabbea09657b59464b61f907ea75a3).

### <mark style="color:orange;">Cross-Chain Vault Instances</mark>

Each blockchain **Optimex** supports has its own **Vault instance**, designed to meet its security and smart contract capabilities:

* **Bitcoin**: Uses **Bitcoin Script** to enable non-custodial, time-locked asset management.
* **Ethereum & Solana**: Implemented as **smart contracts**, allowing users to deposit assets and specify authorized recipients for trade settlements.

### <mark style="color:orange;">Advantages of Optimex Vaults</mark>

* **Security**:
  * The combination of **standard ECDSA and tECDSA** minimizes the risk of key compromise.
  * The **Settlement Committee’s tECDSA setup** ensures no single entity controls the private key.
  * Users always have a fallback mechanism to reclaim funds after a timeout.
* **Non-Custodial & Decentralized**:
  * Users retain control of their assets, even during trades.
  * Transactions require **multi-party authorization**, ensuring trustless execution.
* **Bitcoin Compatibility**:
  * Uses standard Bitcoin Script opcodes, ensuring full compatibility with all Bitcoin nodes, wallets, and services.
  * The **tECDSA implementation is invisible to the Bitcoin network**, making the Vault seamless and efficient.


---

# 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/primary-building-blocks/native-bitcoin-vault.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.
