HyperLiquid implements a progressive account abstraction system with three tiers. Each tier adds more unified margin and cross-asset capabilities, from fully isolated per-DEX accounts up to full portfolio margining across perps, spot, and borrow/lend.Documentation Index
Fetch the complete documentation index at: https://hypernode-docs.polynode.dev/llms.txt
Use this file to discover all available pages before exploring further.
Three-Tier Architecture
Tier 1: Standard (Default)
Every new account starts in standard mode. Each perpetual DEX operates with its own isolated clearinghouse state. There is no cross-margin between DEXes. Key characteristics:- Each DEX has independent margin, positions, and balances
- Sub-accounts can be created for further isolation
- Margin mode per position: cross (shared collateral pool within a single DEX) or isolated (dedicated margin per position)
Tier 2: DEX Abstraction
DEX abstraction unifies multiple perp DEX clearinghouse states under a single account view, enabling cross-DEX margin sharing.DEX abstraction is activated via
activateDexAbstraction. Agents can also activate it on behalf of users through AgentEnableDexAbstractionAction.| Field | Description |
|---|---|
dexAbstractionEnabled | Boolean flag indicating abstraction is active |
abstraction | Metadata including description and display name |
perpDexStates | Array of per-DEX statuses |
dexToClearinghouseState | Full clearinghouse state mapped per DEX index |
Cross-DEX Transfers
Transfers between DEXes use explicit routing with source and destination parameters:DexOrSpot union type allows transfers to route between perp DEXes and the spot book within the same operation.
DEX Management (Governance)
Governance actions available per DEX:| Action | Description |
|---|---|
disableDex | Disable a DEX entirely |
setMarginTableIds | Assign margin tables to DEXes |
setOpenInterestCaps | Per-DEX open interest limits |
setFundingMultipliers | Per-DEX funding rate multipliers |
setMarginModes | Per-DEX margin mode configuration |
setFeeScale | Fee structure per DEX |
setGrowthModes | Growth/listing mode per DEX |
Tier 3: Unified Account / Portfolio Margin
Full portfolio margining across perps, spot, and borrow/lend. Enables cross-collateralization with non-USDC tokens. Portfolio margin is enabled viaUserPortfolioMarginAction with an enabled boolean field.
Key fields under portfolio margin:
| Field | Description |
|---|---|
portfolioMarginEnabled | Account-level boolean |
portfolioMarginRatio | Current utilization (0.0 = no risk, 1.0 = liquidation) |
tokenToPortfolioBorrowRatio | Per-token borrow contribution to margin |
evmEscrows | EVM-side locked collateral contributing to margin |
Unified Account Activation
TheActivateUnifiedAccount action consolidates positions across DEXes and enables portfolio margin:
Account State Structure
The clearinghouse state response reveals the full layered structure:Margin Summaries
Two margin summaries are always computed:marginSummary— Traditional per-DEX margin calculation (accountValue,totalNtlPos,totalRawUsd,totalMarginUsed)crossMarginSummary— Cross-margin calculation spanning all positions under abstractioncrossMaintenanceMarginUsed— Maintenance margin across cross-margined positionswithdrawable— Available for withdrawal after all margin requirements
Margin Tables
Each DEX references aMarginTable that defines its risk parameters:
Aligned Quote Tokens
The aligned quote token system enables non-USDC collateral:isAligned field on the account indicates whether the user’s collateral is properly aligned with the DEX’s expected quote token.
Sub-Account System
Sub-accounts allow a master address to operate multiple isolated trading identities. Each sub-account gets its own clearinghouse state, spot state, and position tracking.Creating Sub-Accounts
sub_account_to_master mapping tracks which master address owns each sub-account.
Sub-Account Operations
| Action | Description |
|---|---|
SubAccountModifyAction | Modify settings (leverage, margin, orders) |
SubAccountTransferAction | Transfer USD between master and sub-account |
SubAccountSpotTransferAction | Transfer spot tokens between accounts |
UsdClassTransferAction | Transfer USD between account classes (perp to spot) |
token, amount, and destination (target sub-account address).
Sub-account transfers
Two transfer types are available:| Action | Description |
|---|---|
subAccountTransfer | Transfer USDC between master and sub-accounts |
subAccountSpotTransfer | Transfer spot tokens between master and sub-accounts |
sub_account_tracker at the exchange state level manages the relationship between master accounts and their sub-accounts, tracking permissions and transfer history.
Sub-Account State
The API returns sub-account data within clearinghouse state:| Field | Description |
|---|---|
sub_account_tracker | Tracks all sub-accounts in the system |
sub_accounts | List of sub-accounts for a user |
subAccountUser.master | The master/parent address |
subAccountUser.isCross | Whether this is a cross-margin sub-account |
Multi-signature accounts
HyperLiquid supports native multi-signature accounts at the L1 level throughConvertToMultiSigUser. Once converted, the account requires multiple signers to authorize actions.
The protocol tracks multi-sig state through a multi_sig_tracker at the top level of the exchange state. Multi-sig accounts can participate in all standard operations (trading, transfers, governance) with the additional requirement of collecting sufficient signatures.
Agent Authorization
Agents (trading bots, vaults) can be authorized for abstraction operations:| Action | Description |
|---|---|
AgentEnableDexAbstractionAction | Agent enables DEX abstraction for a user |
agentSetAbstraction | Agent sets abstraction parameters |
userSetAbstraction | User sets their own abstraction config |
Cross-Margin vs Isolated
TheisCross field on sub-accounts and positions indicates the margin mode:
isCross: true— Position uses cross-margin (shared collateral pool)isCross: false— Position is isolated (dedicated margin)
Liquidation Types
| Type | Description |
|---|---|
LiquidateRequest::Cross | Cross-margin liquidation |
LiquidateRequest::Isolated | Isolated position liquidation |
borrowLendLiquidation | Borrow/lend liquidation (portfolio margin) |
Action Types by Tier
Standard (no abstraction)
Standard (no abstraction)
CreateSubAccountAction— create sub-accountsSubAccountModifyAction— modify leverage, orders, isolated marginSubAccountTransferAction— USD transfers between accountsSubAccountSpotTransferAction— spot token transfersUsdClassTransferAction— perp to spot class transfers
DEX Abstraction
DEX Abstraction
activateDexAbstraction— enable abstractionAgentEnableDexAbstractionAction— agent-initiated enableUserDexAbstractionAction— user-initiated DEX abstraction operationsaccountClassTransfer— cross-class transfers- Source/destination DEX routing for inter-DEX transfers
Portfolio Margin / Unified
Portfolio Margin / Unified
UserPortfolioMarginAction— enable and configure portfolio marginActivateUnifiedAccount— one-way unification (irreversible)borrowLendintegration for margin calculationsTokenDelegate— cross-system token delegationLinkStakingUserAction— staking unification