RPC

rpc.start

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

Console Example

1
> rpc.start()
Copied!

rpc_stop

Stop the JSON-RPC service. Available in console and attach mode.
Private: Requires authentication.
Parameters: None
Curl Example:
1
curl -X POST --data '{"jsonrpc":"2.0", "method":"rpc_stop", "id":21 }'
Copied!

Console Example

1
> rpc.stop()
Copied!

Returns:

Boolean

Output:

1
{
2
"id": 21,
3
"jsonrpc": "2.0",
4
"result": true
5
}
Copied!

rpc_methods

Get all JSON-RPC methods.
Parameters: None
Curl Example:
1
curl -X POST --data '{"jsonrpc":"2.0", "method":"rpc_methods", "id":21 }'
Copied!

Console Example

1
> rpc.methods()
Copied!

Returns:

Array<Object>
Field
Type
Description
name
String
The name of the method. (format: <namespace>_<method_name>)
description
String
A brief description of the method.
private
Boolean
Indicate that the method is private or not.

Output:

1
{
2
"id": 21,
3
"jsonrpc": "2.0",
4
"result": [
5
{
6
"description": "Add a peer address",
7
"name": "net_addPeer",
8
"private": true
9
}
10
]
11
}
Copied!

rpc_echo

Send a value to the server and have it resent back. Used for testing.
Parameters:
Argument
Type
Description
value
Any
The value to be sent and echoed.
Curl Example:
1
curl -X POST --data '{"jsonrpc":"2.0", "method":"rpc_echo", "params": "Hello, world!", "id":21 }'
Copied!

Console Example

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

Returns:

Any

Output:

1
{
2
"id": 21,
3
"jsonrpc": "2.0",
4
"result": "Hello, world!"
5
}
Copied!