Perpetual DEX Architecture | Derivatives & Options on XRPL | XRP Academy - XRP Academy
3 free lessons remaining this month

Free preview access resets monthly

Upgrade for Unlimited
Skip to main content
advancedβ€’55 min

Perpetual DEX Architecture

Learning Objectives

Compare perpetual DEX architectures including order book, pool-based, and vAMM models

Understand dYdX's order book approach and its evolution to an appchain

Analyze GMX's pool model and its LP dynamics

Evaluate trade-offs between capital efficiency, LP risk, and decentralization

Assess requirements for XRPL perpetual protocols

Perpetual futures are DeFi's killer derivative product. Why did they succeed where on-chain options struggled?

  • Single product per asset (no fragmentation)
  • No expiration management
  • Simple to understand (like margin trading)
  • Funding rate is intuitive (premium/discount)
  • Natural for speculation
  • dYdX: $1B+ daily volume at peaks
  • GMX: $300B+ cumulative volume
  • Multiple protocols with real traction

This lesson examines what makes them work.


WHAT A PERP DEX NEEDS:

PRICE DISCOVERY:
β”œβ”€β”€ Mechanism to establish fair price
β”œβ”€β”€ Options: Order book, AMM, oracle-based
β”œβ”€β”€ Must track spot reasonably well
β”œβ”€β”€ Funding rate provides convergence
└── Different from spot (synthetic position)

COLLATERAL MANAGEMENT:
β”œβ”€β”€ Traders post margin
β”œβ”€β”€ Track P&L continuously
β”œβ”€β”€ Liquidate underwater positions
β”œβ”€β”€ Protect counterparties
└── Critical for system solvency

FUNDING RATE:
β”œβ”€β”€ Transfers between longs and shorts
β”œβ”€β”€ Anchors perp price to spot
β”œβ”€β”€ Usually every 8 hours
β”œβ”€β”€ Payment = Position Γ— Rate
└── Core perpetual mechanism

LIQUIDATION ENGINE:
β”œβ”€β”€ Monitor position health
β”œβ”€β”€ Execute liquidations when needed
β”œβ”€β”€ Distribute remaining collateral
β”œβ”€β”€ Insurance fund for shortfalls
└── Prevents bad debt

LIQUIDITY:
β”œβ”€β”€ Someone takes the other side
β”œβ”€β”€ Order book: Market makers
β”œβ”€β”€ Pool: Passive LPs
β”œβ”€β”€ Both: Hybrid
└── Fundamental requirement
THREE MAIN MODELS:

1. ORDER BOOK (dYdX):

1. POOL-BASED (GMX):

1. VIRTUAL AMM (Perpetual Protocol v1):

COMPARISON:

Attribute Order Book Pool-Based vAMM
─────────────────────────────────────────────────────
Capital Efficiency High Medium Low
LP Complexity High Low None
Price Source Market Oracle Formula
Decentralization Medium High High
Slippage Variable Zero* Formula
Oracle Dependency Low High Medium
─────────────────────────────────────────────────────
*GMX has zero price impact up to liquidity limits


---
dYdX OVERVIEW:

HISTORY:
β”œβ”€β”€ V1-V3: On Ethereum L1 (slow, expensive)
β”œβ”€β”€ V3: StarkEx L2 (off-chain matching, L1 settlement)
β”œβ”€β”€ V4: Own Cosmos appchain
β”œβ”€β”€ Evolution toward full decentralization
└── Most successful perp DEX by volume

V4 ARCHITECTURE (Current):

Chain:
β”œβ”€β”€ Cosmos SDK-based sovereign chain
β”œβ”€β”€ Tendermint consensus
β”œβ”€β”€ Custom-built for trading
β”œβ”€β”€ ~1 second block times
β”œβ”€β”€ No gas fees for trading (built into protocol)
└── Appchain thesis

Order Book:
β”œβ”€β”€ Off-chain order book
β”œβ”€β”€ Validators run matching engine
β”œβ”€β”€ Decentralized but not on-chain storage
β”œβ”€β”€ Fast matching possible
└── Hybrid approach

Settlement:
β”œβ”€β”€ On-chain settlement of matched trades
β”œβ”€β”€ Position, margin, P&L on-chain
β”œβ”€β”€ Liquidations on-chain
β”œβ”€β”€ Transparent state
└── Crypto-native trust model

