Hyperliquid Wiki Protocol & Ecosystem Knowledge Base
🔍
💻 Developers & SDKs

Smart Contracts & Precompiles on HyperEVM

Building composable decentralized finance protocols with Solidity smart contracts interacting atomically with Hyperliquid L1 order books.

1. HyperEVM Network Parameters

HyperEVM operates as a native execution layer on Hyperliquid L1. Standard EVM JSON-RPC clients (Metamask, Foundry, Hardhat) connect using standard network parameters:

Parameter HyperEVM Mainnet HyperEVM Testnet
Network Name HyperEVM Mainnet HyperEVM Testnet
RPC URL https://rpc.hyperliquid.xyz/evm https://rpc.hyperliquid-testnet.xyz/evm
Chain ID 998 999
Currency Symbol HYPE HYPE
Block Explorer https://hyperscan.xyz https://testnet.hyperscan.xyz

2. Foundry & Hardhat Configuration

Configure foundry.toml to deploy smart contracts directly to HyperEVM:

[profile.default]
src = "src"
out = "out"
libs = ["lib"]
solc_version = "0.8.24"
evm_version = "cancun"

[rpc_endpoints]
hyperevm = "https://rpc.hyperliquid.xyz/evm"
hyperevm_testnet = "https://rpc.hyperliquid-testnet.xyz/evm"

3. Core Order Book Precompile Interfaces

Solidity contracts can interact with HyperCore order books through system precompiles (GitHub reference contracts) located at reserved system addresses:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

interface IHyperCorePrecompile {
    /// @notice Queries the current mark price for an asset index
    /// @param asset Index of the trading asset (0 = BTC, 1 = ETH, ...)
    /// @return markPrice Fixed-point 8-decimal mark price
    function getMarkPrice(uint32 asset) external view returns (uint64 markPrice);

    /// @notice Places a native limit order through the calling contract
    function placeOrder(
        uint32 asset,
        bool isBuy,
        uint64 limitPrice,
        uint64 size,
        bool reduceOnly
    ) external returns (uint64 orderId);
}
Synchronous Composability: A single EVM transaction can borrow capital from an on-chain lending pool, buy spot assets via HyperCore precompiles, and deposit into a yield vault atomically in the same block.

🔗 Official External References & Primary Sources

To verify the technical architecture, mathematical parameters, and protocol specifications described in this chapter, consult the official documentation: