Skip to main content
Skip table of contents

Batch Requests

It is possible to send a batch of requests to our Enhanced API Service within a single JSON-RPC Request. The request will contain an array of individual RPC request objects, and the response will also contain an array of response objects matching the request.

OnFinality does not recommend the use of batch requests. They can result in slower performance and limit the internal optimisation and load balancing that help make our Enhanced API Service so reliable

Known Issues

  • There are routing issues with eth_* batch requests, as such response times will be poor

  • We can’t serve you responses from our cache

Examples

Request

JSON
curl -X POST -H 'Content-Type: application/json'  \
  --data '[
    {"jsonrpc":"2.0","id":1, "method":"eth_protocolVersion", "params":[]},
    {"jsonrpc":"2.0","id":2, "method":"eth_protocolVersion", "params":[]},
    {"jsonrpc":"2.0","id":3, "method":"eth_protocolVersion", "params":[]},
    {"jsonrpc":"2.0","id":4, "method":"eth_protocolVersion", "params":[]},
    {"jsonrpc":"2.0","id":5, "method":"eth_protocolVersion", "params":[]}
  ]' \
  "http://127.0.0.1:9000/public"

Response

JSON
[
  {"jsonrpc":"2.0","result":1,"id":1},
  {"jsonrpc":"2.0","result":1,"id":2},
  {"jsonrpc":"2.0","result":1,"id":3},
  {"jsonrpc":"2.0","result":1,"id":4},
  {"jsonrpc":"2.0","result":1,"id":5}
]

Rate Limits and Batches

Each individual request object inside a batched JSON-RPC request will count towards your rate limit. If the total number of requests inside a batch would take you over your rate limit, the entire batch will be rejected.

For example, with our standard 50 requests/second public rate limit, if you send two simultaneous batches with 30 request objects in each then the second batch will be rejected entirely.

If you must use batching, we recommend keeping the batch size as low as possible to make the most of your available rate limit and avoid unnecessary rejections.

Maximum Batch Size

Aside from the batch request limitations imposed by your rate limit, we also have a maximum batch size of 100 requests across all our API plans for service stability.

Plan Daily and Monthly Response Limits

Each individual response object returned from a batched JSON-RPC request will count as a response unit towards your workspace's plan.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.