TECHNICAL FLOW:
β”œβ”€β”€ 1. Trader signs order
β”œβ”€β”€ 2. Order sent to validators
β”œβ”€β”€ 3. Matching engine (off-chain)
β”œβ”€β”€ 4. Matched trade submitted to chain
β”œβ”€β”€ 5. Chain validates and settles
└── 6. Position updated on-chain
```

dYdX LIQUIDITY MODEL:

MARKET MAKERS:
β”œβ”€β”€ Professional firms provide liquidity
β”œβ”€β”€ Post limit orders on book
β”œβ”€β”€ Earn spread (bid-ask)
β”œβ”€β”€ Must actively manage
β”œβ”€β”€ Sophisticated operation
└── Similar to CEX market making

INCENTIVE PROGRAM:
β”œβ”€β”€ Trading rewards (DYDX tokens)
β”œβ”€β”€ Market maker rewards
β”œβ”€β”€ Liquidity mining
β”œβ”€β”€ Bootstrapped initial liquidity
└── Sustainability questions

ORDER TYPES:
β”œβ”€β”€ Limit orders
β”œβ”€β”€ Market orders
β”œβ”€β”€ Stop-loss
β”œβ”€β”€ Take-profit
β”œβ”€β”€ Advanced order types supported
└── Full trading functionality

LIQUIDITY CHARACTERISTICS:
β”œβ”€β”€ Spreads: Tight for major pairs (~0.01%)
β”œβ”€β”€ Depth: Good for BTC/ETH
β”œβ”€β”€ Smaller assets: Less liquid
β”œβ”€β”€ Varies by market conditions
└── Generally competitive with CEX

TRADE-OFFS:
β”œβ”€β”€ βœ“ Capital efficient (no idle liquidity)
β”œβ”€β”€ βœ“ Tight spreads possible
β”œβ”€β”€ βœ“ Familiar UX
β”œβ”€β”€ βœ— Requires active market makers
β”œβ”€β”€ βœ— Centralization in matching
β”œβ”€β”€ βœ— Bootstrapping challenge
└── Best for: High-volume markets
dYdX RISK SYSTEMS:

MARGIN SYSTEM:
β”œβ”€β”€ Cross-margin: All positions share collateral
β”œβ”€β”€ Isolated: Per-position margin
β”œβ”€β”€ Maintenance margin: ~3-5% depending on pair
β”œβ”€β”€ Initial margin: Higher than maintenance
└── Similar to traditional futures

LIQUIDATION:
β”œβ”€β”€ Position liquidated when below maintenance
β”œβ”€β”€ Liquidation price known upfront
β”œβ”€β”€ Partial liquidations possible
β”œβ”€β”€ Insurance fund covers shortfalls
└── Transparent on-chain

INSURANCE FUND:
β”œβ”€β”€ Funded by: Liquidation fees, protocol revenue
β”œβ”€β”€ Purpose: Cover bad debt
β”œβ”€β”€ If depleted: Socialized losses (ADL)
β”œβ”€β”€ Current size: Check dYdX dashboard
└── Critical safety mechanism

AUTO-DELEVERAGING (ADL):
β”œβ”€β”€ Last resort if insurance fund empty
β”œβ”€β”€ Profitable positions force-closed
β”œβ”€β”€ To cover underwater losses
β”œβ”€β”€ Rare in practice
β”œβ”€β”€ But possible
└── Systemic risk management

RISK PARAMETERS:
β”œβ”€β”€ Position limits per account
β”œβ”€β”€ Open interest caps per market
β”œβ”€β”€ Funding rate limits
β”œβ”€β”€ Max leverage varies by asset
└── Conservative for stability

GMX OVERVIEW:

DESIGN PHILOSOPHY:
β”œβ”€β”€ Oracle-based pricing (not order book)
β”œβ”€β”€ LP pool is counterparty
β”œβ”€β”€ Zero price impact trades
β”œβ”€β”€ Passive liquidity provision
└── Novel approach

GLP POOL:
β”œβ”€β”€ Multi-asset liquidity pool
β”œβ”€β”€ Contains: ETH, BTC, USDC, etc.
β”œβ”€β”€ LPs deposit assets, receive GLP token
β”œβ”€β”€ Pool backs all perpetual positions
β”œβ”€β”€ LPs earn fees but take risk
└── Core innovation

PRICING MECHANISM:
β”œβ”€β”€ Chainlink oracle provides price
β”œβ”€β”€ Trades execute at oracle price
β”œβ”€β”€ No slippage (up to liquidity limit)
β”œβ”€β”€ Funding rate balances long/short
└── Dramatically different from order book

HOW TRADES WORK:
β”œβ”€β”€ 1. Trader wants to long ETH 10x
β”œβ”€β”€ 2. Deposits $1,000 collateral
β”œβ”€β”€ 3. Protocol gives exposure to $10,000 ETH
β”œβ”€β”€ 4. Price from Chainlink oracle
β”œβ”€β”€ 5. If ETH up: Trader profits (paid from pool)
β”œβ”€β”€ 6. If ETH down: Trader loses (paid to pool)
└── Pool is counterparty to ALL trades
GLP LIQUIDITY PROVISION:

WHAT GLP REPRESENTS:
β”œβ”€β”€ Pro-rata share of pool assets
β”œβ”€β”€ Exposure to: ETH, BTC, stables, etc.
β”œβ”€β”€ Plus: Net position against traders
β”œβ”€β”€ Plus: Fee income
└── Complex exposure

LP RETURNS:

Income Sources:
β”œβ”€β”€ Trading fees: 0.1% open/close
β”œβ”€β”€ Borrow fees: Paid by leveraged positions
β”œβ”€β”€ Funding rate: Net if imbalanced
└── Real yield from trading activity

Costs/Risks:
β”œβ”€β”€ Trader P&L: If traders profit, LPs lose
β”œβ”€β”€ Asset exposure: Pool has crypto exposure
β”œβ”€β”€ Smart contract risk
└── Not risk-free yield

HISTORICAL RETURNS:
β”œβ”€β”€ Highly variable
β”œβ”€β”€ Good in sideways markets
β”œβ”€β”€ Losses when traders right directionally
β”œβ”€β”€ ~10-30% APY historically (varies dramatically)
└── Not guaranteed

GLP AS TRADER COUNTERPARTY:
β”œβ”€β”€ When traders are net long: GLP is short
β”œβ”€β”€ When traders are net short: GLP is long
β”œβ”€β”€ Pool takes opposite exposure
β”œβ”€β”€ If trader wins: GLP loses
β”œβ”€β”€ Zero-sum between traders and GLP
└── Critical to understand
```

