Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

C3 JSON RPC Specification

Adam Hanna edited this page Jun 27, 2018 · 28 revisions

JSON-RPC Specification

List of supported C3 JSON RPC Specification methods

Invoke Method

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "c3_invokeMethod",
  "params": [
     "myMethodName",
     "arg1",
     "arg2"
  ]
}

Example success response

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "123"
}

Example error response

{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
     "code": "4002",
     "message": "invalid arguments",
     "data": ""
  }
}

Fork Image

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "c3_forkImage",
  "params": [
     "{imageHash}",
     "{stateBlockNumber}"
  ]
}

Response Object

{
  "jsonrpc": "2.0",
  "id": "1",
  [error|result]
}

Result Object

  • 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 Object

  • 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 as defined in section 5.1.

Error codes: | code | message | meaning | |:----:||:----:||:----:| | -32700 | Parse error | Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text. | | -32600 | Invalid Request | The JSON sent is not a valid Request object. | | -32601 | Method not found | The method does not exist / is not available. | | -32602 | Invalid params | Invalid method parameter(s). | | -32603 | Internal error | Internal JSON-RPC error. | | -32000 to -32099 | Server error | Reserved for implementation-defined server-errors. |

{
  "code": -32700,
  "message": "a string message",
  "data": {
    ...
  }
}
Clone this wiki locally