Skip to main content
HyperLiquid maintains a comprehensive exchange state that encompasses all market data, user accounts, and protocol configuration. The state is organized around a central structure called the locus, which contains market context, execution state, and all active order books.

Top-level state structure

The complete exchange state is organized around the locus and a set of top-level components that manage protocol-wide concerns.

Locus

The locus is the core container for all exchange execution state:
The context fields are updated every block and provide the global reference point for all execution. The next_oid, next_lid, and next_twap_id counters are monotonically increasing and guarantee unique identifiers across the lifetime of the exchange.

Top-level components

Alongside the locus, the protocol maintains several top-level components:
The hardfork field in the context tracks which protocol version is active. Hardfork transitions are coordinated across all validators and activate new features or change execution semantics at a specific block height.

Safety guards

The protocol maintains a set of safety guards that protect exchange integrity and enforce operational limits. These guards can be updated through governance actions.
The post_only_until_time and post_only_until_height guards are commonly active during new market launches. During this period, only limit orders that add liquidity are accepted. Market orders and crossing limit orders are rejected.

Ledger deltas

Every action on HyperLiquid produces a ledger delta that records all resulting balance changes. Ledger deltas provide a complete audit trail of every state mutation.

Deposits and withdrawals

Vault operations

Funding

Transfers

Fees and gas

Token operations

Account management

Lending

Per-block execution data

Each committed block produces a set of structured outputs that capture everything that happened during execution:
The node_raw_book_diffs output provides the lowest-level view of order book mutations and is the basis for reconstructing the full order book state from a snapshot plus incremental updates.