GMX RISK FACTORS:

FOR TRADERS:

Pros:
β”œβ”€β”€ Zero price impact (up to limits)
β”œβ”€β”€ Oracle price = no slippage manipulation
β”œβ”€β”€ Simple UX
└── Tight spreads

Cons:
β”œβ”€β”€ Oracle dependency (oracle failure = bad fills)
β”œβ”€β”€ Front-running risk (oracle update predictable)
β”œβ”€β”€ Liquidity limits (large trades may not execute)
└── Different from CEX

FOR LPs (GLP HOLDERS):

Market Risk:
β”œβ”€β”€ Crypto exposure (ETH, BTC in pool)
β”œβ”€β”€ Traders may be right directionally
β”œβ”€β”€ Large winning traders = LP losses
└── Not market-neutral

Trader P&L Risk:
β”œβ”€β”€ If traders consistently profit, GLP loses
β”œβ”€β”€ Historically traders lose (edge to GLP)
β”œβ”€β”€ But: Smart traders can extract value
β”œβ”€β”€ Adverse selection possible
└── Key risk factor

Insurance:
β”œβ”€β”€ No insurance fund concept
β”œβ”€β”€ LPs bear all risk
β”œβ”€β”€ Price: Higher returns when traders lose
└── Direct exposure

REALISTIC LP EXPECTATION:
β”œβ”€β”€ Positive long-term (traders mostly lose)
β”œβ”€β”€ But: Significant variance
β”œβ”€β”€ Drawdowns in trending markets
β”œβ”€β”€ Not passive income
└── Active risk-taking


---
VIRTUAL AMM CONCEPT:

HOW IT WORKS:
β”œβ”€β”€ Simulated AMM curve (x*y=k)
β”œβ”€β”€ No actual tokens swapped
β”œβ”€β”€ Virtual reserves determine price
β”œβ”€β”€ Price impact like regular AMM
β”œβ”€β”€ Collateral pool backs positions
└── Creative abstraction

MECHANICS:
β”œβ”€β”€ Opening position: "Swap" on virtual AMM
β”œβ”€β”€ Virtual reserves change
β”œβ”€β”€ Price moves (like real AMM)
β”œβ”€β”€ Closing: Reverse "swap"
β”œβ”€β”€ P&L from price difference
└── All virtual, backed by real collateral

ADVANTAGES:
β”œβ”€β”€ Fully on-chain (no off-chain matching)
β”œβ”€β”€ No market makers needed
β”œβ”€β”€ Automated price discovery
β”œβ”€β”€ Decentralized
└── Creative design

