How Does Hyperliquid Work: A Technical Deep Dive

If you're building a high-performance perp DEX — a decentralized perpetual futures exchange — or just doing some research on a perpetual DEX trending narrative, this blog is for you.
We’ll walk through how the key technical components behind Hyperliquid work, how this perpetual DEX is different from other decentralized exchanges, and dig into the architecture layers, their key modules, and their functions.
Hyperliquid vs. Typical Decentralized Exchanges
Most decentralized exchanges are built around automated market makers (AMMs). In that model, the price of one asset relative to another follows a predefined curve. We’re not going to dive into different AMM models in this post, but you can read more in our other post on AMM models in DEX development.
In an AMM, liquidity comes from users who deposit funds into pools — liquidity providers. They supply the assets, but they don’t directly set the price. The curve does.
Another and key defining trait of DEXs is that users keep full control of their funds. Since most are built on smart contracts, your assets stay in your wallet while you trade. You don’t hand them over to a third party. And in AMM-based DEXs, you don’t even need another user on the other side of the trade — swaps happen automatically against the pool.
That’s the model most people associate with a decentralized exchange: automatic pricing, no middleman, and user custody. But it also comes with limitations — liquidity fragmentation, execution slippage, and a trading experience that’s very different from centralized exchanges (CEXs).
CEXs, in contrast, deprive users of control over their assets — accounts can be blocked, KYC is mandatory, and on top of that we all remember a sad lesson of FTX. These are exactly the problems a perpetual DEX like Hyperliquid is designed to solve.
What if a Decentralized Exchange Worked Like a Centralized One?
At first glance, Hyperliquid feels like a centralized exchange. The UI looks like one. The mechanics resemble one. You could almost call it a “CEX-like DEX.” The difference is that, according to the docs, Hyperliquid is still fully decentralized.
That raises the obvious question: how does Hyperliquid work, and what makes it different from other perpetual DEXs?
The Perps Core: Hyperliquid’s On-Chain Order Book
The answer starts with its central limit order book (CLOB). Unlike typical perpetual DEXs, Hyperliquid claims the entire CLOB system runs on-chain.
Hyperliquid built its own blockchain and embedded the order book logic directly into it — order creation, matching, cancellations, all handled at the protocol level.
So when you think of Hyperliquid, you have to hold two things in mind:
- It’s a Hyperliquid decentralized perpetuals exchange with a full-fledged trading interface like a CEX.
- It’s also a blockchain. Technically, almost two blockchains.
We’ll break down the chain design first, and then dive into how the Hyperliquid on-chain order book works.
Hyperliquid’s Architecture: The Custom L1 Blockchain
We’ve already covered that Hyperliquid isn’t just a perpetual DEX — it’s also a Layer 1 blockchain. At the core is a custom consensus protocol called HyperBFT, whose main purpose, as in any blockchain, is to ensure consistency of the network’s state across all participants.
A Hyperliquid blockchain is a custom Layer 1 network that combines high-performance trading capabilities with Ethereum-compatible smart contracts. It uses HyperBFT consensus to secure two parallel execution environments: HyperCore for trading and HyperEVM for smart contracts.
How HyperBFT Consensus Works
Consensus in HyperBFT is reached through rotating leaders over multiple rounds:
- A leader proposes a block.
- Validators exchange messages and vote.
- Agreement is reached through a series of communication rounds.
The leader is the validator temporarily responsible for proposing the next block. Leaders rotate, so no single validator monopolizes block production. Voting power and participation rights are weighted by stake (including delegated deposits).
In essence, it’s a Delegated Proof-of-Stake (DPoS) that we’re all familiar with. It keeps the network running even if some nodes fail or act maliciously. HyperBFT maintains Byzantine Fault Tolerance (BFT), meaning the blockchain stays secure and live even if up to one-third of validators are offline or malicious.
Everything sounds fairly standard — until you realize that Hyperliquid’s blockchain state is split into two execution environments.
Hyperliquid blockchain Execution Environments: HyperCore and HyperEVM
- HyperCore – the trading engine. This is the heart of the Hyperliquid decentralized perpetuals exchange, running the high-performance on-chain order book, handling order matching, cancellations, and all trading logic.
- HyperEVM – an Ethereum-compatible environment for smart contracts and external integrations.
Both environments run side by side but are secured by the same consensus protocol, HyperBFT. This is where things start to get interesting.
Hyperliquid Architecture Layers
Let’s take a look at the high-level diagram:

