This manual is designed to help you sign transactions remotely using cellframe-tool-sign.

Attention

For now, tool functions only on the Linux OS

Download utility - https://pub.cellframe.net/linux/cellframe-tool-sign/main/cellframe-tool-sign

Steps:

  1. Check wallet free outputs

  2. Create JSON transaction

  3. Sign JSON using cellframe-tool-sign

  4. Send signed JSON to the remote node

  5. Use this command to retrieve all free outputs from the indicated wallet.

Command syntax:

wallet outputs {-addr <addr> | -w <wallet_name>} -net <net_name> -token <token_tiker> [-value <uint256_value>]

Options:

-net - name of the Cellframe Network. The list of networks can be found in the <Config_dir> \ etc \ network folder or received by The Cellframe-Node-CLI using command - net list
-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

Request example:

curl -X POST http://rpc.cellframe.net/connect 
-d '{"method":"wallet", "params":["wallet;outputs;-net;KelVPN;-w;WL2;-token;KEL;-value;0.01e+18"], "id":"1"}'

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 
}

Example of calculating change:

X - value to send
X' - sum, of input values
net_fee - network fee
fee - desired value of validators fee

Change = X' - (X + net_fee + fee)

Attention

‘Change’ is specified as a separate item with type “out” and “addr” must match the sender’s wallet address

  1. Create JSON file with transaction parameters tx.json.

Input items should be augmented with hashes and output indexes from the previous item.

Output items should specify the destination and amount of the transfer. Output composition:

  1. The transfer amount itself,
  2. Change (if any),
  3. Network fee (if any),
  4. Conditional validator fee output.

Change should be calculated manually. The sum of inputs will be obtained in the previous step.

There are author comments after ”#” char in the JSON.

Attention

When forming a transaction, all received outputs must be specified in the corresponding inputs, i.e. in their blocks with ‘type’ == ‘in’

JSON example:

{
    "items": [
        {
            "type": "in",
            "prev_hash": "0x76963A4DFD2CA586A06EF0753020AD920CBE9E40FA9B7A51A1BB16F0B78B9EF1",
            "out_prev_idx": 1 #change these index and hash according to the previous step
        },
        {
            "type": "out", #the very transfer
            "value": "5000000000000000000",
            "addr": "o9z3wUTSTicckJuoxBh2u7xECZn1NT4kzbUd8YhNiPCmEH6tv9bRX5EoZTuhDA5fvttYgCFb73qGeH2FTicrVXrF1Z1YpECDkmmB7avQ"
        },
        {
            "type": "out", #change (if any)
            "value": "999999999999898889930000000000000000",
            "addr": "o9z3wUTSTicckJuovuVc2ZEPyP1so25LXUzfNHNwLZ3vVuJrjU6U3R2TjNeDYBvKFJF8UdJ2N18S4YBmKKAmSPPjC2XFwptedp6pW7fp"
        },
        {
            "type": "out", #network fee (if any)
            "value": "2500000000000000",
            "addr": "o9z3wUTSTicckJuoxkLc5q1CwaYs23474GbBm8ebgSZd1WmB7EhkPDpsoZPGX3hmhGa1wCqTDKgPjirbp3H45bg3tc6U5k8wCEJX575X"
        },
        {
            "type": "out_cond", #conditional out for validator fee
            "ts_expires": "never",
            "value": "1990000000000000000",
            "service_id": "0x0000000000000000",
            "subtype": "fee"
        }
	]
}
  1. Subsequently, we sign the obtained transaction using the cellframe-tool-sign utility.

Command syntax:

cellframe-tool-sign -w <wallet_name> -p <password> -f <file_in> -o <file_out>

Options:

-w - name of the wallet from which payment is being proceeded
-p - wallet password (if any)
-f - path of the json file from the previous step
-o - path, where signed file will be put

Attention

It is necessary to sign the transaction with the wallet from which the funds are sent.

Example JSON after signing:

