You can remotely interact with the Cellframe Node via the JSON RPC.
JSON-RPC (JSON Remote Procedure Call) is a web based protocol for remote requests which uses JSON for messages encoding.
We use HTTP POST requests with JSON payload to communicate with node. For example, curl can handle this task.
Request Structure
Request on the RPC-Node
Linux OS:
curl
-X POST http://rpc.cellframe.net -H "Content-Type: application/json"
-d '{"method":"method_name", "subcommand":"subcommand_name", "arguments":{"arg_name":"value"}, "id":"1"}'
- -X HTTP method which is used to send request, where
http://rpc.cellframe.net
is an address of the remote public node. - -d (data) is JSON object describing desired command and its parameters.
- JSON object body:
method - parameter which means that this json body contains a command
method_name - a name of the command
subcommand - parameter which means that specified command has a subcommand
subcommand_name - a name of the subcommand
arguments - this parameter points on there must be command arguments specified next
arg_name - name of the parameter
value - a corresponding value (if an argument doesn't have a value, then its value must be specified as `null`)
Windows OS:
Invoke-WebRequest
-Uri http://rpc.cellframe.net/connect
-Method POST
-Body '{"method":"method_name", "subcommand":"subcommand_name", "arguments":{"arg_name":"value"}, "id":"1"}'
Available request groups:
- HELP
- WALLET
- NET
- TX_HISTORY
- MEMPOOL
- SRV_XCHANGE
- STAKE_LOCK
- NET_SRV
- TX_CREATE_JSON
Local Node Request
Linux OS:
curl -s --unix-socket /opt/cellframe-node/var/run/node_cli
-X POST http://localhost/connect
-d'{"method":"method_name", "subcommand":"subcommand_name", "arguments":{"arg_name":"value"}, "id":"1"}'
List of available requests - JSON-RPC Requests
JSON Format for transactions
Transactions in Cellframe networks can be represented in JSON format. The full description of the transaction structure and how to convert it to JSON format is below:
Request Example
In this example we will check all free outputs in the specified wallet using remote node.
Request example:
curl -X POST http://rpc.cellframe.net/connect
-d '{"method":"wallet", "subcommand":"outputs", "arguments":{"net":"KelVPN","w":"WL2","token":"KEL","value":"0.01e+18"}, "id":"1"}'
Options:
-net - name of the Cellframe Network
-token - name of the token
-addr/-w - wallet address or wallet name
-value - show outputs which are not lower than "value" (optional). Must not be less than the amount of the transfer and all fees
Response:
{
"type": 0,
"result": "total_value: 1000000000000000000
outs:
item_type: unspent_out
value: 1000000000000000000
prev_hash: 0x9298FD0655D8C6B3D735EFCE6BE7E80F0503FBC6F37B75CF14E0225E4460E13E
out_prev_idx: 0",
"errors": null,
"id": 1
}
Sign Transactions Remotely
You can create transaction from JSON file using the following command:
Some transaction signing procedures can also be performed remotely using the Cellframe Tool Sign utility. This is currently only available for Linux OS users.
Download link - https://pub.cellframe.net/linux/cellframe-tool-sign/main/cellframe-tool-sign
Below is a link to a manual on signing fund transfer transactions along with creating a transaction json file locally.