Source: Hyperliquid Community Wiki
Looking at the diagram, we can break Hyperliquid into four layers:
- Frontend Layer – The interface users interact with: placing orders, checking balances, and tracking trades. Basically, a UI for the trading engine.
- Application Logic Layer – Defines rules and behavior of the application: how orders are validated, trades executed, and user requests processed before reaching the blockchain.
- Execution Environment Layer – Where the actual computations happen:
- HyperCore runs the trading engine and order matching.
- HyperEVM runs Ethereum-compatible smart contracts.
Both environments execute transactions according to rules defined in the application logic layer.
- Consensus Layer – Ensures all nodes agree on the blockchain state. HyperBFT guarantees that every validator sees the same blockchain state and that all on-chain operations — trades, order matching, cancellations — are final and consistent across the network.
A reminder, even though there are two separate execution environments, both operate on the same HyperBFT consensus protocol. According to the documentation, this architecture allows to access data stored in HyperCore from HyperEVM. Which is particularly notable when we dive into exactly which data is accessible and what HyperCore and HyperEVM are.
HyperCore: The On-Chain Order Book Engine
The most substantial part of the protocol is HyperCore. Essentially, this is the Hyperliquid perpetual DEX itself, and also a core component of the Hyperliquid blockchain introduced earlier. Think of it as a high-performance trading engine wrapped in a blockchain, providing users with a trading experience on steroids — comparable to a CEX.
HyperCore is the fully on-chain trading engine of the Hyperliquid decentralized perpetuals exchange. It stores the complete state of every order across all asset pairs, handles order matching, cancellations, and all trading logic — fully on-chain, with zero off-chain order book or hidden matching.
On-Chain Order Matching
HyperCore is a fully on-chain Central Limit Order Book (CLOB). Every order, trade, and cancellation is recorded as a transaction in the blockchain state. There’s no off-chain matching engine or hidden order book — everything is deterministic, auditable, and secured by the network consensus.
Orders are matched according to price-time priority:
- Orders with the most competitive price execute first.
- Among orders at the same price, the oldest orders execute first.
This ensures a single canonical outcome for order matching — all validators reach the same deterministic result, which is critical in a blockchain environment.
Hyperliquid Performance: Sub-Second Finality and Throughput
It’s also important to mention two key network metrics for Hyperliquid: latency and throughput.
Latency is the time between sending a request and receiving a response. In trading, even seconds matter, because real money is at stake. In trading, latency isn't a metric—it's THE metric. So, there’s a big and essential question: can Hyperliquid deliver a UX that satisfies trading use case? As we all know how long it can sometimes take to confirm a transaction.
How Fast is Hyperliquid?
HyperCore, the trading engine of Hyperliquid’s decentralized perpetual DEX, can compete with existing solutions on performance metrics. It’s written in RustVM and optimized for trading logic. Running on the custom HyperBFT consensus, it can finalize orders in under a second — with an average of ~0.2 seconds observed on test stages.
Throughput is reported at 200,000 orders per second, with the potential to scale further as the system is optimized. These performance metrics are driven by the fact that order matching and other core operations (which we’ll cover below) run natively in HyperCore, rather than through expensive EVM calls.
These performance metrics are driven by the fact that order matching and other core operations, which we’ll cover below, run natively in HyperCore, rather than through expensive EVM calls.
So, is Hyperliquid Decentralized?
It’s now clear why Hyperliquid offers features usually associated with centralized exchanges while still functioning as a DEX. At first glance, this might seem confusing — but technically, it makes perfect sense.
Here’s why:
- The order matching logic runs right on Hyperliquid’s blockchain.
- Independent validators make sure everything is correct, hitting a single, deterministic outcome — nobody can just shuffle orders around.
- Every trade, order, and cancellation is on-chain, verifiable, and deterministic.
So yeah — Hyperliquid is decentralized. Not just in how funds are held, but in how trades are executed and verified. Transparency and determinism are baked in.
Perpetual Futures on Hyperliquid
Let’s dive deeper into HyperCore and explore its full capabilities.

