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.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: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:
Under portfolio margin, multiple tokens can serve as collateral simultaneously. Borrow/lend positions count toward portfolio margin calculations.
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
Spot transfers include fields for
token, amount, and destination (target sub-account address).
Sub-account transfers
Two transfer types are available:
The
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: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:
This allows vault managers and automated systems to operate across abstraction tiers on behalf of users.
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
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