> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://www.openfort.io/api/mcp` to find what you need.
>
> **Have feedback?** Use `submit_feedback` on the same MCP server.

# HyperEVM

HyperEVM is Hyperliquid's EVM-compatible chain that runs alongside the L1. It supports smart contract deployment, DeFi composability, and standard EVM transactions while leveraging Hyperliquid's high-performance order book.

## Chain configuration

| Property | Mainnet | Testnet |
|----------|---------|---------|
| Chain ID | 999 | 998 |
| RPC URL | `https://rpc.hyperliquid.xyz/evm` | `https://rpc.hyperliquid-testnet.xyz/evm` |
| Block explorer | `https://hyperevmscan.io` | `https://explore-testnet.hyperpc.app` |
| Native token | HYPE | HYPE |

## Send a transaction

Use a backend wallet with viem to send transactions on HyperEVM:

```ts
import Openfort from '@openfort/openfort-node'
import { createWalletClient, http, defineChain } from 'viem'
import { toAccount } from 'viem/accounts'

const openfort = new Openfort(process.env.OPENFORT_SECRET_KEY!, {
  walletSecret: process.env.OPENFORT_WALLET_SECRET!,
})
const account = await openfort.accounts.evm.backend.create()

// Wrap the Openfort account as a viem LocalAccount so viem signs locally
const viemAccount = toAccount({
  address: account.address,
  sign: async ({ hash }) => account.sign({ hash }),
  signMessage: async ({ message }) => account.signMessage({ message }),
  signTransaction: async (tx) => account.signTransaction(tx),
  signTypedData: async (typedData) => account.signTypedData(typedData),
})

const hyperEvmTestnet = defineChain({
  id: 998,
  name: 'Hyperliquid EVM Testnet',
  nativeCurrency: { name: 'HYPE', symbol: 'HYPE', decimals: 18 },
  rpcUrls: {
    default: { http: ['https://rpc.hyperliquid-testnet.xyz/evm'] },
  },
  blockExplorers: {
    default: {
      name: 'Blockscout',
      url: 'https://explore-testnet.hyperpc.app',
    },
  },
})

const walletClient = createWalletClient({
  account: viemAccount,
  chain: hyperEvmTestnet,
  transport: http(),
})

const hash = await walletClient.sendTransaction({
  to: '0x...',
  value: 1000000000000000n, // 0.001 HYPE
})

console.log('Transaction hash:', hash)
```

## Deploy a contract

Deploy a smart contract using the same wallet client:

```ts
import { createWalletClient, http } from 'viem'

const walletClient = createWalletClient({
  account: viemAccount,
  chain: hyperEvmTestnet,
  transport: http(),
})

const hash = await walletClient.deployContract({
  abi: contractAbi,
  bytecode: contractBytecode,
  args: [/* constructor args */],
})

console.log('Deploy tx:', hash)
```

## Read contract state

Use a public client to read from deployed contracts:

```ts
import { createPublicClient, http } from 'viem'

const publicClient = createPublicClient({
  chain: hyperEvmTestnet,
  transport: http(),
})

const result = await publicClient.readContract({
  address: '0x...',
  abi: contractAbi,
  functionName: 'balanceOf',
  args: [account.address],
})
```

## Gas on HyperEVM

HyperEVM transactions require HYPE for gas. You can transfer HYPE to your backend wallet from an existing HyperEVM account.

:::info
For gas sponsorship on other EVM chains supported by Openfort, see [Gas sponsorship](https://www.openfort.io/docs/configuration/gas-sponsorship). HyperEVM isn't one of Openfort's [supported chains](https://www.openfort.io/docs/configuration/chains), so Openfort's bundler and paymaster aren't available there.
:::

## L1 to HyperEVM bridging

Hyperliquid provides native bridging between the L1 (trading) and HyperEVM layers. Use the `spotSend` action to send a spot token to that token's HyperEVM system address; Hyperliquid credits the same token to your address on HyperEVM:

```ts
import * as hl from '@nktkas/hyperliquid'

const transport = new hl.HttpTransport({ isTestnet: true })
const exchange = new hl.ExchangeClient({ wallet: account, transport })

// Transfer a spot token from L1 to HyperEVM
await exchange.spotSend({
  destination: '0x20...', // the token's HyperEVM system address
  token: 'USDC:0x...',
  amount: '100',
})
```

## Best practices

* **Keep HyperEVM and L1 wallets separate** — use one backend wallet for trading (L1) and another for smart contract interactions (HyperEVM) to isolate risk
* **Fund HYPE for gas ahead of time** — HyperEVM transactions fail without HYPE; ensure your wallet has a buffer for gas spikes
* **Use public clients for reads** — only create a `walletClient` when you need to sign transactions; use `publicClient` for all read operations
* **Test contract deployments on testnet first** — verify your contracts on HyperEVM testnet (chain ID 998) before deploying to mainnet (chain ID 999)
