> For the complete documentation index, see [llms.txt](https://doc.ave.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.ave.ai/ave-ai-perp-dex/perpetuals-on-chain.md).

# Perpetuals On-Chain

1. **What Are “On-Chain” Perpetuals**

“On-chain” means that **positions, margin, settlement, and liquidation** are executed via **blockchain and smart contracts**, rather than centralized exchange systems.This includes:

* Margin management
* PnL calculation
* Funding rate settlement
* Liquidation triggers

All handled transparently through **smart contracts, oracles, and on-chain logic**.

***

2. **Key Architecture Components**

* **Smart Contracts + Collateral:** Users deposit assets (e.g., USDC, ETH) as margin. Smart contracts manage positions, PnL, and liquidation logic.
* **Oracle Mechanism:** Smart contracts rely on **price oracles** to fetch real-time spot/index prices for calculations.
* **On-Chain Funding & Liquidation:** Funding rates are periodically settled, and liquidation is triggered automatically when margin falls below thresholds.
* **Liquidity & Leverage Models:** Some protocols use **AMMs or hybrid systems**, rather than traditional order books.

***

3. **Advantages of On-Chain Perpetuals**

* **Decentralization / Non-Custodial:** Users retain control of assets in their own wallets
* **Composability:** Integrates with DeFi (lending, LP, tokenized positions, etc.)
* **Transparency:** Positions, risk, and liquidation data are publicly verifiable
* **24/7 Global Access:** Fully aligned with crypto’s always-on market
