Overview of JSON-RPC 2.0 Protocol
jsonrpc member with the value "2.0".website·Indexed 33 days ago
https://docs.simplechain.com/Technical documentation for SimpleChain, covering JSON-RPC specifications, conventions, and API details for versions 2.0.0 and Next.
jsonrpc member with the value "2.0".To execute multiple requests in a single call, send an Array of Request objects. The server processes these as concurrent tasks and returns an Array of Response objects.
Key behaviors:
id member, as responses may be returned in any order.id) must not have a corresponding Response object in the returned array.--> [
{"jsonrpc": "2.0", "method": "sum", "params": [1,2,4], "id": "1"},
{"jsonrpc": "2.0", "method": "notify_hello", "params": [7]},
{"jsonrpc": "2.0", "method": "subtract", "params": [42,23], "id": "2"},
{"foo": "boo"}
]
<-- [
{"jsonrpc": "2.0", "result": 7, "id": "1"},
{"jsonrpc": "2.0", "result": 19, "id": "2"},
{"jsonrpc": "2.0", "error": {"code": -32600, "message": "Invalid Request"}, "id": null}
]id member. This signifies that the Client is not interested in a response. The Server MUST NOT reply to a Notification, even if it is part of a batch request. Because there is no response, the Client will not be notified of errors such as "Invalid params" or "Internal error".A batch request is sent as an Array of Request objects. The server processes these and responds with an Array of corresponding Response objects.
Key behaviors:
id member to match requests to responses.id are notifications and MUST NOT have a corresponding response object in the returned array.id member. The server must not send a response for notifications.--> {"jsonrpc": "2.0", "method": "update", "params": [1,2,3,4,5]}
// No response is returnedid member. This signifies that the Client is not interested in a response. The Server MUST NOT reply to a Notification, and the Client will not be notified of any errors (such as "Invalid params" or "Internal error").The Server replies to a Request (except Notifications) with a Response object containing:
jsonrpc: MUST be exactly "2.0".id: MUST match the id from the Request object. If the id could not be detected (e.g., parse error), it MUST be Null.result: REQUIRED on success. MUST NOT exist if there was an error.error: REQUIRED on error. MUST NOT exist if the call was successful. This must be an Error object.Parameters in the params member must be provided as a Structured value using one of two methods:
params is an Array containing values in the order expected by the Server.params is an Object where member names match the Server's expected parameter names (case-sensitive).When an error occurs, the error member of the Response object must be an Object containing:
code: An integer indicating the error type.message: A short, single-sentence description of the error.data: (Optional) Additional information about the error defined by the Server.Reserved Error Codes:
-32700: Parse error (Invalid JSON received).-32600: Invalid Request (Not a valid Request object).-32601: Method not found.-32602: Invalid params.-32603: Internal error.-32000 to -32099: Implementation-defined server errors.