The top of the architecture diagram shows the UI that users interact with — it looks just like a CEX. But under the hood, the system is powered by the Hyperliquid blockchain and the HyperCore engine.
So far, we’ve mostly talked about the order book in terms of spot trading. But Hyperliquid also supports perpetuals — open-ended positions. Unlike spot trades, which swap assets immediately, perpetuals require a separate collateral mechanism. On Hyperliquid, all perpetual positions are collateralized with USDC, keeping calculations transparent and standardized.
Perpetual futures are derivative contracts with no expiration date that allow traders to take long or short positions on an asset. Traders can use leverage, and the contract is collateralized, with funding rates applied to keep the contract price aligned with the underlying asset.
Leverage on the Hyperliquid Perpetual Dex
A key feature of perpetuals is leverage — borrowing funds against your deposit to open a larger position. Hyperliquid determines available leverage based on the maximum order size:
Market Orders:
- $15M → leverage up to ≥25x
- $5M → leverage 20–25x
- $2M → leverage 10–20x
- $500K → lower leverage
Limit Orders:
- Maximum leverage 10x
This system gives traders flexibility but also increases risk, particularly around liquidations.
Clearinghouse: Central Accounting System of the Hyperliquid Decentralized Perps
To track margin, prevent under-collateralized trades, and manage liquidations, Hyperliquid decentralized perpetuals exchange includes a dedicated clearinghouse (shown on the diagram just below the UI).
Deposits are credited to a user's portfolio margin account, and by default, all positions are opened using cross-margin mode. However, the system also allows creating isolated margin on a per-position basis.
Think of it as the “central accounting” of the Hyperliquid perpetual DEX:
- It verifies that a trader has enough collateral for a position — twice: at order placement and at execution.
- It calculates the current PnL.
- It ensures correct order execution in line with margin requirements.
- Every aspect of both perpetual and spot trading, from deposits to liquidations, goes through this component.
The clearinghouse manages:
- Balance and position management: It tracks user deposits, withdrawals, and margin balances, and manages all open positions — both perpetual and spot trades.
- Leverage and maintenance margin: It enforces that traders stay within their selected leverage limits and maintains system stability by applying initial margin requirements (collateral needed to open a position) and maintenance margin requirements (minimum collateral to keep a position open).
- Liquidations: The clearinghouse monitors account balances to prevent insolvency. If an account falls below the required margin, it automatically triggers liquidation.
- Funding rate calculation: It computes the funding rate (we’ll cover this in more detail later) to keep perpetual contract prices aligned with their underlying assets, ensuring fair market conditions.
- Oracle integration: The clearinghouse uses oracles (also visible in the diagram) to provide accurate asset prices. Price calculation is fully on-chain: validators calculate each asset’s price as a volume-weighted average from exchanges including Binance, OKX, Bybit, Kraken, KuCoin, Gate.io, MEXC, and Hyperliquid, using weights of 3, 2, 2, 1, 1, 1, 1, 1, respectively. The final price applied by the clearinghouse is then a weighted average across all validators, where each validator’s weight depends on the size of their stake plus delegated deposits.
How Does Hyperliquid's Funding Work?
Earlier, we mentioned the funding rate in Hyperliquid. Let’s break down what it is and how it works in a Hyperliquid decentralized perpetuals exchange.
The funding rate is a mechanism designed to align the price of a perpetual contract with the spot price. Here’s how it works:
- If the perpetual is trading above the spot price, long holders pay short holders.
- Conversely, if the perpetual is trading below the spot price, short holders pay long holders.
The amount the parties pay to each other is called the funding rate. It’s calculated using the following formula:
Funding Rate=Average Premium Index (P)+clamp(Interest Rate - Premium Index (P), -0.0005, 0.0005)Funding Rate=Average Premium Index (P)+clamp(Interest Rate - Premium Index (P), -0.0005, 0.0005)
Paid hourly to maintain alignment between perpetual and spot prices in the Hyperliquid perpetual DEX.
Here:
- Premium Index (P) is the difference between the impact price (how the price moves based on trades) and the oracle price.
- Clamp limits sharp deviations between the interest rate (fixed at 0.01%) and the premium index, preventing extreme fluctuations in the funding rate.
On Hyperliquid, funding is paid out every hour. This keeps perpetual prices closely tied to the spot market and prevents them from drifting too far. The system encourages traders to take the side of the trade (long or short) that helps bring the perpetual price in line with the underlying asset. In this way, the funding rate acts as a “balancing tool” for the system: it keeps prices near fair value and aligns the interests of everyone in the market.
Order Types and Options in Hyperliquid Perpetual DEX
Looking at the UI, it’s worth covering the types of orders that the Hyperliquid decentralized perpetuals exchange supports:
- Market Order: executes immediately at the current market price.
- Limit Order: executes at the specified limit price or better.
- Stop Market Order: a market order triggered when the price hits a stop level, used to limit losses or lock in profits.
- Stop Limit Order: a limit order that triggers at a chosen stop price.
- TWAP (Time-Weighted Average Price): splits a large order into smaller chunks executed at intervals to reduce market impact.
- Scale Orders: places multiple limit orders within a set price range to efficiently capture volatility and profit from price swings.
In addition to order types, Hyperliquid perpetual dex provides a variety of order options to give traders flexibility:
- Reduce Only: only reduces an existing position; it won’t open a new one in the opposite direction.
- Good Til Cancel (GTC): stays in the order book until it’s either filled or manually canceled.
- Post Only (ALO): adds the order to the book without executing it immediately.
- Immediate or Cancel (IOC): cancels the order if it can’t be executed right away.
- Take Profit (TP): triggers a market or limit order to close a position once a certain profit level is reached.
- Stop Loss (SL): triggers a market or limit order to close a position if a specified loss threshold is hit.
All of these order types and options are fully handled on-chain by HyperCore, meaning every execution is recorded directly on the blockchain. This ensures deterministic, auditable results and gives traders a familiar exchange-like experience — all while retaining the security and transparency of a Hyperliquid decentralized exchange.
Here, we’re finishing covering the core of HyperCore. It’s a robust trading infrastructure—a standalone, fully on-chain order book where users can trade, manage positions, and track asset prices in real time.
How Hyperliquid HypEVM Works
Now, let’s dive into how HypEVM works. HyperEVM is not a separate blockchain — it’s an extension of the main Hyperliquid blockchain, secured by the same HyperBFT consensus. For developers, it provides a familiar EVM execution environment, giving full access to smart contracts while preserving the security and determinism of the Hyperliquid decentralized perpetual exchange.
HyperEVM runs the Cancun hard fork, maintaining compatibility with Ethereum tools and workflows. EIP-1559 is active, so base fees are burned as usual, deducted from the total supply. Unlike most other EVM chains, priority fees are also burned, since HyperEVM leverages HyperBFT consensus. These burned priority fees go directly to the zero address balance.
HyperEVM block structure

