concepts/SKILL.md
Essential mental models for building on Hyperliquid. HyperCore vs HyperEVM, asset IDs, nonce mechanics, margin types, incentive design. Use when designing a system or when you need to understand how Hyperliquid actually works.
npx skillsauth add cloudzombie/liquidskills conceptsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
"Nothing is automatic on EVM." This is still true on HyperEVM. Smart contracts don't run themselves. Every HyperEVM function needs a caller. But HyperCore is different — it HAS automatic processes: funding rate settlements, liquidations, order matching. The protocol runs these autonomously.
"Nonces increment by 1." On HyperCore, NO. HyperCore nonces are a rolling-set scheme — not sequential. Read the nonce section carefully before building any trading system.
"HYPE is like ETH." On HyperEVM, mostly yes. But HYPE is also the staking/governance token for the whole L1, not just gas. The total HYPE supply matters for protocol economics in ways ETH's doesn't.
Think of Hyperliquid as two machines sharing the same clock:
HyperCore = The Exchange Machine
HyperEVM = The Smart Contract Machine
The shared clock = HyperBFT
Same rule as Ethereum. Smart contracts are state machines. Between caller interactions, they do nothing.
For every HyperEVM function:
Who calls it? → Someone must pay HYPE gas
Why would they? → What's their incentive?
Is the incentive sufficient? → Does it cover gas + profit?
HyperCore is different. These ACTUALLY happen automatically:
Design implication: If you need automatic behavior on HyperEVM, you still need an incentivized caller. If you want automatic trading behavior, it belongs in HyperCore (via a bot using the API), not in a contract.
Understanding asset IDs is the #1 source of confusion for HyperCore API users.
Perp assets:
meta.universe arraySpot assets:
{"type": "spotMeta"}HIP-3 builder DEX assets:
# CORRECT: Always fetch asset IDs dynamically
def get_asset_id(info, symbol, is_perp=True):
if is_perp:
meta = info.meta()
for i, asset in enumerate(meta['universe']):
if asset['name'] == symbol:
return i
raise ValueError(f"Perp asset {symbol} not found")
else:
spot_meta = info.spot_meta()
for i, token in enumerate(spot_meta['tokens']):
if token['name'] == symbol:
return 10000 + i
raise ValueError(f"Spot asset {symbol} not found")
This is critically different from Ethereum. Read carefully.
Why this design?
# ✅ CORRECT: Use millisecond timestamps
import time
nonce = int(time.time() * 1000) # Always increasing, works for concurrent requests
# ✅ CORRECT: Use the official SDK (handles nonces internally)
from hyperliquid.exchange import Exchange
exchange = Exchange(wallet, api_url) # SDK manages nonces
# ❌ WRONG: Don't try to track sequential nonces manually
nonce = last_nonce + 1 # Fails with concurrent requests
# ❌ WRONG: Don't reuse old nonces
nonce = 1234 # Will fail if this is in the current window
Nonce conflict = order rejection. Use millisecond timestamps or let the SDK handle it.
If you need to submit 5 orders in rapid succession:
import time
# Stagger by 1ms each to guarantee unique nonces
orders = []
for i in range(5):
nonce = int(time.time() * 1000) + i
orders.append(build_order(nonce=nonce, ...))
# Submit in parallel or sequence
HyperCore has two margin modes for perp positions:
# Switch a position to isolated margin
result = exchange.update_isolated_margin(
coin="ETH",
is_buy=True,
ntli=100.0 # Isolated margin amount in USDC
)
Understanding liquidations is critical for designing systems around HyperCore:
How liquidations work:
Health factor calculation:
Account Value = USDC Balance + Unrealized PnL
Maintenance Margin = Sum of (position_size × price × maintenance_rate)
Health = Account Value / Maintenance Margin
Liquidation trigger: Health < 1 (or specified threshold per market).
For vault builders: Your vault can become a liquidation bot — earn fees by monitoring positions and liquidating unhealthy ones.
Perpetual futures use funding rates to keep perp prices in line with spot:
# Get current funding rates
ctx = requests.post('https://api.hyperliquid.xyz/info',
json={'type': 'metaAndAssetCtxs'}).json()
for i, (asset, ctx) in enumerate(zip(ctx[0]['universe'], ctx[1])):
if ctx.get('funding'):
print(f"{asset['name']}: funding={ctx['funding']} premium={ctx.get('premium', 'N/A')}")
HyperCore uses several price concepts:
For calculations involving margin and health: Use mark price. For placing limit orders: Use mid price as reference. For spot price: Use the CLOB mid price.
| Asset | HyperCore API | HyperEVM | |-------|--------------|---------| | HYPE | Float string (e.g., "1.5") | 18 decimals (1.5 HYPE = 1.5e18 wei) | | USDC | Float string (e.g., "100.0") | 6 decimals (100 USDC = 100e6) | | Perp size | Float string | N/A | | Perp notional | USDC float | N/A | | HIP-1 tokens | Per token config | N/A unless bridged |
USDC has 6 decimals on HyperEVM. This is the #1 decimal bug. Don't assume 18.
Every HyperCore exchange action requires an EIP-712 signature:
1. Build action payload (specific to the action type)
2. Construct EIP-712 message:
- Domain: { name: "Exchange", version: "1", chainId: 1337 }
- Struct: the action data
3. Hash: keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash))
4. Sign: ECDSA sign with private key
5. Extract: r, s, v components
6. Submit: POST /exchange with { action, nonce, signature: {r, s, v} }
chainId in EIP-712 is always 1337 for HyperCore — not 999 (HyperEVM mainnet) or 998 (testnet). This is a deliberate design choice that makes HyperCore signing portable.
Use the SDK — it handles all this correctly.
development
Why build on Hyperliquid. HyperBFT consensus, native orderbook, speed, AI agent angle, honest tradeoffs. Use when someone asks "should I build on Hyperliquid?", "why not Ethereum?", or when an agent needs to understand what makes Hyperliquid unique.
development
Wallets on Hyperliquid — MetaMask + chain ID 999 setup, HyperCore API wallets, agent wallet patterns, EIP-712 signing for exchange actions. Essential for any agent that needs to interact with Hyperliquid.
tools
Development tools for Hyperliquid — Foundry, Hardhat, viem, wagmi for HyperEVM; Python SDK and TypeScript SDK for HyperCore API. What works, what to use, how to set up.
testing
Smart contract testing for HyperEVM with Foundry/Hardhat — unit tests, fuzz testing, testnet fork testing. What to test, what not to test, and what LLMs get wrong on Hyperliquid.