# Architecture

### **1. Architecture Overview**

b14g is a **modular BTCFi coordination layer** connecting **Bitcoin’s liquidity** with **multi-chain dual-staking ecosystems**.

It unifies three core components — **Self-Custodial BTC Staking**, **BTCFi Vaults**, and the **Merge Marketplace** — into a composable infrastructure that can be integrated by any Bitcoin-aligned chain.

#### **Architecture Pillars**

| Layer                  | Core Component                       | Purpose                                                     |
| ---------------------- | ------------------------------------ | ----------------------------------------------------------- |
| **Distribution Layer** | BTC Self-Custodial Staking + Vaults  | Activate Bitcoin yield and user participation               |
| **Middleware Layer**   | Merge Marketplace + Dual-Staking SDK | Match liquidity, route yield, and enable chain integrations |
| **Base Layer**         | Unified BTCFi Layer + $B14G          | Coordinate governance, incentives, and cross-chain data     |

### **2. BTC Self-Custodial Staking**

> *Bitcoin security, without custodial risk.*

* Built on **Bitcoin time-locked staking**, allowing users to lock BTC directly from their wallet (e.g., via Taproot scripts).
* BTC remains on the Bitcoin mainnet; proof-of-stake delegation is managed through cross-chain attestation.
* Enables **non-custodial staking** to secure Bitcoin-aligned chains (Core, Babylon, Stacks, etc.).
* Provides the foundation for BTCFi vault yield flows.

**Key Features:**

* Time-locked BTC staking
* Verifiable on-chain yield accrual

{% content-ref url="/pages/oBDQmRNdw5WRMo5qzt5c" %}
[Self-Custodial Bitcoin Staking](/architecture/self-custodial-bitcoin-staking.md)
{% endcontent-ref %}

### **3. BTCFi Vaults**

> *Yield infrastructure for dual-staking and DeFi strategies.*

* Smart-contract-based vaults that combine **BTC and partner tokens** (e.g., CORE, BABY, STX) to earn shared rewards.
* Each vault enforces allocation logic: BTC is secured via time-locks; tokens are delegated to network validators or liquidity pools.
* Supports **risk-adjusted yield strategies** (e.g., safe vaults, leveraged vaults, stablecoin-backed vaults).
* Emits **b14g Points** as reward metrics for future cross-chain incentive distribution.

**Example Vaults:**

* `dualCORE Vault` — CORE lst for dual-staking
* `coBABY Vault` — BABY lst for co-staking
* `dualSTX Vault` — STX lst for dual-staking

**Vault Architecture Stack:**

* Smart Contracts (EVM-compatible, Cosmwasm)
* Yield Router (APY optimizer)
* Oracle & Validator Registry (APR data feed)
* b14g Indexer (cross-chain position tracking)

{% content-ref url="/pages/yu2rb9uowXtDbE7cnGnF" %}
[dualCORE - Liquid Staking](/products/for-core-holders/dualcore-liquid-staking.md)
{% endcontent-ref %}

### **4. Merge Marketplace**

> *Unifying BTC and token stakers into one marketplace.*

* A **dual-staking matching engine** where BTC stakers post “orders” and token stakers match them.
* Works like an **on-chain orderbook** for yield: matching BTC and token capital in real time based on yield preferences, duration, and risk score.
* Supports both **manual participation** (for retail) and **automated routing** (for protocols and aggregators).
* Fully transparent and composable — other dApps can integrate marketplace liquidity via API or SDK.

**Technical Modules:**

* Matching Engine Smart Contracts
* Order Registry & Indexer
* Yield Router & Fee Module
* Marketplace SDK for chain partners

{% content-ref url="/pages/n02nQj3Itpy2eFAaUUuH" %}
[Merge Marketplace](/architecture/merge-marketplace.md)
{% endcontent-ref %}

### **5. Data and Identity**

#### **Unified BTCFi Layer**

* Tracks user positions, staking history, and yield data across all supported chains.
* Aggregates vault data for analytics, reputation, and institutional reporting.
* Enables “BTCFi identity”, a unified profile representing all BTC-based yield activities.

**Data Sources:**

* Vault smart contracts
* Cross-chain indexers (Babylon, Core, Stacks, etc.)

### **6. Token and Governance**

#### **$B14G Token Functions**

| Function                   | Description                                                 |
| -------------------------- | ----------------------------------------------------------- |
| **Governance**             | Adjust marketplace fees, vault parameters, reward rates     |
| **Yield Routing**          | Direct yield flow and protocol incentives                   |
| **Fee Capture**            | Collect a small percentage of performance and matching fees |
| **Staking Boost**          | Enhance user yield through loyalty multipliers              |
| **Cross-Chain Incentives** | Power b14g Points redemption and inter-chain campaigns      |

**Governance Structure**

* **BTCFi Council (DAO):** manages yield parameters and validator whitelists
* **Multi-sig Treasury:** collects and redistributes protocol fees
* **Proposal Framework:** on-chain proposals via $B14G staking

***

### **7. Dual-staking SDK**

The [**b14g Dual-Staking**](/architecture/dual-staking.md) **SDK** allows new Bitcoin-aligned chains to integrate dual-staking **in days, not months.**

**Integration Modules:**

* Validator registry interface
* Yield & reward router
* BTC self-custodial staking adapter (via Babylon light client)
* Marketplace API

**Benefits for Partner Chains:**

* Plug-and-play staking infrastructure
* Shared BTC liquidity pool access
* Built-in exposure to Bitcoin’s on-chain capital

***

### **6. Security & Audits**

{% content-ref url="/pages/I72HBhIyS3JVaqN32o7c" %}
[Audits](/audits.md)
{% endcontent-ref %}


---

# 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.b14g.xyz/architecture.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.
