> For the complete documentation index, see [llms.txt](https://docs.afx.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.afx.xyz/basics/what-is-a-perpetual-dex.md).

# What Is a Perpetual DEX? Guide to On-Chain Perpetual Futures

A perpetual DEX, or decentralized perpetual exchange, lets you trade perpetual futures through a self-custody wallet. Perpetual futures have no expiry date. Collateral is typically deposited into protocol smart contracts rather than a company-controlled account.

This guide explains how a perp DEX works. It covers funding rates, leverage, liquidations, self-custody, benefits, and trading risks.

### Key Takeaways

* A perpetual DEX is a decentralized exchange for trading perpetual futures — leveraged contracts with no expiry date — settled on-chain via smart contracts.
* Perp DEXs use self-custody wallets, while trading collateral is typically held in protocol smart contracts.
* Core machinery includes smart contracts, price oracles, funding, margin, leverage, and liquidation controls.
* Traders can go long or short with leverage, but face real risks: volatility, liquidation, funding costs, and smart-contract risk.
* Some venues also list stock- and commodity-linked perpetuals, often settled in stablecoins like USDC.

### What Is a Perpetual DEX?

A perpetual DEX is a decentralized exchange (DEX) for trading perpetual futures contracts. These on-chain derivatives let you take a leveraged long or short position without a settlement or expiry date.

Two ideas combine in the name:

* Perpetual — the contract never expires, so you can hold a position for as long as your margin supports it, instead of rolling over monthly or quarterly futures.
* DEX (decentralized exchange) — trading is executed by smart contracts on a blockchain, and you trade from a self-custody wallet rather than depositing into a company-controlled account.

To keep a contract that never settles close to the spot price, perp DEXs use a funding rate. This periodic payment between long and short traders nudges the perpetual price toward spot.

In short, a decentralized perpetual exchange offers wallet-based access to leveraged derivatives. Availability and execution design vary by protocol and jurisdiction.

### Key Features of an On-Chain Perpetual DEX

A perpetual DEX is really a set of on-chain building blocks working together:

* Perpetual contracts — no expiry, so positions can be held indefinitely as long as margin requirements are met.
* Non-custodial trading — you trade from your wallet; collateral sits in audited smart contracts, not a custodial account.
* Price oracles — decentralized price feeds (e.g. Chainlink, Pyth) supply a reliable mark price so the protocol knows the "fair" value for PnL and liquidations.
* Funding rate mechanism — periodic payments between longs and shorts that keep the perpetual price anchored to spot.
* Margin & leverage — collateral backs your position and lets you amplify exposure; more leverage means more liquidation risk.
* Liquidity model — some perp DEXs use a virtual AMM (vAMM) or liquidity pools, others use an on-chain order book, and some are hybrids.
* Liquidation & risk engine — smart contracts continuously check margin ratios and close under-collateralized positions automatically, often backed by an insurance fund.
* Settlement asset — many venues settle everything in a stablecoin such as USDC, which simplifies margin and PnL across different markets.

Together these components replace the trusted middleman of a centralized derivatives exchange with transparent, auditable on-chain logic.

### How On-Chain Perpetual Futures Trading Works

The features above describe what a perp DEX offers; here's how the pieces interact in real time:

1. Collateralization. You deposit collateral (often a stablecoin like USDC) into a margin account governed by smart contracts. This collateral backs your positions and sets how much leverage you can take.
2. Trade execution. In vAMM or pool-based designs, a pricing curve simulates a counterparty. In order-book designs, your order matches against resting orders. Some protocols use hybrid or off-chain components.
3. Price anchoring. Oracles feed external spot prices to establish the mark price, which is used to calculate unrealized profit and loss (PnL) and to trigger liquidations.
4. Funding rate balancing. Because the contract never expires, funding payments flow between traders to keep it tethered to spot:
   1. If the perpetual price is above spot → longs pay shorts.
   2. If the perpetual price is below spot → shorts pay longs.
5. Risk & liquidation. Smart contracts monitor each position's margin ratio. If collateral drops below the maintenance threshold, the position is liquidated automatically, and an insurance fund may absorb any shortfall during extreme volatility.
6. Settlement. When you close a position, realized PnL updates your collateral balance.

   `PnL = (Exit Price − Entry Price) × Position Size ± Funding Payments − Fees`

   You can withdraw available collateral according to the protocol's withdrawal rules.

The result is a self-running loop — collateral, liquidity, oracles, funding, and liquidations — that reproduces the machinery of a centralized derivatives exchange without a central operator.

### How to Use a Perpetual DEX

Getting started is straightforward, but understand each step before committing capital:

1. Set up a non-custodial wallet. Use a wallet compatible with the perp DEX's blockchain and fund it with an accepted collateral asset (commonly USDC).
2. Connect to the exchange. Open the official site and connect your wallet. Always verify the URL to avoid phishing clones.
3. Deposit collateral. Approve and transfer your collateral into the protocol's margin contract. This acts as margin for leveraged positions.
4. Choose a market and direction. Pick a perpetual market (e.g. [BTC-USDC](https://app.afx.xyz/trade/BTCUSDC), or a stock/commodity perp like [MSTR-USDC](https://app.afx.xyz/trade/MSTRUSDC) or [XAU-USDC](https://app.afx.xyz/trade/XAUUSDC) where supported). Decide to go long (price up) or short (price down).
5. Set your leverage. Higher leverage increases both potential profit and the chance of liquidation. Beginners should start conservatively.
6. Place an order.
   1. Market order — fills immediately at the current price.
   2. Limit order — fills only at your chosen price.
   3. Many perp DEXs also support stop-loss and take-profit orders.
7. Monitor margin and funding. Watch your margin ratio, unrealized PnL, and funding payments. If your margin falls too low, your position can be liquidated.
8. Close or adjust. Exit any time; the protocol settles PnL, deducts fees/funding, and returns unused collateral to your wallet.

> *Tip: Start with small positions and low leverage to learn how funding rates and liquidation thresholds behave before scaling up. Not financial advice (NFA).*

### Benefits of Perpetual DEXs

* Self-custody. You control the wallet used to access the protocol. Trading collateral remains subject to smart-contract risk.
* Permissionless access. Anyone with a wallet can connect, subject to local laws.
* Transparency. Many protocols publish on-chain trades, funding, and liquidation data for independent review.
* No expiry. Perpetual contracts avoid the rollovers of dated futures.
* DeFi composability. Collateral and positions can interact with the broader on-chain ecosystem.
* Broadening markets. Some perp DEXs offer equity- and commodity-linked perpetuals settled in stablecoins. Market availability varies by venue and jurisdiction.

### Security in Perpetual DEXs

Perp DEXs replace trust in an intermediary with on-chain guarantees, but "decentralized" does not mean "risk-free." Key security aspects:

* Smart-contract enforcement. Order execution and liquidation run in code. Reputable protocols publish audits and run bug-bounty programs, though smart-contract risk can never be fully eliminated.
* Self-custody of funds. Assets remain in your wallet, avoiding exchange-insolvency risk — but you are responsible for your own keys.
* Decentralized oracles. Pulling prices from networks like Chainlink or Pyth reduces single-source manipulation risk.
* Insurance funds. Reserves can cover shortfalls when liquidations can't fully close a position in volatile markets.
* Auditable by anyone. On-chain data lets independent parties verify solvency and system health in real time.

### Risks of Perpetual Futures Trading on a DEX

Perp DEXs have different custody and execution trade-offs from centralized venues. Understand these risks before trading:

* Leverage & liquidation risk — leverage magnifies losses as well as gains; positions can be liquidated quickly.
* Funding costs — holding a position for a long time can erode returns if funding is persistently against you.
* Liquidity & slippage — thinner markets can mean worse fills than a large centralized venue.
* Oracle risk — faulty or manipulated price feeds can cause unfair liquidations.
* Smart-contract risk — bugs or exploits can put funds at risk despite audits.
* Regulatory uncertainty — derivatives access is restricted in some jurisdictions.

Perp DEXs offer transparency and control, but you must weigh technical, financial, and regulatory risks before committing capital. *This is not financial advice.*

### Perp DEX vs. Spot DEX and Centralized Exchanges

<table data-search="false"><thead><tr><th>Feature</th><th>Perp DEX</th><th>Spot DEX</th><th>Centralized Perp Exchange (CEX)</th></tr></thead><tbody><tr><td>Custody</td><td>Wallet access; collateral is held by protocol contracts</td><td>Usually wallet-based</td><td>Usually custodial</td></tr><tr><td>Contract expiry</td><td>None (perpetual)</td><td>N/A (spot only)</td><td>None (perpetual)</td></tr><tr><td>Leverage</td><td>Often available, within protocol limits</td><td>Usually none</td><td>Often available</td></tr><tr><td>Execution</td><td>On-chain, hybrid, or protocol-specific</td><td>Usually on-chain</td><td>Usually off-chain matching</td></tr><tr><td>Transparency</td><td>Varies by protocol and design</td><td>Usually on-chain activity</td><td>Varies by venue</td></tr><tr><td>Access</td><td>Wallet-based; restrictions may apply</td><td>Wallet-based; restrictions may apply</td><td>Account requirements vary</td></tr><tr><td>Main risks</td><td>Contract, oracle, liquidity, liquidation</td><td>Asset and smart-contract risk</td><td>Custody, counterparty, liquidation</td></tr></tbody></table>

### Perpetual DEX FAQs

**How does a perpetual DEX work?**

A perp DEX lets you deposit collateral into a smart contract and open a leveraged long or short on a perpetual futures market. Oracles supply the mark price, a funding rate keeps the contract tethered to spot, and an automated liquidation engine closes positions that fall below their margin requirement — all on-chain, without a central operator.

**What does "perpetual" mean in crypto?**

"Perpetual" refers to a futures contract with no expiry or settlement date. Instead of expiring, it uses a funding rate to stay close to the underlying spot price, so you can hold a leveraged long or short position indefinitely as long as you maintain enough margin.

**Is perpetual trading risky?**

Yes. Perpetual trading uses leverage, which magnifies both profits and losses, and positions can be liquidated if the market moves against you. You also face funding costs, oracle risk, and smart-contract risk. Use conservative leverage and risk management, and never trade more than you can afford to lose. *NFA.*

**What is the difference between an asset and its perpetual?**

Buying the spot asset means owning the asset itself. Trading its perpetual means taking a leveraged derivative position on its price — you can go long or short, you don't own the underlying, and you pay or receive funding to hold the position.

**Can you trade stocks or gold on a perpetual DEX?**

On some newer perp DEXs, yes. In addition to crypto, certain venues list equity and commodity perpetuals — for example stock perps (like MSTR or TSLA) and metals such as gold (XAU) — usually settled in a stablecoin like USDC and tradable around the clock.

### Conclusion

Perpetual DEXs bring leveraged futures trading fully on-chain. They combine no-expiry contracts, self-custody, transparent execution, and permissionless market access.

They also carry real risks, including leverage, funding costs, oracle exposure, and smart-contract risk. As liquidity deepens, decentralized perpetual exchanges are becoming core venues for on-chain derivatives and perpetual futures trading.

***

#### Keep learning

* Next: [How to Trade Perpetuals On-Chain](/how-to-guides/how-to-trade-perpetuals-on-chain-a-step-by-step-guide.md) — a step-by-step walkthrough.
* Related: [What Is a Funding Rate?](/basics/what-is-funding-rate.md) — understand periodic funding payments.
* Explore markets: [Trade Stock Perpetuals On-Chain](/how-to-guides/trade-stock-perpetuals-on-chain.md) — learn how stock-linked perps differ from shares.
* Try it: Open a market on [AFX](https://app.afx.xyz/) and place a test position with small size. *NFA.*

*Disclaimer: This content is for general information and educational purposes only and is not financial, legal, or investment advice. Digital asset trading involves significant risk, including the possible loss of your entire position. You are solely responsible for your own decisions.*


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.afx.xyz/basics/what-is-a-perpetual-dex.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