DISADVANTAGES:
β”œβ”€β”€ Capital inefficient (virtual liquidity)
β”œβ”€β”€ Price impact on large trades
β”œβ”€β”€ Arbitrage needed for price accuracy
β”œβ”€β”€ Can diverge from spot significantly
β”œβ”€β”€ Less capital efficient than order book
└── Challenges in practice

EVOLUTION:
β”œβ”€β”€ v1: Pure vAMM
β”œβ”€β”€ v2: Moved to oracle-based (like GMX)
β”œβ”€β”€ vAMM model largely abandoned
└── Market validated oracle approach
HYBRID DESIGNS:

COMBINING APPROACHES:

Order Book + Pool:
β”œβ”€β”€ Order book for price discovery
β”œβ”€β”€ Pool provides baseline liquidity
β”œβ”€β”€ Market makers compete with pool
β”œβ”€β”€ Best of both worlds attempt
└── More complex implementation

Oracle + Order Book:
β”œβ”€β”€ Oracle provides reference price
β”œβ”€β”€ Order book for execution
β”œβ”€β”€ Spreads around oracle
β”œβ”€β”€ Reduces manipulation risk
└── dYdX partially uses this

Multi-Pool:
β”œβ”€β”€ Different pools for different risk
β”œβ”€β”€ Stablecoin pool (low risk)
β”œβ”€β”€ Volatile pool (higher risk/return)
β”œβ”€β”€ Users choose exposure
└── More granular LP options

EXAMPLES:

Synthetix Perps:
β”œβ”€β”€ Debt pool model
β”œβ”€β”€ SNX stakers are counterparty
β”œβ”€β”€ Complex tokenomics
└── Novel but complex

Drift Protocol:
β”œβ”€β”€ AMM + order book hybrid
β”œβ”€β”€ On Solana
β”œβ”€β”€ JIT liquidity
└── Interesting design

Vertex:
β”œβ”€β”€ Hybrid on Arbitrum
β”œβ”€β”€ Combines approaches
└── Growing traction
```

COMPREHENSIVE COMPARISON:

dYdX      GMX       vAMM      Hybrid
───────────────────────────────────────────────────────
Capital Efficiency  High      Medium    Low       Medium
LP Complexity       High      Low       None      Medium
Decentralization    Medium    High      High      Medium
Price Accuracy      High      High*     Variable  High
Slippage           Variable  Zero**    Formula   Variable
Oracle Risk         Low       High      Medium    Medium
Liquidity Source    MMs       Pool      Virtual   Both
───────────────────────────────────────────────────────

*GMX price accuracy depends on oracle
**GMX zero slippage up to liquidity caps

BEST FOR:

dYdX:
β”œβ”€β”€ High volume markets (BTC, ETH)
β”œβ”€β”€ Sophisticated traders
β”œβ”€β”€ Capital-efficient trading
└── Traditional UX preference

GMX:
β”œβ”€β”€ Passive liquidity provision
β”œβ”€β”€ Traders wanting zero slippage
β”œβ”€β”€ Long-tail assets (with oracle support)
└── DeFi-native design preference

vAMM:
β”œβ”€β”€ Maximally decentralized requirement
β”œβ”€β”€ Smaller markets
β”œβ”€β”€ Experimental
└── Largely superseded

Hybrid:
β”œβ”€β”€ Balance of trade-offs
β”œβ”€β”€ Emerging designs
β”œβ”€β”€ May become dominant
└── Active development area


---
XRPL PERPETUAL REQUIREMENTS:

INFRASTRUCTURE NEEDED:

Smart Contracts:
β”œβ”€β”€ Hooks or EVM sidechain
β”œβ”€β”€ For: Position management, liquidation
β”œβ”€β”€ Status: Not yet mainnet
└── Essential prerequisite

Oracles:
β”œβ”€β”€ XRP/USD price feed minimum
β”œβ”€β”€ Other assets if multi-market
β”œβ”€β”€ High frequency for liquidations
└── Critical dependency

Collateral System:
β”œβ”€β”€ Lock/manage margin
β”œβ”€β”€ Track P&L
β”œβ”€β”€ Execute liquidations
└── Feasible with smart contracts

Liquidation Keepers:
β”œβ”€β”€ Off-chain monitors
β”œβ”€β”€ Submit liquidation transactions
β”œβ”€β”€ Economic incentive to participate
└── Standard DeFi pattern

FEASIBILITY ASSESSMENT:
β”œβ”€β”€ Order book model: Possible but complex
β”œβ”€β”€ Pool model (GMX-style): More feasible first
β”œβ”€β”€ Hybrid: Eventually
└── Start simple, iterate
```

