Encoding
Every AssetId starts with a four-character type prefix. The characters after that prefix identify the specific market or asset. In the formulas below,hex(value, width) means converting value to lowercase hexadecimal and
adding leading zeroes until the result contains width characters.
The examples below use the unprefixed format accepted by order actions and returned by market
metadata. Protocol-transfer endpoints use the same bytes with a 0x prefix.
Hyperliquid Perpetuals
For a perpetual in Hyperliquid’s defaultmeta.universe, use the market’s array index.
0002 prefix identifies a Hyperliquid perpetual in the default perp universe. It does not apply
to HIP-3 markets. Index 0 produces 00020000, index 1 produces 00020001, and index 7
produces 00020007.
Hyperliquid HIP-3 Perpetuals
First calculate Hyperliquid’s HIP-3 venue index, then encode it as a six-byte integer.dexIndex = 188 and indexInDex = 0 produce venue index 1980000 and AssetId
00050000001e3660.
Hyperliquid Spot Tokens
Use the token’sindex in Hyperliquid’s spotMeta.tokens with Notional’s 10000 offset.
0001 prefix identifies a Hyperliquid spot token. For example, token index 0 produces
00012710.
Hyperliquid Spot Pairs
Use the pair’sindex in Hyperliquid’s spotMeta.universe.
0003 prefix identifies a Hyperliquid spot pair. For example, spot-pair index 1 produces
00030001.
Hyperliquid Outcomes
Each outcome side is derived from its outcome ID and side index. Side index0 is Yes and side
index 1 is No.
10218, side 0, produces hlEncoding = 100102180 and AssetId
0004000005f77024.
Polymarket Outcomes
Given a decimal Polymarket token ID, encode it as a 32-byte integer after the1001 type prefix:
Polygon and HyperEVM Assets
EVM AssetIds contain a four-character chain prefix, a two-character asset kind, and a 40-character locator.- Polygon uses chain type
8001; HyperEVM uses8002. - Native assets use kind
00and a locator of 20 zero bytes. - ERC-20 assets use kind
01and the contract address, without0x, as the locator.
