near / nearcore

Reference client for NEAR Protocol
https://near.org
GNU General Public License v3.0
2.3k stars 601 forks source link

Add JSON RPC Batching #10528

Open mikedotexe opened 5 months ago

mikedotexe commented 5 months ago

In the JSON RPC spec there's an optional way to batch requests.

https://www.jsonrpc.org/specification#batch

For applications that may need to frequently query from multiple places (like pools in DeFi) one could batch these together into a single request.

Since each item in the array is given a unique id it would be nice if a failure were indicated in the eventual response with the key of that id.

Related: https://stackoverflow.com/questions/70729985/are-batch-json-rpc-requests-not-supported-with-near

mikedotexe commented 4 months ago

FASTNEAR has managed to implement JSON RPC Batching, might reach out to @evgenykuzyakov for tips. And as I learn more, hopefully I can help in time.

evgenykuzyakov commented 3 months ago

It's only enabled for read-rpc. I think nearcore can be upgraded to support batch RPC as well, but it requires extra work