跳转到内容
TX Landing / 错误

错误

中继应答的每个 HTTP 状态码、其确切应答体和处理方法,以及 QUIC 的相应行为。

errors.md

在 POST /v1/sendTransaction 和 POST /v1/sendBundle 上,带 JSON-RPC 代码的消息格式为 {"jsonrpc":"2.0","id":<your id or null>,"error":{"code":<code>,"message":"<message>"}}。发送路由上的其他所有消息格式为 {"error":"<message>"}。404 和 405 为纯文本。

状态码 消息(代码) 原因 处理方法
400 invalid JSON (-32700) 请求体不是 JSON。 发送一个 JSON 对象。
400 invalid JSON-RPC request (-32600) 请求体不是对象,例如批量请求。 每个请求一笔交易或一个 bundle。
400 jsonrpc must be "2.0" (-32600) 缺少 jsonrpc 或其值不是 "2.0"。 加上 "jsonrpc":"2.0"。
400 unsupported JSON-RPC method (-32601) 在 /v1/sendTransaction 上使用 sendTransaction 以外的方法,或在 /v1/sendBundle 上使用 sendBundle 以外的方法。 每个方法发送到它自己的路由。
400 params must be an array, params[0] must be an encoded transaction string, params[0] must be an array of transactions, bundle must contain 1 to 4 transactions, bundle transactions must be encoded strings, params[1] must be an options object, encoding must be a string, unsupported transaction encoding (-32602) params 格式错误,或 bundle 交易数不在 1–4 之间。 按 HTTP 或发送 Bundle 中的格式发送 params。
400 unsupported Content-Type 原始路由:缺少 Content-Type,或其值不是 application/octet-stream 或 text/plain。 设置二者之一。
400 invalid UTF-8 base64 payload 原始路由:text/plain 请求体不是 UTF-8。 发送 base64 文本。
400 invalid base64 transaction (-32602) 字符串无法解码,例如 base58。 使用带 = 填充的标准 base64。
400 empty transaction payload (-32602) 没有交易,或 bundle 中包含空项。 发送序列化后的交易字节。
400 invalid transaction (-32602) 字节无法解析,或是 v0、v1 以外的版本化交易。 发送序列化并已签名的交易。相同的字节会得到相同的应答。
400 duplicate transaction in bundle (-32602) sendBundle 中有两笔交易拥有相同的首签名。 从 bundle 中移除重复交易。
400 missing transaction signature, missing transaction signer (-32602) 没有签名,或没有静态账户密钥。 对交易签名。
400 missing required tip (-32602) 没有符合条件的小费,或小费过少(sendBundle 中没有任何单笔交易达到最低小费)。 加上小费。
400 request body timeout,带 Connection: close 请求体未在 5 秒内到达。 在新连接上一次性发送整个请求体。
400 failed to read request body,带 Connection: close 读取请求体时的其他错误。 在新连接上重新发送。
401 unauthorized 密钥缺失、格式错误、未知或已停用;密钥放在 URL 中而不是 api-key 请求头中。同一连接上连续第三次还会关闭该连接。 见身份验证。
403 bundles require a paid tier 用 Free 档位的密钥请求 /v1/sendBundle。不计入你的限额。 购买付费档位。
404 not found 其他任何路径,包括 /。路径须完全一致且区分大小写。 检查路径。
405 method not allowed 在发送路由上不是 POST,或在 /ping 上不是 GET(包括 HEAD)。 发送用 POST,/ping 用 GET。
413 payload too large,带 Connection: close 请求体超过 16384 字节(/v1/sendTransaction、/v1/sendRawTransaction)或 32768 字节(/v1/sendBundle)。 缩小请求体,在新连接上发送。
413 transaction too large (-32602) 交易超过 1232 字节(legacy、v0)或 4096 字节(v1)。 减小交易。
429 rate limit exceeded 超出你在此中继上的速率限制。 降低发送速度。
429 too many concurrent connections,带 Connection: close 你的 IP 地址到此中继打开的连接过多(包括 /ping)。 对每个端点复用一个持久连接。
503 relay busy, try again 中继暂时过载。 重试,或使用其他端点。不计入你的限额。
无 连接被关闭 打开的连接过多;请求头部未在 5 秒内到达;空闲 60 秒。 复用一个持久连接;立即发送第一个请求;发送 GET /ping 的间隔短于 60 秒。

QUIC 不发送确认:流结束只表示 QUIC 收下了这些字节。

情况 结果
被接受,或因上述任一交易错误、速率限制、或流超过 8192 字节而被拒绝 不返回任何内容。
没有客户端证书,或密钥未知 握手后关闭:应用错误代码 0,原因 NotWhitelisted。
证书密钥不是 Ed25519,或握手签名无效 TLS 握手失败。
连接期间密钥被停用 连接保持打开;每笔交易都被丢弃。
同一密钥打开的连接过多 最早的连接被关闭:应用错误代码 0,原因 TooManyConnections。
空闲 30 秒 连接关闭;中继不发送 keep-alive。