XRPL PERPETUAL PROTOCOL DESIGN:

RECOMMENDED FIRST APPROACH:

Pool-Based (GMX-style):
β”œβ”€β”€ Simpler to implement
β”œβ”€β”€ Passive LP possible
β”œβ”€β”€ No market maker bootstrapping
β”œβ”€β”€ Oracle-dependent but manageable
└── Proven model to adapt

SPECIFICATIONS:

Collateral:
β”œβ”€β”€ XRP as primary collateral
β”œβ”€β”€ RLUSD as alternative
β”œβ”€β”€ Cross-collateral eventually
└── Start with one type

Markets:
β”œβ”€β”€ XRP/USD perpetual first
β”œβ”€β”€ Single market to prove concept
β”œβ”€β”€ Add BTC/USD, ETH/USD later
└── Gradual expansion

Leverage:
β”œβ”€β”€ Start conservative (5-10x max)
β”œβ”€β”€ Increase with proven stability
β”œβ”€β”€ Higher leverage = higher risk
└── Build trust first

Liquidation:
β”œβ”€β”€ Automated via keepers
β”œβ”€β”€ Insurance fund mechanism
β”œβ”€β”€ Clear liquidation prices
└── Transparent and predictable

Funding Rate:
β”œβ”€β”€ Standard 8-hour payments
β”œβ”€β”€ Based on mark vs. index
β”œβ”€β”€ Cap extreme rates
└── Familiar mechanism

