OnFinality
New RPC users get 35% off their first monthView the offer
OnFinality Learn
Integration & Development9 min read

HyperCore Hyperliquid: Architecture, Data Access, and Integration

Understand how HyperCore and HyperEVM fit together, query HyperCore state, submit actions, and verify an integration safely.

TL;DR

HyperCore is the native trading and account-state component of Hyperliquid, while HyperEVM provides an Ethereum-compatible environment that can read selected HyperCore state and submit encoded actions back to it. The correct integration path depends on whether you need exchange API data, EVM-compatible contract calls, or application transactions that affect HyperCore. This guide explains the boundary between those systems, provides reproducible request examples, and shows how to verify results without assuming that an EVM block is the same thing as a HyperCore action confirmation. Use testnet first, keep network configuration explicit, and measure latency and consistency with your own workload.

Direct integration scope

The short answer is that HyperCore and HyperEVM are related but not interchangeable. HyperCore contains native exchange state such as margin, matching, perpetual positions, spot balances, staking, vaults, and related account data. HyperEVM is the general-purpose EVM environment used for smart contracts and can expose selected HyperCore information through read precompiles.

Choose the interface from the operation you are implementing. A trading service that needs order-book updates or native exchange actions should use the Hyperliquid exchange and information interfaces documented by the network. An EVM application that needs to inspect HyperCore state can use the read precompiles. A contract that needs to request a HyperCore action can use the CoreWriter system contract.

This article focuses on the architecture and integration workflow rather than recommending a particular endpoint. For endpoint selection, see the HyperEVM RPC provider guide, compare available RPC services, and review RPC pricing before choosing production capacity.

Hyperliquid state boundaries

A useful mental model is to treat Hyperliquid as one protocol with two execution surfaces. HyperCore is purpose-built for the native exchange and account system. HyperEVM executes Solidity contracts and EVM transactions. Linking between them does not make every HyperCore object an ordinary EVM storage slot, nor does an EVM transaction automatically provide the same confirmation semantics as a native HyperCore action.

The HyperEVM documentation describes read precompiles at addresses beginning with the system range 0x0000000000000000000000000000000000000800. These contracts provide methods for selected values, including perpetual positions, spot balances, vault equity, staking delegations, oracle prices, and the HyperCore L1 block number. The values are intended to match the latest HyperCore state available when the EVM block is constructed.

For writes, the CoreWriter system contract is documented at 0x3333333333333333333333333333333333333333. A contract call sends an encoded action for HyperCore to process. This is an asynchronous boundary: a successful EVM transaction means the action was emitted or queued according to the protocol flow, not necessarily that the final native exchange state has already changed.

  • Use native Hyperliquid interfaces for native order and account workflows.
  • Use read precompiles for supported HyperCore reads from EVM applications.
  • Use CoreWriter only for actions supported by its documented encoding.
  • Treat EVM inclusion, action processing, and state observation as separate checkpoints.

Prerequisites and network assumptions

Before writing code, identify the network, interface, asset identifiers, decimals, and confirmation condition your application requires. Do not copy a mainnet contract address, chain identifier, or asset index into testnet configuration without checking the current official documentation. Keep RPC URLs, private keys, chain IDs, and explorer links in environment-specific configuration.

For a read-only prototype, you need an EVM-compatible RPC URL and a client capable of making JSON-RPC requests. For a write workflow, you additionally need a funded test account, the correct contract interface, ABI-encoded action data, gas policy, and a reconciliation process that observes the resulting HyperCore state.

Store credentials outside source control. Use a dedicated signer with the minimum permissions needed for testing, and never place a production private key in browser code, shell history, CI logs, or a committed environment file. Teams operating their own infrastructure can compare managed access with a dedicated node or review the available network coverage.

  • RPC_URL: the EVM RPC endpoint for the selected network.
  • PRIVATE_KEY: a test-only signer key when submitting transactions.
  • ASSET_INDEX and ACCOUNT: values validated against the current protocol documentation.
  • CONFIRMATION_POLICY: the application-specific rule for EVM and HyperCore completion.

Read precompile request flow

A precompile call is an EVM read, but its input and output are protocol-specific. The exact address and calldata depend on the method defined by the current L1Read interface. The following example demonstrates the JSON-RPC shape without pretending that one selector or asset index covers every method. Replace the calldata with the method encoding from the official interface, and validate the result against a known account or oracle value.

