개발자를 위한 문서 / JSON-RPC

오류와 한도

다섯 개의 오류 코드가 전부를 실어 나릅니다. 제대로 다룰 값어치가 있는 것은 -32005입니다. 실수가 아니라 한도라는 뜻이고, 같은 요청이 나중에는 성공하기 때문입니다.

다섯 개의 코드

코드Value
-32602Invalid paramsa malformed address, block tag, filter id or topic filter
-32601Method not found or not availablean unregistered name, or one refused by design such as eth_sendTransaction
-32000Executiona revert, a decode failure, a signature failure, or a consensus rejection
-32005Limita rate limit, a full queue, a timeout, a size cap or a filter cap - every row on this page
-32603Internala write-ahead-log or coordinator failure; also every non-send error when you are on the WebSocket transport

운영상 중요한 구분은 -32000과 -32005 사이입니다. 실행 오류는 여러분의 트랜잭션에 대한 사실이므로 재시도해도 달라지는 것이 없습니다. 한도 오류는 노드의 현재 부하에 대한 사실이므로, 자리가 나면 똑같은 요청이 성공합니다.

error.data가 없습니다

revert 사유는 라이브러리가 디코딩할 수 없습니다

A revert arrives as message text - "execution reverted: 0x<returndata>" - and error.data is absent.

Libraries decode custom errors and revert strings out of error.data, so on this chain they cannot. ethers and viem will both surface the raw message instead of a decoded error. If you need the reason, parse the hex out of the message yourself and decode it against your own ABI.

다른 점 페이지에 우회 방법이 있습니다.

Sending a transaction

한도값변수넘겼을 때
Raw transaction sizechecked on the hex string BEFORE decoding, so an oversized transaction is a limit error rather than a decode error128 KiB컴파일 타임 상수-32005
Admission queuequeued transactions across all senders4,096 totalADMISSION_CAPACITY-32005 "sequencer admission queue is full"
Per sendercompile-time, so one sender cannot fill the queue with unfillable nonces64컴파일 타임 상수-32005
Execution waitthe coordinator's own deadline is 5 s; the call waits until the transaction executes or this expires6 s컴파일 타임 상수-32005 "transaction timed out waiting for execution"
Per execution batchMAX_ADMIT_PER_BATCH - a throughput mechanism, not a caller-visible limit512컴파일 타임 상수-

Expensive reads

한도값변수넘겼을 때
Token bucket burstguards eth_call, eth_estimateGas and eth_getLogs together256HEAVY_READ_BURST-32005 "rate limit exceeded for expensive read methods"
Refill rateprocess-wide and shared by every caller - explicitly a backstop, not per-client limiting128/sHEAVY_READ_PER_SEC-
eth_getLogs spana span of 5,000 or more is refused outrightunder 5,000 blocks컴파일 타임 상수-32005 "log block range is too wide"
eth_getLogs matchesnarrow the filter or walk the range in windows10,000컴파일 타임 상수-32005 "eth_getLogs matched too many logs"

The HTTP listener

한도값변수넘겼을 때
Connections512RPC_MAX_CONNECTIONS-
Request bodythe public vhost caps a request at 1 MiB before this applies, and 1 MiB of JSON-RPC batch is already thousands of calls2 MiBRPC_MAX_REQUEST_BYTES-
Response body16 MiBRPC_MAX_RESPONSE_BYTES-
Batch lengthsplit a larger batch client-side32RPC_MAX_BATCH-
Keep-aliveTCP_NODELAY is on30 sRPC_KEEP_ALIVE_SECS-

Filters

한도값변수넘겼을 때
Filters per node1,024MAX_FILTERS-32005 "filter limit reached"
Buffer per filterthe OLDEST entries are trimmed when you stop polling, so a slow poller loses the beginning of its backlog rather than the end1,024 entriesMAX_FILTER_BUFFER-
Idle expirymeasured since the last poll, and expiry is silent - the next poll answers -32602 "filter not found"300 sFILTER_TTL_SECS-32602

설정이 아닌 두 값

MIN_GAS_PRICE (1 wei) and EXECUTION_SPEC (Cancun)은 설정처럼 보이지만 일부러 컴파일 타임 상수입니다.

Both are compile-time constants rather than environment variables, and that is a correctness requirement rather than an oversight. Either one made operator-tunable would let a replica reject or re-price a transaction the leader had accepted, and derivation would halt on the divergence. Pinning the hardfork also means a revm upgrade cannot silently change gas accounting underneath an already-settled chain.

한도를 잘 다루기

클라이언트별 요청 제한도 없고 남은 예산을 알려 주는 헤더도 없으므로, 클라이언트는 신호를 보고 스스로를 조절할 수 없습니다 - 만들 때부터 얌전해야 합니다. 세 가지가 중요합니다.

  • -32005에서는 즉시 재시도하지 말고 백오프하십시오. 무거운 읽기 버킷은 모든 호출자가 공유하므로, 촘촘한 재시도 루프는 자기 자신을 포함한 모두를 위해 그 버킷을 계속 비워 두는 가장 빠른 길입니다.
  • eth_getLogs 범위에 창을 두십시오. 5,000 블록 아래로 두고, 매치 상한은 10,000에서 걸린다고 생각하십시오. 약 2분치 블록을 보관하는 체인에서 먼저 마주치는 실질적 한계는 범위가 아니라 보존입니다.
  • 배치는 32개까지 유지하십시오. 그 위로는 잘리는 것이 아니라 거부됩니다.
javascript
// RPC_URL: https://rpc.picklechain.xyz on the public testnet, or a node of your own.
async function call(body, attempt = 0) {
  const res = await fetch(RPC_URL, {
    method: "POST",
    headers: { "content-type": "application/json" },
    body: JSON.stringify(body),
  });
  const json = await res.json();

  // -32005 is a limit, not a mistake: the same request works later.
  if (json.error?.code === -32005 && attempt < 5) {
    await new Promise((r) => setTimeout(r, 2 ** attempt * 250));
    return call(body, attempt + 1);
  }
  return json;
}