RPC

rpc.start

Start the JSON-RPC service. Only available in console mode.

Parameters: None

Console Example

> rpc.start()

rpc_stop

Stop the JSON-RPC service. Available in console and attach mode.

Private: Requires authentication.

Parameters: None

Curl Example:

curl -X POST --data '{"jsonrpc":"2.0",  "method":"rpc_stop", "id":21 }'

Console Example

> rpc.stop()

Returns:

Boolean

Output:

{
  "id": 21,
  "jsonrpc": "2.0",
  "result": true
}

rpc_methods

Get all JSON-RPC methods.

Parameters: None

Curl Example:

curl -X POST --data '{"jsonrpc":"2.0",  "method":"rpc_methods", "id":21 }'

Console Example

> rpc.methods()

Returns:

Array<Object>

Output:

{
  "id": 21,
  "jsonrpc": "2.0",
  "result": [
    {
      "description": "Add a peer address",
      "name": "net_addPeer",
      "private": true
    }
  ]
}

rpc_echo

Send a value to the server and have it resent back. Used for testing.

Parameters:

Curl Example:

curl -X POST --data '{"jsonrpc":"2.0",  "method":"rpc_echo", "params": "Hello, world!", "id":21 }'

Console Example

> rpc.echo("Hello, world!")

Returns:

Any

Output:

{
  "id": 21,
  "jsonrpc": "2.0",
  "result": "Hello, world!"
}

Last updated