> For the complete documentation index, see [llms.txt](https://docs.megaeth.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.megaeth.com/developer-docs/rpc/quickstart.md).

# 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`](https://docs.megaeth.com/developer-docs/rpc/reference/eth_subscribe.md) and [`eth_unsubscribe`](https://docs.megaeth.com/developer-docs/rpc/reference/eth_unsubscribe.md).

## Check the latest block

```bash
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:

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

## Verify the network

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

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.

```bash
curl -sS https://mainnet.megaeth.com/rpc \
  -H 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","id":3,"method":"eth_getBalance","params":["0x0000000000000000000000000000000000000000","latest"]}'
```

The result is a hexadecimal [`Quantity`](https://docs.megaeth.com/developer-docs/rpc/types.md#quantity) denominated in wei.

## Next steps

* Use [JSON-RPC basics](https://docs.megaeth.com/developer-docs/rpc/json-rpc-basics.md) for envelopes, notifications, and batches.
* Use [Operations and limits](https://docs.megaeth.com/developer-docs/rpc/operations-and-limits.md) before sending large batches or historical queries.
* Use [Error reference](https://docs.megaeth.com/developer-docs/rpc/error-codes.md) to distinguish transport failures from JSON-RPC errors.
* Browse the [RPC Reference](https://docs.megaeth.com/developer-docs/rpc/reference.md) for request and response schemas.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.megaeth.com/developer-docs/rpc/quickstart.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
