The clearinghouse: one margin engine
HyperCore's clearinghouse holds balances and positions and checks margin on every trade; in standard mode each perp dex has its own balance and cross margin.
A leveraged position is a promise to pay, and the clearinghouse makes sure you can keep it. Perp books reference it inside HyperCore’s execution state, so margin check and match happen together, in consensus order.
Three margin numbers govern a position
Section titled “Three margin numbers govern a position”Say you open 6,000 USDC of ETH perps, 2 ETH at a mark of 3,000, at 20x, the maximum.
- Initial margin: 2 × 3,000 / 20 = 300 USDC.
- Maintenance margin: half of that, 150 USDC. Below it, your cross account is liquidated at the mark price, not the last trade.
- Before any transfer out: max(300, 0.1 × 6,000) = 600 USDC must stay.
Two ledgers per address
Section titled “Two ledgers per address”- Perps: balance and positions. Deposits credit cross margin first.
- Spot: token balances and holds, including HIP-4 outcome positions (invisible to a perps
clearinghouseStatequery). - Not collateral: staked HYPE (a separate staking balance) and vault equity. Each vault and sub-account is a separate clearinghouse account.
Each perp dex keeps its own ledger
Section titled “Each perp dex keeps its own ledger”The clearinghouse is one design, not one pool of margin. Each HIP-3 perp dex has its own margining, order books and deployer settings; the validator-operated perps are the first dex. Account modes change how balances combine:
| Mode | Spot and perp balances | Cross margin across perp dexes |
|---|---|---|
| Standard (also called manual) | Separate perp and spot balances, and a separate balance per dex | Only within one dex |
| Unified account | One balance per asset, shared by spot and by every cross position collateralised in that asset | Shared across dexes with the same collateral |
| Portfolio margin | One portfolio across eligible assets (HYPE, BTC, USDC, USDT) | Shared; see portfolio margin |
In standard mode a profit on one dex does nothing for a loss on another, even in USDC: move collateral in first.
Margin is checked twice
Section titled “Margin is checked twice”At placement, and again for the resting side at match, since the oracle price may have moved. A resting order that fails is cancelled as marginCanceled: acceptance does not guarantee a fill.
The numbers
Section titled “The numbers”| Quantity | Rule |
|---|---|
| Initial margin | position_size * mark_price / leverage |
| Maintenance margin | half of the initial margin at maximum leverage |
| Margin required before any transfer out | max(initial_margin_required, 0.1 * total_position_value) |
| Cross liquidation | account value below maintenance margin times total open notional |
| User actions per day, unified and portfolio margin | 50k |
| User actions per day, standard | no cap |
| Portfolio margin eligible assets | HYPE, BTC, USDC, USDT |
Cross, isolated and unrealised profit
Section titled “Cross, isolated and unrealised profit”- Cross is the default and most capital-efficient. Isolated caps one position’s loss.
- Strict isolated assets release margin only as the position closes; a HIP-3 dex may offer “no cross” (isolated, margin removable).
- Unrealised profit on cross positions counts as initial margin for new positions; on an isolated position, only for that position.
- Unified account shares margin across HIP-3 dexes with the same collateral.
Reading an account from code
Section titled “Reading an account from code”clearinghouseState returns one perp dex’s view of an account: omit dex or pass "" for the first perp dex, else a HIP-3 dex name.
{ "type": "clearinghouseState", "user": "0x...", "dex": "" }It returns assetPositions (each with szi, entryPx, leverage, liquidationPx, marginUsed, unrealizedPnl), marginSummary, crossMarginSummary, crossMaintenanceMarginUsed and withdrawable. Read liquidationPx; don’t recompute it.
| Surface | Use |
|---|---|
spotClearinghouseState |
Spot balances and outcome tokens; under unified and portfolio margin, all balances and holds (per-dex perp states are then meaningless) |
perpDexs |
Lists dexes; entry 0 is null, the first perp dex |
sendAsset |
Moves value between ledgers: "" (first perp dex), "spot" or a HIP-3 dex name (transfers) |
| Precompiles | 0x800 and 0x813 perp position, 0x801 spot balance, 0x803 withdrawable, 0x80F a dex’s margin summary |
Mode rules that break transfers and fees
Section titled “Mode rules that break transfers and fees”- Under unified and portfolio margin,
usdClassTransfer,spotSendandusdSendfail with “Action disabled when unified account is active”; usesendAsset. - A HyperCore to HyperEVM
sendAssetmust name"spot"as source;""returns “Invalid token”. - Builder code addresses and market deployers must use standard mode, or builder fees do not accrue.
- The discontinued DEX abstraction mode put USDC in perps and everything else in spot; the docs warn HIP-3 cross margin is unintuitive for accounts still in it.
- Referral discounts do not apply to vaults or sub-accounts.
For tiers, see Margin. For choosing a mode, see Account modes.