A
A
Ankr Docs
Search…
Request & Response Objects

THE REQUEST OBJECT

The Request object has the following attributes:
Request Object Attributes
1
"jsonrpc":"2.0",
2
"method":"eth_protocolVersion",
3
"params":[],
4
"id":67
Copied!
jsonrpc: A String specifying the version of the JSON-RPC protocol. MUST be exactly “2.0”.
method: A String containing the name of the method to be invoked. Method names that begin with the word rpc followed by a period character (U+002E or ASCII 46) are reserved for rpc-internal methods and extensions and MUST NOT be used for anything else.
params: A Structured value that holds the parameter values to be used during the invocation of the method. This member MAY be omitted.
id: An identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null and Numbers SHOULD NOT contain fractional parts.
When an RPC call is made, the Server MUST reply with a Response object.

THE RESPONSE OBJECT

The Response object has the following attributes:
Example Request Object
1
{
2
"jsonrpc":"2.0",
3
"id":"1",
4
"result":"0x60e"
5
}
Copied!
jsonrpc: A String specifying the version of the JSON-RPC protocol. MUST be exactly “2.0”.
result: This member is REQUIRED on success. This member MUST NOT exist if there was an error invoking the method. The value of this member is determined by the method invoked on the Server.
error: This member is REQUIRED on error. This member MUST NOT exist if there was no error triggered during invocation. The value for this member MUST be an Object including code field and message field.
id: This member is REQUIRED. It MUST be the same as the value of the id member in the Request Object. If there was an error in detecting the id in the Request object (e.g. Parse error/Invalid Request), it MUST be Null.
Last modified 1mo ago
Copy link