Hyperliquid Docs
  • About Hyperliquid
    • Core contributors
  • Onboarding
    • How to start trading
    • How to use the HyperEVM
    • Connect mobile via QR code
    • Export your email wallet
    • Testnet faucet
  • HyperCore
    • Overview
    • Bridge
    • API servers
    • Clearinghouse
    • Oracle
    • Order book
    • Staking
    • Vaults
      • Protocol vaults
      • For vault leaders
      • For vault depositors
    • Multi-sig
  • HyperEVM
    • Tools for HyperEVM builders
  • Hyperliquid Improvement Proposals (HIPs)
    • HIP-1: Native token standard
    • HIP-2: Hyperliquidity
    • HIP-3: Builder-Deployed Perpetuals
    • Frontend checks
  • Trading
    • Perpetual assets
    • Contract specifications
    • Fees
    • Builder codes
    • Order book
    • Order types
    • Take profit and stop loss orders (TP/SL)
    • Margining
    • Liquidations
    • Entry price and pnl
    • Funding
    • Miscellaneous UI
    • Auto-deleveraging
    • Robust price indices
    • Self-trade prevention
    • Portfolio graphs
    • Hyperps
    • Market making
  • Validators
    • Running a validator
    • Delegation program
  • Referrals
  • Points
  • Historical data
  • Risks
  • Bug bounty program
  • Audits
  • Brand kit
  • For developers
    • API
      • Notation
      • Asset IDs
      • Tick and lot size
      • Nonces and API wallets
      • Info endpoint
        • Perpetuals
        • Spot
      • Exchange endpoint
      • Websocket
        • Subscriptions
        • Post requests
        • Timeouts and heartbeats
      • Error responses
      • Rate limits
      • Bridge2
      • Deploying HIP-1 and HIP-2 assets
      • Deploying HIP-3 assets
    • HyperEVM
      • Dual-block architecture
      • Raw HyperEVM block data
      • Interacting with HyperCore
      • HyperCore <> HyperEVM transfers
      • Wrapped HYPE
      • JSON-RPC
    • Nodes
      • Reading L1 Data
Powered by GitBook
On this page
  1. For developers
  2. Nodes

Reading L1 Data

The node writes data to ~/hl/data. With default settings, the network will generate around 100 GB of logs per day, so it is recommended to archive or delete old files.

Transaction Blocks

Blocks parsed as transactions are streamed to

~/hl/data/replica_cmds/{start_time}/{date}/{height}

State Snapshots

State snapshots are saved every 10,000 blocks to

~/hl/data/periodic_abci_states/{date}/{height}.rmp

Trades

Trades data is saved to

~/hl/data/node_trades/hourly/{date}/{hour}
// Example trade
{
  "coin": "COMP",
  "side": "B",
  "time": "2024-07-26T08:26:25.899",
  "px": "51.367",
  "sz": "0.31",
  "hash": "0xad8e0566e813bdf98176040e6d51bd011100efa789e89430cdf17964235f55d8",
  "trade_dir_override":"Na",
  // side_info always has length 2
  // side_info[0] is the buyer
  // side_info[1] is the seller
  "side_info": [
    {
      "user": "0xc64cc00b46101bd40aa1c3121195e85c0b0918d8",
      "start_pos": "996.67",
      "oid": 12212201265,
      "twap_id": null,
      "cloid": null
    },
    {
      "user": "0x768484f7e2ebb675c57838366c02ae99ba2a9b08",
      "start_pos": "-996.7",
      "oid": 12212198275,
      "twap_id": null,
      "cloid": null
    }
  ]
}

Order Statuses

Order status data is saved to

~/hl/data/node_order_statuses/hourly/{date}/{hour}
// Example order status
{
  "time": "2024-07-26T08:31:48.717",
  "user": "0xc64cc00b46101bd40aa1c3121195e85c0b0918d8",
  "status": "canceled",
  "order": {
    "coin": "INJ",
    "side": "A",
    "limitPx": "25.381",
    // filled size
    "sz": "257.0",
    "oid": 12212359592,
    "timestamp": 1721982700270,
    "triggerCondition": "N/A",
    "isTrigger": false,
    "triggerPx": "0.0",
    "children": [],
    "isPositionTpsl": false,
    "reduceOnly": false,
    "orderType": "Limit",
    // original order size
    "origSz": "257.0",
    "tif": "Alo",
    "cloid": null
  }
}

Miscellaneous Events

Miscellaneous event data is saved to

~/hl/data/misc_events/hourly/{date}/{hour}

Miscellaneous events currently include the following

  • Staking deposits

  • Staking delegations

  • Staking withdrawals

  • Validator rewards

  • Ledger updates (funding distributions, spot transfers, etc)

type MiscEvent = {
  time: string;
  hash: string;
  inner: MiscEventInner;
}

type MiscEventInner = CDeposit | Delegation | CWithdrawal | ValidatorRewards | LedgerUpdate;

type CDeposit = {
  user: string;
  amount: number;
}

type Delegation = {
  user: string;
  validator: string;
  amount: number;
  is_undelegate: boolean;
}

type CWithdrawal = {
  user: string;
  amount: number;
  is_finalized: boolean;
}

type ValidatorRewards = {
  validator_to_reward: Array<[string, number]>;
}

type LedgerUpdate = {
  users: Array<string>;
  delta: LedgerDelta;
}

// InternalTransfer means Perp USDC transfer
// RewardsClaim is for builder and referrer fees
// Deposit/Withdraw refer to Arbitrum USDC bridge
type LedgerDelta = Withdraw 
  | Deposit
  | VaultCreate
  | VaultDeposit
  | VaultWithdraw
  | VaultDistribution
  | VaultLeaderCommission
  | Liquidation
  | Funding
  | InternalTransfer
  | SubAccountTransfer
  | SpotTransfer
  | SpotGenesis
  | RewardsClaim
  | AccountActivationGas
  | PerpDexClassTransfer
  | DeployGasAuction;
  
type Withdraw = {
  usdc: number;
  nonce: number;
  fee: number;
}

type Deposit = {
  usdc: number;
}

type VaultCreate {
  vault: string;
  usdc: number;
  fee: number;
}

type VaultWithdraw {
  vault: string;
  user: string;
  requestedUsd: number;
  commission: number;
  closingCost: number;
  basis: number;
}

type VaultDistribution {
  vault: string;
  usdc: number;
}

type Liquidation {
  liquidatedNtlPos: number;
  accountValue: number;
  leverageType: string;
  liquidatedPositions: Array<LiquidatedPosition>;
}

type LiquidatedPosition {
  coin: string;
  szi: number;
}

type Funding {
  coin: string;
  usdc: number;
  szi: number;
  fundingRate: number;
  nSamples: number;
}
 
type InternalTransfer {
  usdc: number;
  user: string;
  destination: string;
  fee: number;
}

type AccountClassTransfer {
  usdc: number;
  toPerp: boolean;
}

type SubAccountTransfer {
  usdc: number;
  user: string;
  destination: string;
}

type SpotTransfer {
  token: string;
  amount: number;
  usdcValue: number;
  user: string;
  destination: string;
  fee: number;
  nativeTokenFee: number;
}

type SpotGenesis {
  token: string;
  amount: number;
}

type RewardsClaim {
  amount: number;
}

type AccountActivationGas {
  amount: number;
  token: string;
}

type PerpDexClassTransfer {
  amount: number;
  token: string;
  dex: string;
  toPerp: boolean;
}

type DeployGasAuction {
  token: string;
  amount: number;
}
PreviousNodes

Last updated 2 days ago