Rlay Client JSONRPC methods
Rlay Client
exposes the following JSONRPC methods to interact with the Rlay network.
All RPC methods exposed by rlay-client
are prefixed with rlay_
.
If a RPC method does not match with any of the ones listed here, the RPC request will be proxied through to the RPC connection rlay-client
builds on.
The RPC endpoint is exposed at http://127.0.0.1:8546
by default when running a local development client.
The API is still very much under active development and might change in the future (especially the RPC methods prefixed with
experimental
)
JSONRPC methods
version
getPropositionPools
experimentalGetEntity
experimentalGetEntityCid
experimentalKindForCid
experimentalListCids
experimentalListCidsIndex
experimentalStoreEntity
version
Method name: rlay_version
Returns information about the client and the Rlay network the client is connected to.
Example request
curl --data '{"method":"rlay_version","params":[],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8546
Example response
{
"jsonrpc": "2.0",
"result": {
"clientVersion": "rlay-client/0.2.1",
"contractAddresses": {
"OntologyStorage": "0x8caf5e029445227ec24cc090026a07b1b521e208",
"PropositionLedger": "0x1cc19ac16ca274152a5e57179bd2051c9ad89876",
"RlayToken": "0x28208f2ad2abb7cb82136f1d6234fb0aee8571d2"
},
"networkVersion": "0.3.0"
},
"id": 1
}
getPropositionPools
Method name: rlay_getPropositionPools
Returns all found Proposition Pools and their aggregation results.
Example request
curl --data '{"method":"rlay_getPropositionPools","params":[],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8546
Example response
{
"jsonrpc": "2.0",
"result": [
{
"aggregatedValue": null,
"canonicalNegativeValue": {
"annotations": [],
"cid": "0x019980031b2087f3a0d308bbd8b4c8de783db334bfee4841e85ba88ac495cb0f96aa2ced94cd",
"class": "0x018080031b201751ffb01316ca5f9ad416f097e092fe660805a468c5dcc3d470c4d6b99cf3ad",
"isAggregatedValue": false,
"subject": "0x019680031b20fee449c4e82b7c29595c2e5fb7a72e1cf8d6dd041ec737c778489c3e9963a0c1",
"totalWeight": "0x0",
"type": "NegativeClassAssertion"
},
"canonicalPositiveValue": {
"annotations": [],
"cid": "0x019880031b2087f3a0d308bbd8b4c8de783db334bfee4841e85ba88ac495cb0f96aa2ced94cd",
"class": "0x018080031b201751ffb01316ca5f9ad416f097e092fe660805a468c5dcc3d470c4d6b99cf3ad",
"isAggregatedValue": false,
"subject": "0x019680031b20fee449c4e82b7c29595c2e5fb7a72e1cf8d6dd041ec737c778489c3e9963a0c1",
"totalWeight": "0x0",
"type": "ClassAssertion"
},
"negativeValues": [
{
"annotations": [],
"cid": "0x019980031b2087f3a0d308bbd8b4c8de783db334bfee4841e85ba88ac495cb0f96aa2ced94cd",
"class": "0x018080031b201751ffb01316ca5f9ad416f097e092fe660805a468c5dcc3d470c4d6b99cf3ad",
"isAggregatedValue": false,
"subject": "0x019680031b20fee449c4e82b7c29595c2e5fb7a72e1cf8d6dd041ec737c778489c3e9963a0c1",
"totalWeight": "0x0",
"type": "NegativeClassAssertion"
}
],
"poolType": "Class",
"positiveValues": [
{
"annotations": [],
"cid": "0x019880031b2087f3a0d308bbd8b4c8de783db334bfee4841e85ba88ac495cb0f96aa2ced94cd",
"class": "0x018080031b201751ffb01316ca5f9ad416f097e092fe660805a468c5dcc3d470c4d6b99cf3ad",
"isAggregatedValue": false,
"subject": "0x019680031b20fee449c4e82b7c29595c2e5fb7a72e1cf8d6dd041ec737c778489c3e9963a0c1",
"totalWeight": "0x0",
"type": "ClassAssertion"
}
],
"subject": "0x019680031b20fee449c4e82b7c29595c2e5fb7a72e1cf8d6dd041ec737c778489c3e9963a0c1",
"subjectProperty": [
"0x019680031b20fee449c4e82b7c29595c2e5fb7a72e1cf8d6dd041ec737c778489c3e9963a0c1"
],
"totalWeight": "0x0",
"totalWeightAggregationResult": null,
"totalWeightNegative": "0x0",
"totalWeightPositive": "0x0",
"values": [
{
"annotations": [],
"cid": "0x019880031b2087f3a0d308bbd8b4c8de783db334bfee4841e85ba88ac495cb0f96aa2ced94cd",
"class": "0x018080031b201751ffb01316ca5f9ad416f097e092fe660805a468c5dcc3d470c4d6b99cf3ad",
"isAggregatedValue": false,
"subject": "0x019680031b20fee449c4e82b7c29595c2e5fb7a72e1cf8d6dd041ec737c778489c3e9963a0c1",
"totalWeight": "0x0",
"type": "ClassAssertion"
},
{
"annotations": [],
"cid": "0x019980031b2087f3a0d308bbd8b4c8de783db334bfee4841e85ba88ac495cb0f96aa2ced94cd",
"class": "0x018080031b201751ffb01316ca5f9ad416f097e092fe660805a468c5dcc3d470c4d6b99cf3ad",
"isAggregatedValue": false,
"subject": "0x019680031b20fee449c4e82b7c29595c2e5fb7a72e1cf8d6dd041ec737c778489c3e9963a0c1",
"totalWeight": "0x0",
"type": "NegativeClassAssertion"
}
]
}
],
"id": 1
}
experimentalGetEntity
Method name: rlay_experimentalGetEntity
Retrieves a single entity via its CID.
Params
Expects a single hex formated CID of the entity to be retrieved.
Example request
curl --data '{"method":"rlay_experimentalGetEntity","params":["0x019580031b209f3c8eca54a8e3d79945050fd88daf62b9c99bfe0b579af8a0391c0b21a9fbef"],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8546
Example response
{
"jsonrpc": "2.0",
"result": {
"annotations": [],
"cid": "0x019580031b209f3c8eca54a8e3d79945050fd88daf62b9c99bfe0b579af8a0391c0b21a9fbef",
"property": "0x019780031b20b3179194677268c88cfd1644c6a1e100729465b42846a2bf7f0bddcd07e300a9",
"type": "Annotation",
"value": "0x67636f6d6d656e74"
},
"id": 1
}
experimentalGetEntityCid
Method name: rlay_experimentalGetEntityCid
Calculates the CID for a Rlay Ontology entity. This can be used together with experimentalGetEntity to check if an entity is already stored on the network.
Params
Expects a single JSON object as a parameter. The object needs to be deserializable into a Rlay Ontology entity.
Example request
curl --data '{"method":"rlay_experimentalGetEntityCid","params":[{"type": "Class", "annotations": ["0x121212"]}],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8546
Example response
{
"jsonrpc": "2.0",
"result": "0x018080031b20f324c606bc5ea63f747790d24da82d51fc50fca6a01091d4e4b80a9890821bf4",
"id": 1
}
experimentalKindForCid
Method name: rlay_experimentalKindForCid
Returns the entity kind for a CID provided. Will return null
if entity kind for the provided CID is not known
Caveat: Currently only works if the provided CID is stored on the network.
Params
Expects a single hex formated CID as a parameter.
Example request
curl --data '{"method":"rlay_experimentalKindForCid","params":["0x019780031b20b3179194677268c88cfd1644c6a1e100729465b42846a2bf7f0bddcd07e300a9"],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8546
Example response
{
"jsonrpc": "2.0",
"result": {
"cid": "0x019780031b20b3179194677268c88cfd1644c6a1e100729465b42846a2bf7f0bddcd07e300a9",
"kind": "AnnotationProperty"
},
"id": 1
}
experimentalListCids
Method name: rlay_experimentalListCids
Returns all stored CIDs (of a certain entity kind).
Params
Expects one optional parameter, a entity kind. If the parameter is provided, only CIDs where the entity is of that entity kind will be returned.
Example request
curl --data '{"method":"rlay_experimentalListCids","params":["Annotation"],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8546
Example response
{
"jsonrpc": "2.0",
"result": [
"0x019580031b205e9fccf1de0d5069cf3c5d19c6d4d179e874052218d9bfb36d091042dff7d7e9",
"0x019580031b209f3c8eca54a8e3d79945050fd88daf62b9c99bfe0b579af8a0391c0b21a9fbef",
"0x019580031b20a58bfc31c872d299829ea90ed0931c37834aed816f6cb36116e9fca36f455ce3",
"0x019580031b20c130442a0e8e52e3bb368db3d08af4c738af8208c60ca59d1536809cd6bb165e"
],
"id": 1
}
experimentalListCidsIndex
? @TODO
Example Usage:
experimentalStoreEntity
Method name: rlay_experimentalStoreEntity
Store a entity in the backend. Returns the CID of the stored entity.
Params
- First parameter: A object deserializable into a Rlay Ontology entity
- Second parameter: A options object.
- "backend": The backend to use for storing
Example request
curl --data '{"method":"rlay_experimentalStoreEntity","params":[{ "type": "Annotation", "property": "0x019780031b20b3179194677268c88cfd1644c6a1e100729465b42846a2bf7f0bddcd07e300a9", "value": "0x656c6162656c" }, {"backend": "myneo4j"}],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8546
Example response
{"jsonrpc":"2.0","result":"0x019580031b20567c6c54ad4525f1529268a90c0633377596697338a48d36624f180f73b46959","id":1}