Skip to main content
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.

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.
When abstraction is enabled, the account exposes:

Cross-DEX Transfers

Transfers between DEXes use explicit routing with source and destination parameters:
The 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 via UserPortfolioMarginAction 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

ActivateUnifiedAccount is a one-way operation. Once activated, it cannot be reversed.
The ActivateUnifiedAccount 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 abstraction
  • crossMaintenanceMarginUsed — Maintenance margin across cross-margined positions
  • withdrawable — Available for withdrawal after all margin requirements

Margin Tables

Each DEX references a MarginTable that defines its risk parameters:

Aligned Quote Tokens

The aligned quote token system enables non-USDC collateral:
The 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

The 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:
Sub-account tracking fields:

Multi-signature accounts

HyperLiquid supports native multi-signature accounts at the L1 level through ConvertToMultiSigUser. 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.
Converting to a multi-sig account is a significant operation. Ensure all intended signers are configured correctly before conversion.

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

The isCross 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

  • CreateSubAccountAction — create sub-accounts
  • SubAccountModifyAction — modify leverage, orders, isolated margin
  • SubAccountTransferAction — USD transfers between accounts
  • SubAccountSpotTransferAction — spot token transfers
  • UsdClassTransferAction — perp to spot class transfers
  • activateDexAbstraction — enable abstraction
  • AgentEnableDexAbstractionAction — agent-initiated enable
  • UserDexAbstractionAction — user-initiated DEX abstraction operations
  • accountClassTransfer — cross-class transfers
  • Source/destination DEX routing for inter-DEX transfers
  • UserPortfolioMarginAction — enable and configure portfolio margin
  • ActivateUnifiedAccount — one-way unification (irreversible)
  • borrowLend integration for margin calculations
  • TokenDelegate — cross-system token delegation
  • LinkStakingUserAction — staking unification