The documented precompile behavior also matters for error handling. Invalid inputs such as an invalid asset or vault address can return an error and consume the gas passed into the precompile call frame. Validate identifiers before issuing repeated calls, especially in a service that scans many markets.

  • Check for a JSON-RPC error before decoding result.
  • Decode integers using the method's documented width and scale.
  • Record the EVM block number returned by eth_blockNumber alongside the response.
  • Do not convert a raw integer to a decimal price until the asset's decimals are known.
curl -sS "$RPC_URL" \
  -H 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","id":1,"method":"eth_call","params":[{"to":"0x0000000000000000000000000000000000000807","data":"0xYOUR_DOCUMENTED_CALLDATA"},"latest"]}'

JavaScript read verification

The next example uses the native fetch API available in current Node.js releases. It performs a generic EVM read and preserves the raw response for inspection. The placeholder calldata is intentional: precompile selectors and ABI layouts must come from the current L1Read interface rather than from an assumed universal encoding.

A robust integration should capture the request ID, RPC response, EVM block tag, decoded value, and any associated HyperCore block reference. When a value changes, compare those fields before concluding that the provider returned stale or inconsistent data.

  • Pin a block tag when comparing multiple reads where supported.
  • Use a typed ABI decoder for production code.
  • Retain raw hexadecimal values so a decoding bug can be reproduced.
const rpcUrl = process.env.RPC_URL;
if (!rpcUrl) throw new Error('Set RPC_URL');

async function rpc(method, params) {
  const response = await fetch(rpcUrl, {
    method: 'POST',
    headers: { 'content-type': 'application/json' },
    body: JSON.stringify({ jsonrpc: '2.0', id: 1, method, params })
  });
  if (!response.ok) throw new Error(`HTTP ${response.status}`);
  const body = await response.json();
  if (body.error) throw new Error(JSON.stringify(body.error));
  return body.result;
}

const evmBlock = await rpc('eth_blockNumber', []);
const rawValue = await rpc('eth_call', [
  { to: '0x0000000000000000000000000000000000000807', data: '0xYOUR_DOCUMENTED_CALLDATA' },
  'latest'
]);
console.log({ evmBlock, rawValue });

CoreWriter action lifecycle

CoreWriter is the write bridge from HyperEVM to HyperCore. The documented action payload begins with an encoding version, followed by a three-byte big-endian action ID, followed by action-specific data encoded as the raw ABI encoding of the documented Solidity types. This format is not a general-purpose message envelope: an incorrect version, action ID, field order, width, or encoding can produce a rejected or unintended action.

A contract call to CoreWriter consumes EVM gas and emits a log that HyperCore processes as an action. The documentation notes that order actions and vault transfers sent through CoreWriter are delayed onchain for a few seconds to prevent a latency advantage from bypassing the L1 mempool. Therefore, an application should not treat the EVM receipt alone as proof that an order or transfer is active.

The safe workflow is: submit on testnet, wait for the EVM receipt, extract and persist the relevant transaction and log data, poll the native HyperCore state or supported account read, and only then mark the business operation complete. For orders, reconcile by the protocol's order identifier and status rather than by transaction hash alone.

  • Use the official CoreWriter ABI and action specification for the selected network.
  • Treat the action as pending until native state confirms processing.
  • Make retries idempotent where the action type and application model allow it.
  • Alert on an EVM success followed by a native rejection or timeout.
const { ethers } = require('ethers');

const provider = new ethers.JsonRpcProvider(process.env.RPC_URL);
const signer = new ethers.Wallet(process.env.PRIVATE_KEY, provider);
const coreWriter = new ethers.Contract(
  '0x3333333333333333333333333333333333333333',
  ['function sendRawAction(bytes action)'],
  signer
);

// Build this from the current CoreWriter ABI and action specification.
const action = '0xYOUR_VERSION_ACTION_ID_AND_ABI_ENCODED_DATA';
const tx = await coreWriter.sendRawAction(action);
const receipt = await tx.wait();
console.log({ txHash: receipt.hash, blockNumber: receipt.blockNumber });

Verification and measurement procedure

Use a table like the following for your own results. Replace every placeholder with measured data; the template intentionally contains no benchmark values.

