> 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

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`](/developer-docs/rpc/reference/eth_subscribe.md) and [`eth_unsubscribe`](/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`](/developer-docs/rpc/types.md#quantity) denominated in wei.

## Next steps

* Use [JSON-RPC basics](/developer-docs/rpc/json-rpc-basics.md) for envelopes, notifications, and batches.
* Use [Operations and limits](/developer-docs/rpc/operations-and-limits.md) before sending large batches or historical queries.
* Use [Error reference](/developer-docs/rpc/error-codes.md) to distinguish transport failures from JSON-RPC errors.
* Browse the [RPC Reference](/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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
