bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 27쪽 중 9쪽
unpatched browsers, or systems no longer supported by Hyperliquid.
* Vulnerabilities that rely on root access, jailbreaking, or other modifications to user devices.
* Issues within third-party libraries, extensions, tools, or applications that do not lead to a direct Hyperliquid vulnerability.
* Bugs or errors unrelated to security, such as minor performance issues.
* Bugs or errors contingent on extreme or unrealistic market conditions that do not reflect real-world scenarios.
### General conditions
* Payment will not be made for submissions that do not meet the program’s requirements or that are excluded under the program’s scope or ineligibility criteria. 
* We reserve the right to determine the validity and classification of any submission at our sole discretion.
* All submissions become the property of the Hyper Foundation. We reserve the right to use, modify, or disclose submissions for security purposes without requiring additional consent.
### Classification examples
* Critical (<1M USDC): Significant loss of user funds. Violation of L1 execution invariants.
* High (<50k USDC): Network downtime that does not lead to incorrect state.
* Medium (<10k USDC): API server performance issues. 
For the avoidance of doubt, rewards are determined based on the severity of the issue reported, and payouts may vary within the ranges listed above. Severity is determined based on both impact and likelihood of occurrence.
# Audits
The Hyperliquid legacy bridge contract has been audited by Zellic. 
Circle's contracts are audited independently: <https://github.com/circlefin/hyperevm-circle-contracts>
{% file src="/files/6HQImWlcAsjk8f6xJnEy" %}
Final report
{% endfile %}
{% file src="/files/Vnkes8g7IbP1zZQUKLHJ" %}
First report
{% endfile %}
 