The block structure in HyperEVM is worth noting. Blocks are split into two types:
- Small blocks: Up to 2M gas, processed every second, ideal for fast trades and near-instant confirmations.
- Large blocks: Up to 30M gas, processed roughly once per minute, designed for complex contract execution without congesting the network.
This design gives users a choice: traders can use small blocks for near-instant order confirmations, while developers can deploy complex contracts on large blocks without overloading the network.
HyperEVM Meets HyperCore: On-Chain Market Access
The key value of Hyperliquid architecture is in how HyperCore and HyperEVM work together. From HyperEVM, you can make calls to HyperCore — fetching prices, orders, user balances, validator deposits, and blockchain info like block numbers. And it’s not just read-only: you can also write data. That means HyperEVM can use HyperCore’s tools to manage orders and trade directly on-chain.
This means smart contracts on HyperEVM can become active market participants, executing structured, deterministic actions while fully respecting HyperCore’s security model. Essentially, HyperEVM allows decentralized applications to interact directly with the order book and liquidity of the Hyperliquid perpetual dex.
This architecture allows dApps to interact directly with market data and order execution through smart contracts.
Building on Hyperliquid
With HyperCore and HyperEVM combined, Hyperliquid decentralized perpetual exchange is more than just a trading platform. It’s an open on-chain financial system, where traditional exchange mechanics are integrated with smart contract capabilities. Developers and users can create new financial instruments on top of the existing infrastructure.
Hyperliquid demonstrates that the future of on-chain markets isn’t just about deterministic trading and solid risk management — it’s about a flexible architecture that supports new DeFi products. That’s what makes the protocol compelling for both traders and builders in the Hyperliquid perpetual dex ecosystem.

