批量请求

即在一个数组中同时发送多个请求称为批处理,参阅 JSON-RPC 2.0规范

批处理请求被统计为: 数组的总数 + 1。 如: 下面数组包含10个批处理,那么这10个批处理将计入每日请求限制,还需再加上自身1次请求,因此计入 11 个请求。

curl https://eth-mainnet.solarpath.io/v1/YOUR-API-KEY \
    -X POST \
    -H "Content-Type: application/json" \
    --data '[
	{"jsonrpc": "2.0", "id": 1, "method": "eth_blockNumber", "params": []},
	{"jsonrpc": "2.0", "id": 2, "method": "eth_blockNumber", "params": []},
	{"jsonrpc": "2.0", "id": 3, "method": "eth_blockNumber", "params": []},
	{"jsonrpc": "2.0", "id": 4, "method": "eth_blockNumber", "params": []},
	{"jsonrpc": "2.0", "id": 5, "method": "eth_blockNumber", "params": []},
	{"jsonrpc": "2.0", "id": 6, "method": "eth_blockNumber", "params": []},
	{"jsonrpc": "2.0", "id": 7, "method": "eth_blockNumber", "params": []},
	{"jsonrpc": "2.0", "id": 8, "method": "eth_blockNumber", "params": []},
	{"jsonrpc": "2.0", "id": 9, "method": "eth_blockNumber", "params": []},
	{"jsonrpc": "2.0", "id": 10, "method": "eth_blockNumber", "params": []}
     ]'

批量请求限制为每批 100 个请求,超过此限制的请求可能不太可靠。建议值是 30 个请求以内。

最后更新于