TestRPC method or actionSamplesSuccess ratep50p95MaxError categoriesObservation
Stable precompile readeth_callNmeasuredmeasuredmeasuredmeasuredmeasureddecoded value matched: yes/no
EVM submissionCoreWriter transactionNmeasuredmeasuredmeasuredmeasuredmeasuredreceipt observed: yes/no
Native processingHyperCore state pollNmeasuredmeasuredmeasuredmeasuredmeasuredfinal state observed: yes/no

For consistency testing, issue repeated reads at a fixed block tag where possible, compare responses from separate connections, and record the first block or state reference at which they agree. For freshness testing, compare the returned reference block with the latest reference available from the protocol interface. A lower response time is not automatically better if it corresponds to an older state.

Failure modes and diagnostics

An RPC error, empty result, or reverted precompile call usually requires checking the method encoding, target address, asset or account identifier, block tag, and network configuration in that order. If the call works for one asset but not another, verify the asset's protocol-specific index and decimal metadata instead of changing providers first.

If an EVM transaction succeeds but the expected HyperCore state does not change, inspect the receipt and logs, then confirm that the action is supported, correctly encoded, and past any documented delay. Query the native state using the same account, subaccount, vault, or order identifier used in the action. A receipt confirms EVM inclusion; it does not by itself confirm native execution.

If values appear stale, log EVM block numbers and HyperCore reference values for every response. Check whether the application is reading a cached response, mixing testnet and mainnet configuration, or assuming that latest EVM state advances at the same point as native exchange state. During incidents, preserve the raw request, response, transaction hash, and timestamps.

  • Invalid input: validate addresses, asset indices, field widths, and decimals.
  • Revert: decode the RPC error and inspect the exact calldata.
  • Delayed action: poll native state with bounded backoff and a timeout.
  • Inconsistent reads: compare block references before comparing decoded values.
  • Rate limiting: reduce concurrency, add backoff, and measure retry impact separately.

Interface tradeoffs and operational limits

Native exchange interfaces are generally the natural choice for trading workflows because they expose exchange-specific concepts directly. EVM reads are useful when an application already operates inside HyperEVM or needs contract-level composability, but they only expose the HyperCore data supported by the documented precompiles. CoreWriter enables contract-triggered actions, but introduces encoding complexity and an asynchronous confirmation path.

An RPC endpoint is also not a historical data warehouse. Retention, archive access, rate limits, WebSocket behavior, and indexing features vary by service and plan. If your product needs long-range analytics, order-book reconstruction, or guaranteed replay, define a separate ingestion and storage design rather than assuming that repeated RPC calls will provide all historical data.

Performance claims should be workload-specific. A single read latency does not represent transaction inclusion, native action processing, WebSocket delivery, or historical query performance. For production planning, document the required freshness, acceptable error rate, concurrency, retry budget, and recovery behavior, then evaluate infrastructure against those requirements.

  • Precompiles: compact EVM access to selected HyperCore state.
  • CoreWriter: composable contract-to-Core actions with delayed native confirmation.
  • Native interfaces: exchange-specific workflows and identifiers.
  • Indexed storage: repeatable historical queries and analytics at additional operational cost.

Production rollout sequence

Start with a read-only testnet integration and fixture-based decoding tests. Include malformed addresses, unknown assets, empty accounts, reverted calls, and changing block tags. Then add a controlled write test using a test-only signer and verify the full lifecycle from EVM receipt through native state.

Before mainnet deployment, pin the protocol interface versions used by your application, review network-specific addresses and action support, and make the confirmation policy explicit in product code. Use circuit breakers for repeated failures, bounded polling for delayed actions, and durable storage for transaction hashes and reconciliation state.

For infrastructure planning, compare a managed RPC API service with a dedicated node according to your required throughput, isolation, observability, and recovery model. Teams that need a broader multi-network design can also review the multi-chain RPC endpoints guide, while keeping HyperCore-specific semantics in a separate adapter.

Next integration steps

The most reliable next step is to choose one narrow use case: read an oracle or account value, submit one supported testnet action, or build a reconciliation worker. Document the expected input, decoded output, block reference, confirmation condition, and failure response before expanding market coverage.

Keep the EVM and HyperCore models separate in code, even when they share an account or asset. That separation makes it easier to change RPC providers, add native interfaces, diagnose delayed processing, and prove what your application actually observed. When endpoint selection becomes the remaining decision, use the concise best Hyperliquid RPC provider guide rather than coupling provider assumptions to protocol logic.

Never Worry about Infrastructure Again

OnFinality takes away the heavy lifting of DevOps so you can build smarter and faster.

Get Started