LP STRUCTURE:
β”œβ”€β”€ XRP-RLUSD pool for multi-asset
β”œβ”€β”€ Or: Pure XRP pool for simplicity
β”œβ”€β”€ LP token representing share
β”œβ”€β”€ Fee distribution mechanism
└── Match GMX's proven model
```

XRPL PERP VS. ALTERNATIVES:

VS. CENTRALIZED EXCHANGES:
β”œβ”€β”€ XRPL: Trustless, permissionless, transparent
β”œβ”€β”€ CEX: Liquid, fast, established
β”œβ”€β”€ XRPL advantage: Self-custody, no counterparty
β”œβ”€β”€ CEX advantage: UX, liquidity, fiat
└── Different value propositions

VS. dYdX:
β”œβ”€β”€ XRPL: Potentially cheaper, XRP-native
β”œβ”€β”€ dYdX: Established, liquid, proven
β”œβ”€β”€ XRPL advantage: XRP community, cost
β”œβ”€β”€ dYdX advantage: Everything else (for now)
└── Years of development gap

VS. GMX:
β”œβ”€β”€ XRPL: Faster transactions, XRP-native
β”œβ”€β”€ GMX: Established LP base, proven
β”œβ”€β”€ XRPL advantage: Speed, XRP focus
β”œβ”€β”€ GMX advantage: Track record, TVL
└── Could adapt GMX model

TARGET MARKET:
β”œβ”€β”€ XRP holders wanting leverage
β”œβ”€β”€ XRP traders preferring decentralized
β”œβ”€β”€ DeFi users seeking XRP exposure
β”œβ”€β”€ Privacy-conscious traders
└── Niche but meaningful

NOT TARGETING:
β”œβ”€β”€ High-frequency traders (dYdX better)
β”œβ”€β”€ General crypto traders (established options)
β”œβ”€β”€ Institutional (CME better)
└── Know the niche
XRPL PERPETUAL DEVELOPMENT:

PHASE 1: INFRASTRUCTURE (2025-2026)
β”œβ”€β”€ Hooks or EVM sidechain live
β”œβ”€β”€ Oracle solutions deployed
β”œβ”€β”€ Basic tooling available
└── Can start building

PHASE 2: MVP PROTOCOL (2026-2027)
β”œβ”€β”€ First perpetual protocol launches
β”œβ”€β”€ Single market (XRP/USD)
β”œβ”€β”€ Limited leverage (5-10x)
β”œβ”€β”€ Initial liquidity ($1-10M)
β”œβ”€β”€ Testing and iteration
└── Proof of concept

PHASE 3: GROWTH (2027-2028)
β”œβ”€β”€ Multiple markets
β”œβ”€β”€ Increased leverage options
β”œβ”€β”€ Growing TVL and volume
β”œβ”€β”€ Competition emerges
β”œβ”€β”€ Ecosystem develops
└── Maturation

PHASE 4: MATURITY (2028+)
β”œβ”€β”€ Deep liquidity
β”œβ”€β”€ Multiple protocols
β”œβ”€β”€ Institutional interest possible
β”œβ”€β”€ Interoperability features
└── Established market

REALISTIC EXPECTATIONS:
β”œβ”€β”€ First protocol: 2026-2027
β”œβ”€β”€ Meaningful volume: 2027-2028
β”œβ”€β”€ Competitive with dYdX/GMX: 2029+
β”œβ”€β”€ Long timeline but achievable
└── Patience required

βœ… Decentralized perpetuals work β€” dYdX and GMX have processed billions with real users.

βœ… Pool-based models are LP-accessible β€” GMX showed passive LP can provide perpetual liquidity.

βœ… Multiple architectures are viable β€” Order book, pool, hybrid all function with trade-offs.

⚠️ Which model is optimal β€” Order book vs. pool debate continues.

⚠️ Long-term LP profitability β€” Traders improving could reduce LP edge.

⚠️ XRPL adoption β€” Whether community will use XRPL perps vs. established alternatives.

πŸ”΄ Oracle manipulation β€” Pool models especially vulnerable to oracle attacks.

πŸ”΄ LP losses in trending markets β€” GLP has lost when traders were directionally correct.

πŸ”΄ Smart contract risk β€” All protocols can be exploited.

Decentralized perpetuals are DeFi's most successful derivative product. dYdX (order book) and GMX (pool) represent proven approaches with different trade-offs. XRPL could support perpetuals once infrastructure exists, likely starting with a GMX-style pool model for simplicity. However, this is 2-3 years from meaningful implementation. For current leverage needs, dYdX, GMX, or centralized exchanges remain superior. XRPL perpetuals are a future opportunity to monitor and potentially build toward.


Assignment: Deep comparison of perpetual DEX models with XRPL application.

Requirements:

Part 1: Architecture Analysis (2 pages)

Compare dYdX and GMX in detail:

Dimension dYdX GMX
Liquidity source
Price discovery
Capital efficiency
LP requirements
Trader experience
Oracle dependency
Decentralization
Risk factors

For each dimension, explain the mechanics and trade-offs.

Part 2: LP Economics (1.5 pages)

  • dYdX market making requirements and returns
  • GLP returns and risk factors
  • When does each model favor LPs?
  • When does each model harm LPs?
  • Which would you LP to and why?

Part 3: XRPL Recommendation (1.5 pages)

  • Which model? (Order book, pool, hybrid)
  • Why that model for XRPL specifically?
  • Key design parameters
  • Risk mitigation strategies
  • Launch sequence

Part 4: Risk Assessment (1 page)

  • Risk description

  • Likelihood

  • Impact

  • Mitigation strategies

  • Architecture understanding (30%)

  • LP economics analysis (25%)

  • XRPL recommendation quality (25%)

  • Risk assessment depth (20%)

Time Investment: 2.5 hours


Knowledge Check

Question 1 of 1

GMX's zero slippage execution depends critically on:

  • dYdX V4 documentation
  • GMX protocol docs
  • Perpetual Protocol mechanics
  • Synthetix perpetuals
  • Perpetual DEX comparison studies
  • LP returns analysis
  • Oracle risk research
  • Capital efficiency studies
  • Order book implementation
  • AMM mechanics
  • Liquidation system design
  • Funding rate calculations
  • DefiLlama perpetual rankings
  • dYdX analytics
  • GMX stats dashboards

For Next Lesson:
Lesson 18 examines on-chain vs. off-chain derivative trade-offsβ€”the fundamental architecture decisions that shape derivative product design.


End of Lesson 17

Total words: ~5,500
Estimated completion time: 55 minutes reading + 2.5 hours deliverable

Key Takeaways

1

Two dominant models exist

β€” Order book (dYdX) is capital efficient but needs market makers. Pool-based (GMX) allows passive LPs but has directional risk.

2

GMX's pool model is simpler to implement

β€” Oracle-based pricing, passive LP, zero slippage. Good template for XRPL's first perpetual protocol.

3

LP-ing has real risks

β€” Pool-based LPs face trader P&L risk. Historically profitable but not guaranteed. Trending markets cause losses.

4

Oracle dependency is critical

β€” Pool models especially depend on accurate, manipulation-resistant price feeds.

5

XRPL perpetuals are 2-3 years away

β€” Infrastructure first, then protocol development, then liquidity bootstrapping. Long but achievable timeline. ---