Skip to content

OpenRPC

TLDR

The rpc.discover method returns an API service description structured per the OpenRPC specification.

Discovery

CoreGeth supports OpenRPC’s Service Discovery method, enabling efficient and well-spec’d JSON RPC interfacing and tooling. This method follows the established JSON RPC patterns, and is accessible via HTTP, WebSocket, IPC, and console servers. To use this method:

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
$ curl -X POST -H 'Content-Type: application/json' --data '{"jsonrpc":"2.0","method":"rpc_discover","params":[],"id":1}'
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "openrpc": "1.0.10",
    "info": {
      "description": "This API lets you interact with an EVM-based client via JSON-RPC",
      "license": {
        "name": "Apache 2.0",
        "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
      },
      "title": "Ethereum JSON-RPC",
      "version": "1.0.0"
    },
    "servers": [],
    "methods": [
      {
        "description": "Returns the version of the current client",
        "name": "web3_clientVersion",
        "params": [],
        "result": {
          "description": "client version",
          "name": "clientVersion",
          "schema": {
            "type": "string"
          }
        },
        "summary": "current client version"
      },

[...]

Better representation of the discovery result at the OpenRPC playground

You can see an example use case of the discovery service in the respective OpenRPC Playground.


Last update: 2023-10-11