Lesson 0 — What perpetual futures are, and why they have no expiry
Question
The implementation lessons in the DIY Perp track pack six perp terms into fifteen characters: "premium = (mark − index) / index, divisor 8, cap ±4 %". To a Rust-infra engineer it looks like the math is the hard part. The math is the easy part. The mechanics are the hard part. What are perps, and why does a contract with no expiry still track the underlying?
Principle (minimum model)
- Three markets, three contracts. Spot (own the asset, instant settlement) / traditional futures (expiry, converge to spot at expiry) / perp (no expiry, convergence is not built in).
- "No expiry" is a real engineering problem. Traditional futures get convergence for free at expiry. Perps drop that anchor → the price is set by orderbook supply/demand alone → 5–10 % divergence under squeezes, persistent premium in retail-heavy bull markets.
- Funding payment is the fix (Lesson 1 detail). When mark > index, longs pay shorts a small periodic fee proportional to the gap → economic incentive to close longs / open shorts → mark drifts back to index. Funding plays for perps the role expiry plays for futures — convergence force, applied continuously instead of at one point.
- Where perps live. CEX (Binance / OKX / Bybit / BitMEX — BitMEX invented the modern perp in 2016) / DEX on an existing L1 (dYdX / Drift / Aevo) / DEX on a purpose-built L1 (Hyperliquid is the largest, $300 B+ /year).
- Why Hyperliquid as the running example. A purpose-built L1 lets you tune every layer (latency / gas / orderbook depth) for the perp UX. Currently closed-source (HyperBFT / HyperCore / HyperEVM).
psyto/openhlis the open reference; the DIY Perp track teaches how to build it. - Hyperliquid parameters used throughout the primer. Funding interval 1 hour / divisor 8 / cap ±4 % per interval / initial margin ~10 % / maintenance margin ~2 % / liquidation fee ~1.5 % notional / cross-margin default / insurance fund + ADL backstop.
- Three common misreadings. (1) "Perps = auto-rolling futures" — no, rolling has basis cost; perps use funding instead. (2) "Perps are riskier than spot" — at 1× leverage they're almost identical; the delta is just funding. (3) "Hyperliquid is an Ethereum smart contract" — no, it's an independent L1.
Worked example + steps
What perpetual futures are — and why they have no expiry
Goal
Concepts you'll grasp in this lesson:
- What a perpetual future actually is — a derivative contract with no expiry date, no settlement event, and no convergence-to-spot mechanism baked into time. The whole shape of the rest of this primer follows from that one design choice.
- Why "no expiry" was a real engineering problem — and why solving it required inventing a new economic mechanism (which we cover in Lesson 1).
- How perps differ from spot and from traditional futures — three markets, three pricing dynamics, three sets of trader incentives.
- Why Hyperliquid is the canonical example for this course — closed-source today, the rethlab DIY Perp track teaches you to build the open equivalent.
After this lesson you can answer:
- "What's the difference between buying BTC and going long BTC perp?"
- "If perps have no expiry, what keeps their price from drifting away from the underlying?"
- "What is Hyperliquid, and why does it matter to a Rust EVM engineer?"
Why this primer exists
The rethlab DIY Perp track teaches you to build an open-source Hyperliquid implementation from scratch — consensus substrate, CLOB matching engine, EVM precompiles, funding state machine, liquidation engine. Each course is byte-identical against the openhl reference codebase.
But the code only makes sense if you understand what a perp is. When the funding course says "premium = (mark − index) / index, divisor 8, cap ±4%", that's six pieces of perp jargon in fifteen characters. If you're a Rust engineer coming in from infra work, you'd be forgiven for thinking the math is the hard part. The math is the easy part. The mechanism is the hard part.
This primer is the four-lesson conceptual layer the DIY Perp track quietly assumed. No code and no openhl references — just the perp mechanics you need to make sense of the Rust later.
Three markets, three contracts
Three ways to express a view on the price of BTC:
| Market | What you hold | Settlement | Example |
|---|---|---|---|
| Spot | The actual BTC | Instant — you own it | Buy 0.1 BTC on Coinbase. You now have 0.1 BTC. |
| Traditional futures | A contract to buy/sell BTC at a fixed price on a future date | At expiry — cash-settled (price difference) or physical delivery | CME December 2026 BTC future. You agree to buy at $100k on Dec 31. |
| Perpetual future | A contract that mimics BTC price exposure, with no expiry | Never — stays open until you close it (cash-settled) | Hyperliquid BTC-USD perp. You go 10× long, position stays open as long as you keep margin. |
Spot is the simplest. You own the asset; price moves are your gains and losses directly.
Traditional futures add leverage (you don't pay the full notional upfront) and expiry (the contract terminates on a fixed date, at which point its price converges to spot by arbitrage). Used in commodities since the 1800s — what we have today is centuries of refinement.
Perpetual futures keep the leverage from traditional futures but drop the expiry. That sounds innocuous. It is, in fact, the most consequential design choice in modern derivatives.
Why no expiry was a real problem
Traditional futures have a built-in convergence mechanism: at expiry, the contract price must equal the spot price, or arbitrageurs eat the difference. The expiry is the anchor.
Take the expiry away and the anchor is gone. The perp's price is set by orderbook supply and demand on the perp venue. Nothing in the contract itself forces it to track spot.
So perps can drift. A lot.
- Speculative mania: more longs than shorts → mark price runs above index by 5%, 10%
- Panic: more shorts than longs → mark runs below index
- Lopsided positioning: a venue with mostly retail longs (e.g., during a bull market) sees persistent positive premium
Without a corrective mechanism, perps would just be "futures with extra steps" — and the steps would all be in the wrong direction. The contract claims to track BTC, but its price doesn't.
The solution: funding payments. This is Lesson 1's topic. The 30-second version: when mark drifts above index, longs pay shorts a small periodic fee proportional to the gap. The fee is the economic incentive that pulls mark back. Symmetrically when mark drifts below.
Funding is to perps what expiry is to traditional futures — the convergence force, just implemented continuously instead of at a single point. That's the entire innovation.
Where perps live today
| Venue type | Examples | Notes |
|---|---|---|
| CEX (centralized) | Binance, OKX, Bybit, BitMEX | BitMEX invented the modern perp in 2016. Binance has the most volume globally. |
| DEX on existing L1s | dYdX (Cosmos), Drift (Solana), Aevo (Optimism rollup) | Composable, on-chain, but inherit latency and gas of the host chain. |
| DEX on custom L1s | Hyperliquid, Aevo, Vertex | Purpose-built L1s optimized for perp UX. Hyperliquid is the largest by volume. |
The DEX-on-custom-L1 category is the most interesting from a Rust engineer's perspective. Building a perp DEX as an app on Ethereum L1 is slow and expensive; building it as a roll-up trades centralization for speed; building it as a purpose-built L1 lets you tune every layer for perp UX. That's what Hyperliquid did, and that's what the DIY Perp track teaches you to do.
Why Hyperliquid is the example
Hyperliquid is the largest perpetual DEX by volume, processing over $300B in 2025. Its stack is fully closed-source: HyperBFT consensus, HyperCore matching engine, HyperEVM execution. There is no public Rust reference for engineers who want to read how an L1 like that actually works.
psyto/openhl is the open-source reference implementation. The rethlab DIY Perp track teaches you to build it. After this primer, you'll know enough perp domain to follow the code.
A short list of Hyperliquid-specific design choices worth remembering as you go through the rest of the primer:
- Funding interval: 1 hour (Lesson 1 covers this)
- Funding rate divisor: 8 (Lesson 1)
- Funding rate cap: ±4% per interval (Lesson 1)
- Initial margin: ~10% (Lesson 2)
- Maintenance margin: ~2% (Lesson 2; varies by tier)
- Liquidation fee: ~1.5% of notional (Lesson 3)
- Cross-margin by default (Lesson 2)
- Insurance fund present, ADL as fallback (Lesson 3)
These numbers will reappear in every subsequent primer lesson and in every DIY Perp course's example calculations.
Common misconceptions
"A perp is just a futures contract that auto-rolls." Close but wrong. Auto-rolling futures still has expiries; you just get a new contract each cycle. Each roll has a cost (basis spread). Perps have no rolls — the funding payment replaces the roll cost.
"Perps are riskier than spot." Wrong direction of risk-comparison. Perps add leverage risk (you can lose more than your collateral if you're underwater — though insurance funds usually cover this on regulated venues). Without leverage, a 1× perp position has roughly the same risk as spot, minus funding cost.
"Hyperliquid is a smart contract on Ethereum." No — Hyperliquid is its own L1. The whole point of building the DIY Perp track is that an app-chain optimized for perps beats a smart contract on a general-purpose L1 for the user experience perps need (sub-second latency, no gas, deep orderbook).
Next lesson (Lesson 1)
Lesson 1 — Mark, index, and funding. We build the picture of how mark price stays anchored to the index when there's no expiry. You'll see the premium formula (mark − index) / index, the divisor that converts it to a per-interval rate, the cap that bounds worst-case payments, and worked numerical examples at Hyperliquid's actual parameter values.
After Lesson 1, the Build OpenHL — Funding course's Lesson 4 — compute_premium — will read as "implementing the formula you already understand" instead of "what is a premium?".
Summary (3 lines)
- Perp = leveraged futures with no expiry. The single most consequential design choice in modern derivatives. No expiry → no built-in convergence → funding payment provides the convergence force, continuously instead of at a single point.
- Three venue types (CEX / DEX-on-L1 / DEX-on-purpose-built-L1). Hyperliquid is the largest purpose-built L1 perp DEX ($300 B+ /year), closed-source;
psyto/openhlis the open reference. - Internalise the parameter set (interval 1 h / divisor 8 / cap ±4 % / margins 10–2 % / liquidation fee 1.5 % / cross-margin / insurance + ADL) — Lessons 1–3 use them throughout.