# Brand kit
{% file src="/files/EzOFmeeKBXC7Xsjn6Zwq" %}
{% file src="/files/JoOZWbKnL5qEc3ZMHFQo" %}
{% file src="/files/WXEVWQzUEBzsLA9cPPF8" %}
{% file src="/files/u0i3k0bbzyOl4AvBWeF5" %}
{% file src="/files/ycNNyLuiLRKdxseGpQWb" %}
{% file src="/files/2TNqF9iYtJX18xLXdUcf" %}
# API
Documentation for the Hyperliquid public API
Python SDK: <https://github.com/hyperliquid-dex/hyperliquid-python-sdk>
Rust SDK written by community member, Infinite Field: <https://github.com/infinitefield/hypersdk>
Typescript SDKs written by members of the community:\
<https://github.com/nktkas/hyperliquid>\
<https://github.com/nomeida/hyperliquid>
CCXT also maintains integrations in multiple languages that conforms with the standard CCXT API: <https://docs.ccxt.com/#/exchanges/hyperliquid><br>
All example API calls use the mainnet url (<https://api.hyperliquid.xyz>), but you can make the same requests against testnet using the corresponding url (<https://api.hyperliquid-testnet.xyz>)
# Notation
The current v0 API currently uses some nonstandard notation. Relevant standardization will be batched into a breaking v1 API change.
<table><thead><tr><th width="231.33333333333331">Abbreviation</th><th>Full name</th><th>Explanation</th></tr></thead><tbody><tr><td>Px</td><td>Price</td><td></td></tr><tr><td>Sz</td><td>Size</td><td>In units of coin, i.e. base currency</td></tr><tr><td>Szi</td><td>Signed size </td><td>Positive for long, negative for short</td></tr><tr><td>Ntl</td><td>Notional</td><td>USD amount, Px * Sz </td></tr><tr><td>Side</td><td>Side of trade or book</td><td>B = Bid = Buy, A = Ask = Short. Side is aggressing side for trades.</td></tr><tr><td>Asset</td><td>Asset</td><td>An integer representing the asset being traded. See below for explanation</td></tr><tr><td>Tif</td><td>Time in force</td><td>GTC = good until canceled, ALO = add liquidity only (post only), IOC = immediate or cancel</td></tr></tbody></table>
# Asset IDs
Asset IDs are the integer representation for sending orders and cancels via actions. See [here](/hyperliquid-docs/for-developers/api/exchange-endpoint) for more details.
### Perps
Perpetual endpoints expect an integer for `asset`, which is the index of the coin found in the `meta` info response. E.g. `BTC = 0` on mainnet.
Builder-deployed perps expect `100000 + perp_dex_index * 10000 + index_in_meta` . For example, `test:ABC` on testnet has `perp_dex_index = 1` ,`index_in_meta = 0` , `asset = 110000` . Note that builder-deployed perps always have name in the format `{dex}:{coin}` .
### Spot
Spot endpoints expect `10000 + spotInfo["index"]` where `spotInfo` is the corresponding object in `spotMeta` that has the desired quote and base tokens. For example, when submitting an order for `PURR/USDC`, the asset that should be used is `10000` because its asset index in the spot info is `0`.
Note that spot ID is different from token ID, and that mainnet and testnet have different asset IDs. For example, for HYPE:
Mainnet token ID: 150
Mainnet spot ID: 107
Testnet token ID: 1105
Testnet spot ID: 1035
### Outcomes
Outcomes share most implementation details with spot trading, with a different token representing each outcome side. However, the API representation of outcomes is different from both spot and perps.
Outcome assets are derived from an `outcome` id plus a binary `side`. These are found in the `outcomeMeta` info response.
For an outcome with id `outcome` and side `side`:
```
encoding = 10 * outcome + side
```
Only side `0` and side `1` are valid.
Example:
* outcome `1`, side `0` -> encoding `10`
The same `encoding` is used in three different representations:
* Outcome spot coin: `#<encoding>`
* Outcome token name: `+<encoding>`
* Outcome asset ID: `100_000_000 + encoding`
Example:
* `#10` = outcome `1`, side `0`
* `+10` = the corresponding token name
* `100000010` = asset ID
# Tick and lot size
Both Price (px) and Size (sz) have a maximum number of decimals that are accepted. 
Prices can have up to 5 significant figures, but no more than `MAX_DECIMALS - szDecimals` decimal places where `MAX_DECIMALS` is 6 for perps and 8 for spot. Integer prices are always allowed, regardless of the number of significant figures. E.g. `123456` is a valid price even though `12345.6` is not.
Sizes are rounded to the `szDecimals` of that asset. For example, if `szDecimals = 3` then `1.001` is a valid size but `1.0001` is not. 
`szDecimals` for an asset is found in the meta response to the info endpoint
### Perp price examples
`1234.5` is valid but `1234.56` is not (too many significant figures)
`0.001234` is valid, but `0.0012345` is not (more than 6 decimal places)
If `szDecimals = 1` , `0.01234` is valid but `0.012345` is not (more than `6 - szDecimals` decimal places)
### Spot price examples
`0.0001234` is valid if `szDecimals` is 0 or 1, but not if `szDecimals` is greater than 2 (more than 8-2 decimal places). 
### Signing
Note that if implementing signing, trailing zeroes should be removed. See [Signing](/hyperliquid-docs/for-developers/api/signing) for more details.
# Nonces and API wallets
### Background 
A decentralized L1 must prevent replay attacks. When a user signs a USDC transfer transaction, the receiver cannot broadcast it multiple times to drain the sender's wallet. To solve this Ethereum stores a "nonce" for each address, which is a number that starts at 0. Each transaction must use exactly "nonce + 1" to be included.
### API wallets
These are also known as `agent wallets` in the docs. A master account can approve API wallets to sign on behalf of the master account or any of the sub-accounts. 
Note that API wallets are only used to sign. To query the account data associated with a master or sub-account, you must pass in the actual address of that account. A common pitfall is to use the agent wallet which leads to an empty result.
### API wallet pruning
API wallets and their associated nonce state may be pruned in the following cases:
1. The wallet is deregistered. This happens to an existing unnamed API Wallet when an ApproveAgent action is sent to register a new unnamed API Wallet. This also happens to an existing named API Wallet when an ApproveAgent action is sent with a matching name.
2. The wallet expires.
3. The account that registered the agent no longer has funds.
**Important:** for those using API wallets programmatically, it is **strongly** suggested to not reuse their addresses. Once an agent is deregistered, its used nonce state may be pruned. Generate a new agent wallet on future use to avoid unexpected behavior. For example, previously signed actions can be replayed once the nonce set is pruned.
### Hyperliquid nonces 
Ethereum's design does not work for an onchain order book. A market making strategy can send thousands of orders and cancels in a second. Requiring a precise ordering of inclusion on the blockchain will break any strategy.
On Hyperliquid, the 100 highest nonces are stored per address. Every new transaction must have nonce larger than the smallest nonce in this set and also never have been used before. Nonces are tracked per signer, which is the user address if signed with private key of the address, or the agent address if signed with an API wallet. 
Nonces must be within `(T - 2 days, T + 1 day)`, where `T` is the unix millisecond timestamp on the block of the transaction.
The following steps may help port over an automated strategy from a centralized exchange:
1. Use a API wallet per trading process. Note that nonces are stored per signer (i.e. private key), so separate subaccounts signed by the same API wallet will share the nonce tracker of the API wallet. It's recommended to use separate API wallets for different subaccounts.
2. In each trading process, have a task that periodically batches order and cancel requests every 0.1 seconds. It is recommended to batch IOC and GTC orders separately from ALO orders because ALO order-only batches are prioritized by the validators.
3. The trading logic tasks send orders and cancels to the batching task.
4. For each batch of orders or cancels, fetch and increment an atomic counter that ensures a unique nonce for the address. The atomic counter can be fast-forwarded to current unix milliseconds if needed.
This structure is robust to out-of-order transactions within 2 seconds, which should be sufficient for an automated strategy geographically near an API server.
### Suggestions for subaccount and vault users
Note that nonces are stored per signer, which is the address of the private key used to sign the transaction. Therefore, it's recommended that each trading process or frontend session use a separate private key for signing. In particular, a single API wallet signing for a user, vault, or subaccount all share the same nonce set.
If users want to use multiple subaccounts in parallel, it would easier to generate two separate API wallets under the master account, and use one API wallet for each subaccount. This avoids collisions between the nonce set used by each subaccount.
# Info endpoint
The info endpoint is used to fetch information about the exchange and specific users. The different request bodies result in different corresponding response body schemas.
### Pagination
Responses that take a time range will only return 500 elements or distinct blocks of data. To query larger ranges, use the last returned timestamp as the next `startTime` for pagination.
### Perpetuals vs Spot
The endpoints in this section as well as websocket subscriptions work for both Perpetuals and Spot. For perpetuals `coin` is the name returned in the `meta` response. For Spot, coin should be `PURR/USDC` for PURR, and `@{index}` e.g. `@1` for all other spot tokens where index is the index of the spot pair in the `universe` field of the `spotMeta` response. For example, the spot index for HYPE on mainnet is `@107` because the token index of HYPE is 150 and the spot pair `@107` has tokens `[150, 0]`. Note that some assets may be remapped on user interfaces. For example, `BTC/USDC` on app.hyperliquid.xyz corresponds to `UBTC/USDC` on mainnet HyperCore. The L1 name on the [token details page](https://app.hyperliquid.xyz/explorer/token/0x8f254b963e8468305d409b33aa137c67) can be used to detect remappings.
### User address
To query the account data associated with a master or sub-account, you must pass in the actual address of that account. A common pitfall is to use an agent wallet's address which leads to an empty result.
## Retrieve mids for all coins
<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/info`
Note that if the book is empty, the last trade price will be used as a fallback
#### Headers
| Name | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |
#### Request Body
| Name | Type | Description |
| -------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------- |
| type<mark style="color:red;">\*</mark> | String | "allMids" |
| dex | String | Perp dex name. Defaults to the empty string which represents the first perp dex. Spot mids are only included with the first perp dex.. |
{% tabs %}
{% tab title="200: OK Successful Response" %}
```json
{
"APE": "4.33245",
"ARB": "1.21695"
}
```
{% endtab %}
{% endtabs %}
## Retrieve a user's open orders
<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/info`
See a user's open orders
#### Headers
| Name | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |
#### Request Body
| Name | Type | Description |
| -------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
| type<mark style="color:red;">\*</mark> | String | "openOrders" |
| user<mark style="color:red;">\*</mark> | String | Address in 42-character hexadecimal format; e.g. 0x0000000000000000000000000000000000000000. |
| dex | String | Perp dex name. Defaults to the empty string which represents the first perp dex. Spot open orders are only included with the first perp dex. |
{% tabs %}
{% tab title="200: OK Successful R" %}
```json
[
{
"coin": "BTC",
"limitPx": "29792.0",
"oid": 91490942,
"side": "A",
"sz": "0.0",
"timestamp": 1681247412573
}
]
```
{% endtab %}
{% endtabs %}
## Retrieve a user's open orders with additional frontend info
<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/info`
#### Headers
| Name | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |
#### Request Body
| Name | Type | Description |
| -------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
| type<mark style="color:red;">\*</mark> | String | "frontendOpenOrders" |
| user<mark style="color:red;">\*</mark> | String | Address in 42-character hexadecimal format; e.g. 0x0000000000000000000000000000000000000000. |
| dex | String | Perp dex name. Defaults to the empty string which represents the first perp dex. Spot open orders are only included with the first perp dex. |
{% tabs %}
{% tab title="200: OK " %}
```json
[
{
"coin": "BTC",
"isPositionTpsl": false,
"isTrigger": false,
"limitPx": "29792.0",
"oid": 91490942,
"orderType": "Limit",
"origSz": "5.0",
"reduceOnly": false,
"side": "A",
"sz": "5.0",
"timestamp": 1681247412573,
"triggerCondition": "N/A",
"triggerPx": "0.0",
}
]
```
{% endtab %}
{% endtabs %}
## Retrieve a user's fills
<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/info`
Returns at most 2000 most recent fills
#### Headers
| Name | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |
#### Request Body
| Name | Type | Description |
| -------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| type<mark style="color:red;">\*</mark> | String | "userFills" |
| user<mark style="color:red;">\*</mark> | String | Address in 42-character hexadecimal format; e.g. 0x0000000000000000000000000000000000000000. |
| aggregateByTime | bool | When true, partial fills are combined when a crossing order gets filled by multiple different resting orders. Resting orders filled by multiple crossing orders are only aggregated if in the same block. |
{% tabs %}
{% tab title="200: OK" %}
```json
[
// Perp fill (first perp dex)
{
"closedPnl": "0.0",
"coin": "AVAX",
"crossed": false,
"dir": "Open Long",
"hash": "0xa166e3fa63c25663024b03f2e0da011a00307e4017465df020210d3d432e7cb8",
"oid": 90542681,
"px": "18.435",
"side": "B",
"startPosition": "26.86",
"sz": "93.53",
"time": 1681222254710,
"fee": "0.01", // the total fee, inclusive of builderFee below
"feeToken": "USDC",
"builderFee": "0.01", // this is optional and will not be present if 0
"tid": 118906512037719
},
// Perp Fill (HIP-3)
{
"coin": "xyz:XYZ100", // For HIP-3, the asset has the dex name as a prefix
"px": "25372.0",
"sz": "0.0353",
"side": "B",
"time": 1767651180109,
"startPosition": "0.7045",
"dir": "Open Long",
"closedPnl": "0.0",
"hash": "0xa166e3fa63c25663024b03f2e0da011a00307e4017465df020210d3d432e7cb9",
"oid": 287286372177,
"crossed": false,
"fee": "0.026868",
"tid": 164087028129848,
"feeToken":" USDC"
},
// Spot fill - note the difference in the "coin" format. Refer to
// https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/asset-ids
// for more information on how spot asset IDs work
{
"coin": "@107",
"px": "18.62041381",
"sz": "43.84",
"side": "A",
"time": 1735969713869,
"startPosition": "10659.65434798",
"dir": "Sell",
"closedPnl": "8722.988077",
"hash": "0x2222138cc516e3fe746c0411dd733f02e60086f43205af2ae37c93f6a792430b",
"oid": 59071663721,
"crossed": true,
"fee": "0.304521",
"tid": 907359904431134,
"feeToken": "USDC"
}
]
```
{% endtab %}
{% endtabs %}
## Retrieve a user's fills by time
<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/info`
Returns at most 2000 fills per response and only the 10000 most recent fills are available
#### Headers
| Name | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |
#### Request Body
| Name | Type | Description |
| ------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| type<mark style="color:red;">\*</mark> | String | userFillsByTime |
| user<mark style="color:red;">\*</mark> | String | Address in 42-character hexadecimal format; e.g. 0x0000000000000000000000000000000000000000. |
| startTime<mark style="color:red;">\*</mark> | int | Start time in milliseconds, inclusive |
| endTime | int | End time in milliseconds, inclusive. Defaults to current time. |
| aggregateByTime | bool | When true, partial fills are combined when a crossing order gets filled by multiple different resting orders. Resting orders filled by multiple crossing orders are only aggregated if in the same block. |
{% tabs %}
{% tab title="200: OK Number of fills is limited to 2000" %}
```json
[
// Perp f프로젝트로 돌아가기