For the complete documentation index, see llms.txt. This page is also available as Markdown.

Quickstart

Make your first read-only MegaETH JSON-RPC requests and verify the connected network.

Use these read-only requests to confirm connectivity and learn the basic response shape. The public HTTP endpoint accepts JSON-RPC POST requests without an API key.

Endpoints

Network
HTTP
WebSocket

Mainnet

https://mainnet.megaeth.com/rpc

wss://mainnet.megaeth.com/ws

Testnet

https://carrot.megaeth.com/rpc

wss://carrot.megaeth.com/ws

Use HTTP for standard requests and WebSocket for eth_subscribe and eth_unsubscribe.

Check the latest block

curl -sS https://mainnet.megaeth.com/rpc \
  -H 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","id":1,"method":"eth_blockNumber","params":[]}'

A successful response contains a hexadecimal block number:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x..."
}

Verify the network

MegaETH Mainnet returns 0x10e6 (4326), and MegaETH Testnet returns 0x18c7 (6343).

Read account state

Replace the zero address with the account you want to query.

The result is a hexadecimal Quantity denominated in wei.

Next steps

  • Use JSON-RPC basics for envelopes, notifications, and batches.

  • Use Operations and limits before sending large batches or historical queries.

  • Use Error reference to distinguish transport failures from JSON-RPC errors.

  • Browse the RPC Reference for request and response schemas.

Last updated