{
    "items": [
        {
            "type": "in",
            "prev_hash": "0x76963A4DFD2CA586A06EF0753020AD920CBE9E40FA9B7A51A1BB16F0B78B9EF1",
            "out_prev_idx": 1
        },
        {
            "type": "out",
            "value": "5000000000000000000",
            "addr": "o9z3wUTSTicckJuoxBh2u7xECZn1NT4kzbUd8YhNiPCmEH6tv9bRX5EoZTuhDA5fvttYgCFb73qGeH2FTicrVXrF1Z1YpECDkmmB7avQ"
        },
        {
            "type": "out",
            "value": "999999999999898889930000000000000000",
            "addr": "o9z3wUTSTicckJuovuVc2ZEPyP1so25LXUzfNHNwLZ3vVuJrjU6U3R2TjNeDYBvKFJF8UdJ2N18S4YBmKKAmSPPjC2XFwptedp6pW7fp"
        },
        {
            "type": "out",
            "value": "2500000000000000",
            "addr": "o9z3wUTSTicckJuoxkLc5q1CwaYs23474GbBm8ebgSZd1WmB7EhkPDpsoZPGX3hmhGa1wCqTDKgPjirbp3H45bg3tc6U5k8wCEJX575X"
        },
        {
            "type": "out_cond",
            "ts_expires": "never",
            "value": "1990000000000000000",
            "service_id": "0x0000000000000000",
            "subtype": "fee"
        },
        {
            "type": "sign",
            "sig_type": "sig_dil",
            "pub_key_size": 1196,
            "sig_size": 2096,
            "hash_type": 1,
            "pub_key_b64": "rAQAAAAAAAABAAAAkuZUpd0h39QBuKG26XERA960qw8U3sZy...",#long value
            "sig_b64": "MAgAAAAAAAABAAAAHAgAAAAAAACR0T8vI1xcEA5aYSf2zaEui..." #long value
        }
    ],
    "timestamp": 1732549932,
    "datum_type": "tx"
}
  1. Command which allows to send file to the cellframe node.

For the local node:

-X POST http://localhost/connect 
-d '{"method":"tx_create_json", "params":["tx_create_json;-net;riemann;-chain;main;-json;/root/tx.json"], "id":"1"}'

Attention

When passing a json structure as a string, make sure the " character is escaped.

For the remote node:

-X POST http://rpc.cellframe.net/connect 
-d '{"method":"tx_create_json", "params":["tx_create_json;-net;riemann;-chain;main;-json_str;{\"items\":[{\"type\":\"in\",\"prev_hash\":\"0x76963A4DFD2CA586A06EF0753020AD920CBE9E40FA9B7A51A1BB16F0B78B9EF1\",\"out_prev_idx\":1},{\"type\":\"out\",\"value\":\"5000000000000000000\",\"addr\":\"o9z3wUTSTicckJuoxBh2u7xECZn1NT4kzbUd8YhNiPCmEH6tv9bRX5EoZTuhDA5fvttYgCFb73qGeH2FTicrVXrF1Z1YpECDkmmB7avQ\"},{\"type\":\"out\",\"value\":\"999999999999898889930000000000000000\",\"addr\":\"o9z3wUTSTicckJuovuVc2ZEPyP1so25LXUzfNHNwLZ3vVuJrjU6U3R2TjNeDYBvKFJF8UdJ2N18S4YBmKKAmSPPjC2XFwptedp6pW7fp\"},{\"type\":\"out\",\"value\":\"2500000000000000\",\"addr\":\"o9z3wUTSTicckJuoxkLc5q1CwaYs23474GbBm8ebgSZd1WmB7EhkPDpsoZPGX3hmhGa1wCqTDKgPjirbp3H45bg3tc6U5k8wCEJX575X\"},{\"type\":\"out_cond\",\"ts_expires\":\"never\",\"value\":\"1990000000000000000\",\"service_id\":\"0x0000000000000000\",\"subtype\":\"fee\"},{\"type\":\"sign\",\"sig_type\":\"sig_dil\",\"pub_key_size\":1196,\"sig_size\":2096,\"hash_type\":1,\"pub_key_b64\":\"rAQAAAAAAAABAAAAku ...cut... JdBE=\",\"sig_b64\":\"MAgAAAAAAAABAAAAHAg ...cut... nMphMDA74=\"}],\"timestamp\":1732550006,\"datum_type\":\"tx\"}"], "id":"1"}'

Response:

{ "type": 2, "result": [ { "tx_create": true, "hash": "0x24EC7BA4777B8A8CD65C7EADF8BF4BFC1F74FB29748B0359EFA6EDA10EDD0EA4", "total_items": 6 } ], "id": 1 }