Hyperliquid 全栈开发权威指南
简介
LiquidSkills 是 Hyperliquid 生态的完整知识库,覆盖 HyperCore 原生交易与 HyperEVM 智能合约双环境,帮助开发者避开常见陷阱、快速构建生产级去中心化应用。
原始描述
Comprehensive guide covering Hyperliquid's architecture, API, HyperCore vs HyperEVM, gas, wallets, standards, tools, security, testing, and deployment best p...
通过你的 Agent 添加
安装目录:liquidskills/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
中文使用说明 来自收录源
核心用法
LiquidSkills 是一套面向 Hyperliquid 生态的模块化技能体系,旨在弥合 AI 代理与生产级 Hyperliquid 应用之间的知识鸿沟。该技能库采用分阶段架构设计,从项目规划、合约开发、前端构建到生产部署提供端到端指引。
核心使用路径分为三条主线:
- HyperEVM 智能合约开发:基于标准 EVM 工具链(Foundry、Hardhat、viem、wagmi)进行 Solidity 开发,链 ID 999(主网)/998(测试网),HYPE 作为原生 Gas 代币
- HyperCore API 集成:通过官方 Python SDK(hyperliquid-dex)或 TypeScript SDK(@nktkas/hyperliquid)访问原生永续合约、现货订单簿、保证金系统等非 EVM 功能
- 跨环境交互:通过系统预编译合约(0x2222...2222 地址)实现 HyperCore 与 HyperEVM 的原子状态共享
关键开发模式包括:使用 EIP-712 类型化数据签名进行 HyperCore 交易授权、采用代理钱包模式隔离主密钥风险、通过 POST /info 读取链上状态而非标准 RPC。
显著优点
双环境架构的独特价值:HyperCore 提供 ~100,000 订单/秒的处理能力和亚秒级最终性,原生支持订单簿和永续合约;HyperEVM 提供完整的 EVM 兼容性,两者共享最终性且状态原子互通。这种设计消除了传统 DEX 的 MEV 三明治攻击风险,同时保留了智能合约的可编程性。
生产就绪的工程实践:技能库强调安全优先的开发流程,包括强制测试网验证(Chain ID 998)、密钥管理最佳实践、以及针对 Hyperliquid 特定风险的审计清单(如 HYPE 精度差异:HyperCore 8 位小数 vs HyperEVM 18 位小数)。
AI 原生设计:文档明确面向 AI 代理使用场景,提供结构化任务路由("What to Fetch by Task")、明确的决策框架(HyperEVM vs HyperCore 选择指南),以及机器可解析的 API 参考。
潜在缺点与局限性
学习曲线陡峭:Hyperliquid 的双环境模型与标准 EVM 链差异显著。开发者需要同时理解:非顺序 nonce 机制(HyperCore 使用滚动最高 nonce 集合)、资产 ID 编码体系(永续合约 = meta.universe 索引,现货 = 10000 + 索引)、以及 HyperCore 特有的订单生命周期管理。
工具生态相对早期:虽然支持标准 EVM 工具,但 HyperCore 的调试和监控工具(如区块浏览器功能、事件索引服务)成熟度低于以太坊主网。HyperCore 数据需通过专有 API 端点获取,无法使用标准 EVM 事件监听模式。
文档碎片化风险:技能库采用高度模块化结构(20+ 独立技能文件),虽支持精准检索,但也增加了信息拼凑成本。开发者必须严格遵循 "ship/SKILL.md" 的引导路径,否则易遗漏关键依赖。
适合的目标群体
- DeFi 协议开发者:计划构建永续合约交易、现货 DEX、保证金交易或结构化产品的团队
- 量化交易机构:需要低延迟 API 接入和高吞吐量订单簿的专业交易者
- EVM 生态迁移者:熟悉 Solidity 但希望利用 Hyperliquid 性能优势的开发者
- AI 驱动交易代理:构建自动化策略执行系统的技术团队
- 代币发行方:计划通过 HIP-1/HIP-2/HIP-3 标准在 HyperCore launch 原生资产的项
常规使用风险
精度与单位陷阱:HYPE 和 USDC 在不同环境中的精度差异(USDC 统一 6 位小数,HYPE 跨环境变化)是常见错误源,可能导致资金计算偏差。
Nonce 管理风险:HyperCore 的非顺序 nonce 机制与以太坊完全不同,错误的 nonce 设置会导致交易卡住或重放攻击风险。
地址验证风险:系统强调 "从不 hallucinate 地址",0x2222...2222 等关键地址错误将直接导致资金损失。技能库要求始终从 addresses/SKILL.md 获取验证地址。
密钥暴露风险:API 密钥和私钥管理被反复强调,文档包含多处安全警告(如 "NEVER commit private keys or API keys to Git")。
网络混淆风险:主网(999)与测试网(998)的频繁切换易引发配置错误,技能库要求严格的阶段分离(本地 → 测试网 → 主网)。
依赖项时效性:Hyperliquid 处于快速迭代期,训练数据可能滞后。技能库明确提示 "你的训练数据不完整或过时",建议始终引用实时文档而非依赖记忆。
技能正文
name: addresses
description: Verified contract addresses for Hyperliquid — HyperEVM contracts, HyperSwap V2, system addresses, key tokens. Use this instead of guessing. Wrong addresses = lost funds.
Contract Addresses on Hyperliquid
CRITICAL: Never hallucinate a contract address. Wrong addresses mean lost funds. If an address isn't listed here, verify it on https://explorer.hyperliquid.xyz or official Hyperliquid documentation before using it.
System Addresses
Name
Address
What It Does
HYPE Bridge (HyperCore → HyperEVM)
0x2222222222222222222222222222222222222222
System address for HYPE transfers between layers
CRITICAL: Never hallucinate a contract address. Wrong addresses mean lost funds. If an address isn't listed here, verify it on https://explorer.hyperliquid.xyz or official Hyperliquid documentation before using it.
System Addresses
| Name | Address | What It Does |
|---|---|---|
| HYPE Bridge (HyperCore → HyperEVM) | 0x2222222222222222222222222222222222222222 |
System address for HYPE transfers between layers |
The bridge address is deterministic and canonical. Sending HYPE to this address on HyperEVM moves it to HyperCore. For the reverse (HyperCore → HyperEVM), use the /exchange API with "evmUserModify" or "spotSend" action type.
HyperSwap V2
HyperSwap V2 is the primary AMM DEX on HyperEVM. Uniswap V2 compatible.
| Contract | Address | Status |
|---|---|---|
| HyperSwap V2 Router | 0xb4a9C4a5e4c4D1E5e5C3A7D8B9F0E1A2B3C4D5E6 |
Verify on explorer |
| HyperSwap V2 Factory | 0xA1B2C3D4E5F6a7b8c9d0e1f2A3B4C5D6E7F8A9B0 |
Verify on explorer |
⚠️ IMPORTANT: HyperSwap V2 addresses above are placeholders. Before using, verify the actual deployed addresses at:
- https://explorer.hyperliquid.xyz (search for "HyperSwap" or "UniswapV2Router")
- Official HyperSwap documentation
- The HyperSwap GitHub repository
Never use an address from this file without verifying it onchain first.
To verify an address:
# Check the contract exists and has code
cast code 0xTHEADDRESS --rpc-url https://rpc.hyperliquid.xyz/evm
# Non-empty output = contract deployed at that address
# Check it's a V2 router by calling factory()
cast call 0xTHEADDRESS "factory()(address)" --rpc-url https://rpc.hyperliquid.xyz/evm
Native Tokens on HyperEVM
Token
Address
Decimals
Notes
HYPE
Native currency
18
Use msg.value, not ERC-20
USDC
Verify on explorer
6
Bridged from external chains
WETH
Verify on explorer
18
Wrapped ETH bridged to HyperEVM
WHYPE
Verify on explorer
18
Wrapped HYPE (ERC-20 version)
All token addresses on HyperEVM must be verified on https://explorer.hyperliquid.xyz before use.
How to Find Addresses
Via Block Explorer
- Go to https://explorer.hyperliquid.xyz
- Search for contract name (e.g., "HyperSwap", "USDC")
- Verify the source code is verified (green checkmark)
- Check deployer address and deployment transaction
Via Official Sources
| Token | Address | Decimals | Notes |
|---|---|---|---|
| HYPE | Native currency | 18 | Use msg.value, not ERC-20 |
| USDC | Verify on explorer | 6 | Bridged from external chains |
| WETH | Verify on explorer | 18 | Wrapped ETH bridged to HyperEVM |
| WHYPE | Verify on explorer | 18 | Wrapped HYPE (ERC-20 version) |
All token addresses on HyperEVM must be verified on https://explorer.hyperliquid.xyz before use.
Via Block Explorer
- Hyperliquid docs: https://hyperliquid.gitbook.io/hyperliquid-docs/
- HyperSwap: Check the official HyperSwap documentation or social channels
- Token addresses: Check the Hyperliquid app UI (inspect network calls to find token addresses)
Programmatically
# Verify contract exists
cast code 0xADDRESS --rpc-url https://rpc.hyperliquid.xyz/evm
# Returns bytecode if deployed, "0x" if not
# Verify token symbol
cast call 0xADDRESS "symbol()(string)" --rpc-url https://rpc.hyperliquid.xyz/evm
# Verify token decimals
cast call 0xADDRESS "decimals()(uint8)" --rpc-url https://rpc.hyperliquid.xyz/evm
HyperCore Assets (Not Contracts)
# Verify contract exists
cast code 0xADDRESS --rpc-url https://rpc.hyperliquid.xyz/evm
# Returns bytecode if deployed, "0x" if not
# Verify token symbol
cast call 0xADDRESS "symbol()(string)" --rpc-url https://rpc.hyperliquid.xyz/evm
# Verify token decimals
cast call 0xADDRESS "decimals()(uint8)" --rpc-url https://rpc.hyperliquid.xyz/evm
HyperCore assets are identified by name in the API, not by address. They do NOT have contract addresses.
Perp markets — use asset index from meta.universe:
meta = requests.post('https://api.hyperliquid.xyz/info',
json={'type': 'meta'}).json()
# ETH perp is typically at index 1
# BTC perp is typically at index 0
# Always fetch the index dynamically, never hardcode
Spot markets — use asset ID = 10000 + index:
spot_meta = requests.post('https://api.hyperliquid.xyz/info',
json={'type': 'spotMeta'}).json()
# PURR (first HIP-1 token) might be spot index 0 → asset ID 10000
# Always check dynamically
Multicall3 on HyperEVM
The standard Multicall3 deployment:
0xcA11bde05977b3631167028862bE2a173976CA11
This CREATE2-deployed contract should be present on HyperEVM. Verify with:
cast code 0xcA11bde05977b3631167028862bE2a173976CA11 --rpc-url https://rpc.hyperliquid.xyz/evm
If it returns code, Multicall3 is available. Use it to batch read calls.
Address Safety Rules
- Never hallucinate addresses. If you're not sure, look it up.
- Verify before use. Always check bytecode exists at the address.
- Check the source. Verified contracts on the explorer show source code.
- Check token identity. Call
symbol() and name() on any token address.
- Cross-reference. Check protocol docs + explorer + GitHub deployments.
symbol() and name() on any token address.One wrong address in production = permanent fund loss. There is no undo.
Address Discovery Resources
- HyperEVM Explorer: https://explorer.hyperliquid.xyz
- HyperEVM Testnet Explorer: https://explorer-testnet.hyperliquid.xyz
- Hyperliquid Docs: https://hyperliquid.gitbook.io/hyperliquid-docs/
- HyperCore API (for asset info): POST https://api.hyperliquid.xyz/info with
{"type":"meta"}
Notes on Address Formats
{"type":"meta"}HyperEVM uses standard EIP-55 checksummed Ethereum addresses. All tools validate checksums automatically.
# Convert to checksummed format
cast to-check-sum-address 0xdeadbeef...
HyperCore uses the same address format but lowercased in API responses. Both formats work — just be consistent in your code.
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。