Creates a transaction from JSON (file).

More detailed information - JSON format of transactions.

Command syntax:

tx_create_json 
-net <net_name> 
-chain <chain_name> 
-json <json_file_path>

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
-chain - the name of Chain. The list of chains can be found in the directory <Config_dir> \ etc \ network \ <network_name> or by the Cellframe-Node-CLI using command - net list chains
-json - path to json file (file.json can be situated in any folder you want)
 

JSON file example:

{
  "items":[
    {
      "type":"in",
      "addr_from":"o9z3wUTSTicckJuovuVc2ZEPyP1so25LXUzfNHNwLZ3vVuJrjU6U3R2TjNeDYBvKFJF8UdJ2N18S4YBmKKAmSPPjC2XFwptedp6pW7fp",
      "token":"tKEL"
    },
    {
        "type":"sign",
        "wallet":"testwal2"
    },
    {
      "type":"out_ext",
      "token":"mtKEL",
      "value":"0.1",
      "addr":"jrmnGqeeds4Dp67AYTxvTFodhToTNafnjrShfvTWCkDBLCF1RPKdG9j2pojg2cTyTM8SqampWb2QtBCnz3K8H9Y7cyxneBBh88CjA5Qu"
    },
    {
      "type":"out_ext",
      "token":"tKEL",
      "value":"0.075",
      "addr":"o9z3wUTSTicckJuoxkLc5q1CwaYs23474GbBm8ebgSZd1WmB7EhkPDpsoZPGX3hmhGa1wCqTDKgPjirbp3H45bg3tc6U5k8wCEJX575X"
    },
    {
      "type":"out_cond",
      "ts_expires":"never",
      "value":"0.05",
      "subtype":"fee",
      "service_id":"0x0000000000000000"
    }
  ]
}

CLI Example

Command:

cellframe-node-cli tx_create_json 
-net foobar 
-chain main 
-json /root/tx.json

Response:

Transaction 0x1CF55991C6B14B30484BCE6B2E0CBFBD4A22D6000AD725213F3E5135E1FDBB95 with 4 items created and added to mempool successfully

JSON-RPC Example

JSON-RPC Request - TX_CREATE_JSON

Creates a transaction from JSON (file).

More detailed information - JSON format of transactions.

Request Structure

JSON object:

{
  "method": "tx_create_json",
  "subcommand": ["tx_create_json"],
  "arguments": {
    "net": "network_name",
    "chain": "chain_name",
    "json": "json_file_path"
  },
  "id": "1"
}

Parameters: net (network_name) - name of the Cellframe Network. The list of networks can be found in the <Config_dir> \ etc \ network folder or received using - Node Command - NET LIST chain - the name of the chain (main or zerochain) json - path to JSON file (file.json can be situated in any folder you want)

JSON file example:

{
  "items":[
    {
      "type":"in",
      "addr_from":"o9z3wUTSTicckJuovuVc2ZEPyP1so25LXUzfNHNwLZ3vVuJrjU6U3R2TjNeDYBvKFJF8UdJ2N18S4YBmKKAmSPPjC2XFwptedp6pW7fp",
      "token":"tKEL"
    },
    {
        "type":"sign",
        "wallet":"testwal2"
    },
    {
      "type":"out_ext",
      "token":"mtKEL",
      "value":"0.1",
      "addr":"jrmnGqeeds4Dp67AYTxvTFodhToTNafnjrShfvTWCkDBLCF1RPKdG9j2pojg2cTyTM8SqampWb2QtBCnz3K8H9Y7cyxneBBh88CjA5Qu"
    },
    {
      "type":"out_ext",
      "token":"tKEL",
      "value":"0.075",
      "addr":"o9z3wUTSTicckJuoxkLc5q1CwaYs23474GbBm8ebgSZd1WmB7EhkPDpsoZPGX3hmhGa1wCqTDKgPjirbp3H45bg3tc6U5k8wCEJX575X"
    },
    {
      "type":"out_cond",
      "ts_expires":"never",
      "value":"0.05",
      "subtype":"fee",
      "service_id":"0x0000000000000000"
    }
  ]
}

Curl Example

Request:

curl --unix-socket /opt/cellframe-node/var/run/node_cli -X POST http://localhost/connect -d '
{
  "method": "tx_create",
  "subcommand": ["tx_create"],
  "arguments": {
    "net": "foobar",
    "chain": "main",
    "json": "/root/tx.json"
  },
  "id": "1"
}'

Response:

{
  "type": 0,
  "result": "Transaction 0xFD56BBE8C7D0983C7DFCA3F7849E38571C30DB8F8E5419D793549FCD5ABD91A7 with 4 items created and added to mempool successfully",
  "id": 1
}
Link to original