Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/dev/read/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,19 @@ All available methods are subject to rate limiting based on two criteria:

User limits are dynamically updated in response to individual behavior.

## Request Body Limits

The public RPC endpoint caps the size of the request body, and the cap depends on the method being called:

| Method class | Maximum body size |
| --------------------------------------------------------------------------------------------------- | ----------------- |
| Transaction submission (`eth_sendRawTransaction`, `realtime_sendRawTransaction`) | 2.5 MiB |
| Large reads and simulations (`eth_call`, `eth_callMany`, `eth_createAccessList`, `eth_estimateGas`) | 1.5 MiB |
| All other methods | 128 KiB |

The higher limits for simulation methods let you estimate gas for or simulate large contract deployments, whose initcode can exceed the 128 KiB default.
A request whose body exceeds the applicable limit is rejected with HTTP `413` and RPC error `-32099` (`payload too large`) — see [Error Codes](rpc/error-codes.md).

## Related Pages

- [Realtime API](realtime-api.md) — use-case guide for streaming data and instant receipts
Expand Down
19 changes: 10 additions & 9 deletions docs/dev/read/rpc/error-codes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ description: MegaETH JSON-RPC error codes — HTTP status codes, RPC error codes

# Error Codes

| HTTP Error Code | RPC Error Code | Error Message | Explanation | Mitigation |
| --------------- | -------------- | -------------------------------------------------------------- | --------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| 400 | -32700 | `parse error` | The request body contains invalid JSON. | Check the request format and ensure valid JSON syntax. |
| 403 | -32601 | `rpc method is not whitelisted` | The requested RPC method is not allowed by the proxy configuration. | Use only whitelisted RPC methods. Contact MegaETH if you need access to additional methods. |
| 400 | -32019 | `block is out of range` | The requested block number is out of range. | Check the block number and ensure it's within the valid range. |
| 500 | -32020 | `backend response too large` | The backend response is too large. | Reduce the scope of the request or contact MegaETH for assistance. |
| 429 | -32021 | `over network traffic limit, retry in X seconds` | The user is incurring too much network traffic. | Wait for the specified number of seconds before retrying. Reduce the number of requests sent per second. |
| 429 | -32022 | `over compute unit limit, retry in X seconds` | The user is incurring too much computation on the backend RPC server. | Wait for the specified number of seconds before retrying. Reduce the number of requests sent per second. |
| 200 | -32000 | `permanent error forwarding request context deadline exceeded` | The API proxy cannot connect to the backend RPC server. | Pause for a while and retry. Notify MegaETH if the error persists. |
| HTTP Error Code | RPC Error Code | Error Message | Explanation | Mitigation |
| --------------- | -------------- | -------------------------------------------------------------- | --------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| 400 | -32700 | `parse error` | The request body contains invalid JSON. | Check the request format and ensure valid JSON syntax. |
| 413 | -32099 | `payload too large` | The request body exceeds the size limit for the method being called. | Stay within the body-size limit for the method class. See [Request Body Limits](../overview.md#request-body-limits). |
| 403 | -32601 | `rpc method is not whitelisted` | The requested RPC method is not allowed by the proxy configuration. | Use only whitelisted RPC methods. Contact MegaETH if you need access to additional methods. |
| 400 | -32019 | `block is out of range` | The requested block number is out of range. | Check the block number and ensure it's within the valid range. |
| 500 | -32020 | `backend response too large` | The backend response is too large. | Reduce the scope of the request or contact MegaETH for assistance. |
| 429 | -32021 | `over network traffic limit, retry in X seconds` | The user is incurring too much network traffic. | Wait for the specified number of seconds before retrying. Reduce the number of requests sent per second. |
| 429 | -32022 | `over compute unit limit, retry in X seconds` | The user is incurring too much computation on the backend RPC server. | Wait for the specified number of seconds before retrying. Reduce the number of requests sent per second. |
| 200 | -32000 | `permanent error forwarding request context deadline exceeded` | The API proxy cannot connect to the backend RPC server. | Pause for a while and retry. Notify MegaETH if the error persists. |

## Related Pages

Expand Down
7 changes: 7 additions & 0 deletions docs/dev/send-tx/gas-estimation.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ There are two workarounds:
For reference, standard Ethereum node software (geth, reth) defaults to 50M, and providers like Alchemy support up to 550M.
See the [RPC Providers](../tooling.md#rpc-providers) table for providers that support MegaETH.

### Request Body Size for Large Deployments

Estimating gas for a large contract deployment sends the full initcode in the request body.
To accommodate this, the public RPC endpoint allows `eth_call`, `eth_callMany`, `eth_createAccessList`, and `eth_estimateGas` bodies up to **1.5 MiB** — well above the 128 KiB limit applied to ordinary read methods.
A request that exceeds this limit is rejected with HTTP `413` / `-32099` (`payload too large`).
See [Request Body Limits](../read/overview.md#request-body-limits) for the full breakdown.

## Toolchain Configuration

### Foundry
Expand Down
Loading