You can remotely interact with the Cellframe Node via the JSON RPC.
- **[[1. Introduction#JSON format for transactions|JSON Format for Transactions]]**
- **[[1. Introduction#Request Example|Request Example]]**
- **[[1. Introduction#Sign transactions remotely|Sign Transactions Remotely]]**
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.
- **[[2. JSON-RPC Requests|List of JSON-RPC Requests]]**
## Request Structure
### Request on the RPC-Node
`Linux OS:`
```bash
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:
```powershell
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:`
```bash
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:`
```bash
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 - **[[2. JSON-RPC 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:
**[[3. JSON Format of Transactions| JSON Format of Transactions]]**
## Request Example
In this example we will check all free outputs in the specified wallet using remote node.
`Request example:`
```bash
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:`
```powershell
-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:`
```json
{
"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:
**[[Node Command - TX_CREATE_JSON]]**
Some transaction signing procedures can also be performed remotely using the [[4. Cellframe Tool Sign|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.
**[[Sign Transaction Manual]]**