The API functions are here split into several groups, roughly corresponding to the components of an RChain node.
General node-related functions.
Returns the current version of the node software as well as the current version of the JSON-RPC subsystem.
None.
Object
curl -X POST --data '{"jsonrpc": "2.0", "method": "node_version", "params": [], "id": 123}' |
{ "jsonrpc": "2.0", "id": 123, "result": { "node_version": "0.1-RC3", "api_version": "1.2" } } |
Request high-level information about this node's current state.
None.
Object
"running"
or "stopped"
curl -X POST --data '{"jsonrpc": "2.0", "method": "node_status", "params": [], "id": 123}' |
{ "jsonrpc": "2.0", "id": 123, "result": { "status": "running", "timestamp": "2018-01-24T01:49:41" } } |
Request that the node start (or restart) participating in the RChain network. This call has no effect (and returns true
) if the node is already running.
None.
Boolean — true
if node was successfully started, false
otherwise
curl -X POST --data '{"jsonrpc": "2.0", "method": "node_start", "params": [], "id": 123}' |
{ "jsonrpc": "2.0", "id": 123, "result": true } |
Request that the node stop participating in the RChain network but remain available for restarting. This call has no effect (and returns true
) if the node is already stopped.
None
Boolean — true
if node was successfully stopped, false
otherwise
curl -X POST --data '{"jsonrpc": "2.0", "method": "node_stop", "params": [], "id": 123}' |
{ "jsonrpc": "2.0", "id": 123, "result": true } |
Returns some high-level information about a virtual machine.
None
Object
curl -X POST --data '{"jsonrpc": "2.0", "method": "vm_status", "params": [], "id": 123}' |
{ "jsonrpc": "2.0", "id": 123, "result": { "status": "running", "timestamp": "2018-01-24T01:49:41", "strand_count": 312, "object_count": 1234, "bytecode_count": 12345, "mem_size": 392489 } } |
Starts a stopped virtual machine.
foo
Boolean — true
if this vm was successfully start (or was not stopped), false
otherwise
curl -X POST --data '{"jsonrpc": "2.0", "method": "vm_start", "params": [], "id": 123}' |
{ "jsonrpc": "2.0", "id": 123, "result": true } |
None
Boolean — true
if this vm was successfully stopped (or was already stopped), false
otherwise
curl -X POST --data '{"jsonrpc": "2.0", "method": "vm_stop", "params": [], "id": 123}' |
{ "jsonrpc": "2.0", "id": 123, "result": true } |
Invoke a serialized continuation and return the result.
HexString — bytes of the serialized continuation
Object — varies depending on the result
Completely fabricated example continuation whose invocation produces the tuple ["Hello, world!", 3]
(a String and a Number).
curl -X POST --data '{"jsonrpc": "2.0", "method": "vm_invoke", "params": ["0xf0cd9d2e1f93028f89e9ff92a2b"], "id": 123}' |
{ "jsonrpc": "2.0", "id": 123, "result": [ "Hello, world!", 3 ] } |
Invoke RBL and return the result.
String — RBL code
Object — varies depending on the result
Invoke "(+ 1 2)" whose invocation produces 3
(a Number).
curl -X POST --data '{"jsonrpc": "2.0", "method": "vm_invoke_rbl", "params": ["(+ 1 2)"], "id": 123}' |
{ "jsonrpc": "2.0", "id": 123, "result": 3 } |
None
Boolean — true
if metrics were started succesfully, false
othewise
curl -X POST --data '{"jsonrpc": "2.0", "method": "vm_metrics_start", "params": [], "id": 123}' |
{ "jsonrpc": "2.0", "id": 123, "result": true } |
None
Boolean — true
if metrics were stopped succesfully, false
othewise
curl -X POST --data '{"jsonrpc": "2.0", "method": "vm_metrics_stop", "params": [], "id": 123}' |
{ "jsonrpc": "2.0", "id": 123, "result": true } |
None
Object
"running"
or "stopped"
true
if metrics are currently being emitted, false
otherwisecurl -X POST --data '{"jsonrpc": "2.0", "method": "comm_status", "params": [], "id": 123}' |
{ "jsonrpc": "2.0", "id": 123, "result": { "status": "running", "send_count": 23452, "recv_count": 99328, "peer_count": 131, "metrics": false } } |
None
Boolean — true
if comms succesfully started, false
otherwise
curl -X POST --data '{"jsonrpc": "2.0", "method": "comm_start", "params": [], "id": 123}' |
{ "jsonrpc": "2.0", "id": 123, "result": true } |
None
Boolean — true
if comms succesfully stopped, false
otherwise
curl -X POST --data '{"jsonrpc": "2.0", "method": "comm_stop", "params": [], "id": 123}' |
{ "jsonrpc": "2.0", "id": 123, "result": true } |
Request a full list of connected peers
None
Object Array of
curl -X POST --data '{"jsonrpc": "2.0", "method": "comm_peers", "params": [], "id": 123}' |
{ "jsonrpc": "2.0", "id": 123, "result": [ { "address": "0f365f1016a54747b384b386b8e85352", "ip": "216.83.154.106", "port": 30012, "last_seen": "2018-01-24T06:04:59" }, { "address": "384b386b8e853520f365f1016a54747b", "ip": "83.143.12.23", "port": 30305, "last_seen": "2018-01-24T06:04:58" }, ... ] } |
This is an extremely heavyweight call which queries peers for their peers, and peers of peers for their peers, and so on, until it has mapped the whole network. Not sure it's feasible, yet.
None
Object Array of
curl -X POST --data '{"jsonrpc": "2.0", "method": "comm_network", "params": [], "id": 123}' |
{ "jsonrpc": "2.0", "id": 123, "result": [ { "address": "0f365f1016a54747b384b386b8e85352", "ip": "216.83.154.106", "connections": [1,2,5,9,...] }, { "address": "384b386b8e853520f365f1016a54747b", "ip": "83.143.12.23", "connections": [1,3,4,15,10...] }, ... ] } |
None
Boolean — true
if metrics were started succesfully, false
othewise
curl -X POST --data '{"jsonrpc": "2.0", "method": "comm_metrics_start", "params": [], "id": 123}' |
{ "jsonrpc": "2.0", "id": 123, "result": true } |
None
Boolean — true
if metrics were stopped succesfully, false
othewise
curl -X POST --data '{"jsonrpc": "2.0", "method": "comm_metrics_stop", "params": [], "id": 123}' |
{ "jsonrpc": "2.0", "id": 123, "result": true } |
None
Object
curl -X POST --data '{"jsonrpc": "2.0", "method": "storage_status", "params": [], "id": 123}' |
{ "jsonrpc": "2.0", "id": 123, "result": { "key_count": 392103, "value_count": 451887, "size": 9328348, ... } } |
Get the data stored at key.
Object
Object
curl -X POST --data '{"jsonrpc": "2.0", "method": "storage_get", "params": { "key": "foo"}, "id": 123}' |
{ "jsonrpc": "2.0", "id": 123, "result": { "value": "0x2098ab9e9" } } |
foo
bar
baz
foo
bar
baz
foo
bar
baz