In this way, Hyperliquid is not just a trading platform, but a fully open on-chain financial system, where traditional exchange mechanisms are integrated with smart contract capabilities.
With the HyperCore and HyperEVM, developers and users get an environment where decentralized applications can interact directly with the order book and liquidity, enabling the design of new financial instruments on top of the existing ecosystem.
Hyperliquid shows that the future of on-chain markets isn’t only about transparent trading and effective risk controls, but also about a flexible architecture that opens the door to entirely new DeFi product models. That’s what makes the protocol genuinely compelling — for traders and for builders alike.
Key Takeaways
- Hyperliquid is a Layer-1 perpetual DEX
Hyperliquid is a decentralized perpetual futures exchange built into its own Layer-1 blockchain. It combines two execution layers—HyperCore for high-performance trading and HyperEVM for smart contracts—on a single HyperBFT consensus, providing CEX-level trading performance with fully on-chain, deterministic order execution. - HyperCore: Fully on-chain order book
- Stores the complete state of orders across all asset pairs.
- Handles order matching, cancellations, and trade logic fully on-chain.
- Ensures deterministic outcomes with price-time priority, enabling auditable, predictable trading mechanics.
- Supports both spot and perpetual trading, with cross-margin and isolated margin modes.
- Clearinghouse: Central accounting for perpetuals
- Tracks user deposits, withdrawals, margin balances, and all open positions.
- Enforces leverage limits, initial margin, and maintenance margin requirements.
- Automatically triggers liquidations for accounts below required margin.
- Computes the funding rate to align perpetuals with spot prices.
- Integrates on-chain oracles, calculating volume-weighted asset prices across exchanges and validators for accurate market pricing.
- Funding rate mechanics
- Keeps perpetual contracts aligned with underlying assets.
- Longs pay shorts when the perp trades above spot; shorts pay longs when below.
- Calculated as:
Funding Rate = Average Premium Index (P) + clamp(Interest Rate - Premium Index, -0.0005, 0.0005) - Paid hourly, encouraging traders to balance the perpetual price relative to spot.
- Order types and options for traders
- Market, Limit, Stop Market, Stop Limit, TWAP, and Scale orders.
- Order options include Reduce Only, GTC, Post Only (ALO), IOC, Take Profit, and Stop Loss.
- Fully on-chain execution via HyperCore ensures deterministic, auditable results, replicating a CEX-like trading experience.
- HyperEVM: Ethereum-compatible smart contracts
- Runs the Cancun hard fork, fully compatible with Ethereum tooling.
- EIP-1559 active, with both base and priority fees burned on-chain.
- Block types:
- Small blocks (2M gas, 1s) for fast trades.
- Large blocks (30M gas, ~1min) for complex contracts.
- Direct HyperCore integration allows dApps to read and write market data, making smart contracts active participants in trading.
- Hyperliquid Performance metrics
- Sub-second finality (~0.2s average) for order confirmations.
- Throughput of 200k orders per second, scalable with optimization.
- HyperCore-native execution avoids expensive EVM calls, maximizing speed and determinism.
- Hyperliquid’s architecture enables new DeFi products
- Combines centralized exchange-like UX with decentralized, composable infrastructure.
- Developers can build financial instruments directly on-chain, leveraging real-time market data and liquidity.
- The system demonstrates a future-proof model for high-performance on-chain trading, solving liquidity fragmentation and slippage issues common in AMM-based DEXs.
About Rock’n’Block
About Rock’n’Block
Rock’n’Block is a Web3-native development studio building production-grade blockchain infrastructure and decentralized applications. We help founders launch high-performance products faster, build UX that can serve millions of users, and stand out in competitive markets.
Follow us on X for more deep dives
What We Do
- Build custom Layer-1 chains, DeFi protocols, and decentralized exchanges.
- Develop perpetual DEXes with order books, funding rates, margining, liquidations, and oracle integrations.
- Create blockchain data streaming solutions that process real-time and historical data efficiently.
- Implement chain-agnostic payment solutions and financial tooling.
Our team has nearly a decade of hands-on blockchain experience, supporting products used by 71M+ DeFi users, across systems totaling $2.5B in market cap, and helping partners raise $167M.
We ♥️ Development