이 페이지는 커뮤니티 번역으로 참고용이며, 내용은 영어 원문을 우선합니다.
영어 원문 보기 ↗

L1 데이터 스키마

노드는 ~/hl/data에 데이터를 기록합니다. 기본 설정에서 네트워크는 하루에 약 100 GB의 로그를 생성하므로, 오래된 파일은 보관하거나 삭제하는 것이 좋습니다.

아래 보조 데이터를 생성하기 위한 커맨드 라인 플래그는 https://github.com/hyperliquid-dex/node에서 확인할 수 있습니다.

트랜잭션 블록

트랜잭션으로 파싱된 블록은 다음으로 스트리밍됩니다

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

상태 스냅샷

상태 스냅샷은 10,000블록마다 다음에 저장됩니다

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

거래

거래 데이터는 다음에 저장됩니다

~/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
    }
  ]
}

체결

체결 데이터는 다음에 저장됩니다

~/hl/data/node_fills/hourly/{date}/{hour}
// Example fill
[                                                                              18:18:32 [11/1124]
  "0x1111111111111111111111111111111111111111",
  {
    "coin": "BTC",
    "px": "100000.0",
    "sz": "0.01",
    "side": "B",
    "time": 1721982385899,
    "startPosition": "0.0",
    "dir": "Open Long",
    "closedPnl": "0.0",
    "hash": "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    "oid": 123456789,
    "crossed": true,
    "fee": "0.55",
    "builderFee": "0.10",
    "builder": "0x2222222222222222222222222222222222222222",
    "subBuilders": [
      {
        "b": "0x3333333333333333333333333333333333333333",
        "s": 25000
      }
    ],
    "tid": 123456789012345,
    "feeToken": "USDC",
    "twapId": null
  }
]

주문 상태

주문 상태 데이터는 다음에 저장됩니다

~/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
  }
}

원시 오더북 차분

원시 오더북 차분 데이터는 다음에 저장됩니다

~/hl/data/node_raw_book_diffs/hourly/{date}/{hour}
// Example raw book diffs
// new resting order
{
  "user":"0x768484f7e2ebb675c57838366c02ae99ba2a9b08",
  "oid":35061046831,
  "coin":"CHILLGUY",
  "side": "Bid",
  "px": "1.36",
  "raw_book_diff": {
    "new":{"sz":"186910.0"}
  }
}
// resting order update
{
  "user":"0x768484f7e2ebb675c57838366c02ae99ba2a9b08",
  "oid":35061055064,
  "coin":"BTC",
  "side": "Bid",
  "px": "115323.2",
  "raw_book_diff": {
    "update":{"origSz":"0.2086","newSz":"0.2076"}
  }
}
// order removal
{
  "user":"0xc64cc00b46101bd40aa1c3121195e85c0b0918d8",
  "oid":35061057543,
  "side": "Ask",
  "px": "115200.2"
  "coin":"HYPE",
  "raw_book_diff":"remove"
}

기타 이벤트

기타 이벤트 데이터는 다음에 저장됩니다

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

기타 이벤트에는 현재 다음이 포함됩니다

  • 스테이킹 입금
  • 스테이킹 위임
  • 스테이킹 출금
  • 검증인 보상
  • 원장 업데이트(펀딩 분배, 스팟 이체 등)
type MiscEvent = {
  time: string;
  hash: string;
  inner: MiscEventInner;
}

type MiscEventInner = CDeposit | Delegation | CWithdrawal | ValidatorRewards | Funding | 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 Funding {
  coin: string;
  usdc: number;
  szi: number;
  fundingRate: number;
  nSamples: 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
  | 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 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;
}

L4 스냅샷

abci 상태가 주어지면 노드는 L4 오더북 스냅샷을 계산할 수 있으며, 이는 각 레벨의 주문에 대한 전체 정보를 담고 있는 전체 오더북입니다. 이는 주문 상태 스트림을 적용할 수 있는 체크포인트로 사용될 수 있어, 사용자가 L4 오더북을 실시간으로 스트리밍할 수 있습니다.

스냅샷의 주문은 동일한 가격 레벨에서 시간 순서로 정렬됩니다. 트리거 주문은 마지막에 배치되며 isTrigger 로 구분할 수 있습니다.

[
  [
    "BTC", // coin
    [
      [ // bids
        {
          "coin": "BTC",
          "side": "B",
          "limitPx": "103988.0",
          "sz": "0.2782",
          "oid": 30112287571,
          "timestamp": 1747157301016,
          "triggerCondition": "N/A",
          "isTrigger": false,
          "triggerPx": "0.0",
          "children": [],
          "isPositionTpsl": false,
          "reduceOnly": false,
          "orderType": "Limit",
          "origSz": "0.2782",
          "tif": "Alo",
          "cloid": null
        },
        ..
      ],
      [ // asks
        {
          "coin": "BTC",
          "side": "A",
          "limitPx": "93708.0",
          "sz": "0.00047",
          "oid": 30073539988,
          "timestamp": 1747128626867,
          "triggerCondition": "Price below 101856",
          "isTrigger": true,
          "triggerPx": "101856.0",
          "children": [],
          "isPositionTpsl": false,
          "reduceOnly": true,
          "orderType": "Stop Market",
          "origSz": "0.00047",
          "tif": null,
          "cloid": null
        },
        ..
      ]
    ]
  ],
  [
    "ETH",
    ..
  ],
  [
    "SOL",
    ..
  ]
]
영문 공식 출처: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/nodes/l1-data-schemas
원문 수집일: · 미러 빌드일: · 커뮤니티 번역이며 영문 원문 우선
비공식 커뮤니티 번역입니다. 저작권은 Hyperliquid에 있으며 영어 원문을 우선합니다. 출처: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/nodes/l1-data-schemas