Commands for interaction with TRANSACTIONS:

Node Command - TX_HISTORY

Shows transactions history for address, wallet or transaction by hash

CLI Example

Command syntax:

tx_history  
{-addr <addr> | -w <wallet_name> | -tx <tx_hash>} 
[-net <net_name>] 
[-chain <chain_name>]
[-limit] 
[-offset]
[-head]
[-tail]
 

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 (optional)
-addr/-w/-tx - shows information using address hash, hash of the wallet or transaction hash (optional)
-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 (optional)
-limit - number of elements being printed (optional)
-offset - number of the element from which printing will be started (optional)
-head - shows transactions list starting from the first one (optional)
-tail - shows transactions list startinf from the last one (optional)

Example:

Command:

cellframe-node-cli tx_history 
-tx   0xF9BCFF36A5C2B8FF9889CB3F133ED0487E21684AA88AA9FB887C2CDA4699933B 
-net Backbone 
-chain main 

Response:

            status: ACCEPTED
            atom_hash: 0x1B2AE588B9740D68352876AF4A2154EEF4AF2BB0E646DD01ECC6B77EC8964008
            hash: 0xF9BCFF36A5C2B8FF9889CB3F133ED0487E21684AA88AA9FB887C2CDA4699933B
            token_ticker: CELL
            ret_code: 0
            ret_code_str: DAP_LEDGER_TX_CHECK_OK
            tx_created: Thu Jan 25 16:52:47 2024
            items:
            type: TX_ITEM_TYPE_IN
            data:
                       prev_idx: 0
                       prev_hash: 0x5B595F08B4D4A008C6E7ABC547A003232535C8BDBD2077D5083BFAA745A8575F
 ...
"-brief parameter removes information below" 
            type: TX_ITEM_TYPE_SIG
            data:
                       sign_size: 3306
                       sign:
                       type: sig_dil
                       pkeyHash: 0x0E08E575A5142FBFEA5E61DA7266402DADD9D033F05D5B2EF0E1AEE1F11C8FAA
                       signPkeySize: 1196
                       signSize: 2096

JSON-RPC Example

Command:

curl -X POST http://rpc.cellframe.net/connect -d '{"method":"tx_history", "params":["tx_history;-tx;0xF9BCFF36A5C2B8FF9889CB3F133ED0487E21684AA88AA9FB887C2CDA4699933B;-net;Backbone;-chain;main"], "id":"1"}'

Response:


"type": 2,
"result": "same as cli response",
"errors": null,
"id": 1	
}
Link to original

Node Command - TX_ALL_HISTORY

Shows all transactions history for specified network (for specified chain)

CLI Example

Command syntax:

tx_history 
-all 
-net <net_name> 
[-chain <chain_name>]
[-limit]
[-offset]
[-head]
[-tail]
 

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
-all - means all transactions
-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 (optional)
-limit - number of elements being printed (optional)
-offset - number of the element from which printing will be started (optional)
-head - shows transactions list starting from the first one (optional)
-tail - shows transactions list startinf from the last one (optional)
 

Example:

Command:

cellframe-node-cli tx_history 
-all 
-net foobar 

Response:

                    status: ACCEPTED
            hash: 0xDB800118C3521C954D3B641FEC6FE92797C926A0B832003D9FF682E2E60C775C
            token_ticker: BUZ
            ret_code: 0
            ret_code_str: DAP_LEDGER_TX_CHECK_OK
            tx_created: Fri Feb  2 10:42:21 2024
            items:
                       type: TX_ITEM_TYPE_IN_EMS
                       data:
                       ticker: BUZ
                       chain_id: 0
                       emission_hash: 0x9DA6B739524D0A2D43483CAA716D761BA81C22641D27CB51FADFD11B5D865F96
                       type: TX_ITEM_TYPE_OUT_COND
                       data:
                       ts_expires: never
                       subtype: DAP_CHAIN_TX_OUT_COND_SUBTYPE_FEE
                       value: 5.0
                       value_datoshi: 5000000000000000000
                       uid: 0x0000000000000000
                       type: TX_ITEM_TYPE_OUT
                       data:
                       value: 9999999999999999999999999999999999995.0
                       value_datoshi: 9999999999999999999999999999999999995000000000000000000

            ...

          
                       addr: ptV4n68gTebdUTcbpBuQWBcLBL5Y17NnXUrt15RtDaYiAQqHthDfijE9kM512Dgz6jypxifLc6iLEvC1buAtw7hF2pphvPHoGQkEmFSb
                       token: BUZ
                       type: TX_ITEM_TYPE_SIG
                       data:
                       sign_size: 3306
                       sign:
                       type: sig_dil
                       pkeyHash: 0xE7B586257FBF09C3CC99D17099B4BC18F9B398188E4D365107F030831178C6F3
                       signPkeySize: 1196
                       signSize: 2096

Chain main in network foobar contains 4 transactions.
Of which 4 were accepted into the ledger and 0 were rejected.

JSON-RPC Example

Command:

curl -X POST http://rpc.cellframe.net/connect -d '{"method":"tx_history", "params":["tx_history;-all;-net;foobar"], "id":"1"}'

Response:


"type": 2,
"result": "same as cli response",
"errors": null,
"id": 1	
}
Link to original

Node Command - TX_VERIFY

Checks if transaction is correct (in the mempool)

CLI Example

Command syntax:

tx_verify 
-net <net_name> 
-chain <chain_name> 
-tx <tx_hash>

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
-tx - hash of the transaction
 

Example:

Command:

cellframe-node-cli tx_verify 
-net mileena 
-chain main 
-tx 0x903CA4A3EAB0479CC0D46D8856DE377072E7ACA14364BE804374ED26CE1F8FAF

Response:

 Specified tx verify fail with return code=2

JSON-RPC Example

Command:

curl -X POST http://rpc.cellframe.net/connect -d '{"method":"tx_verify", "params":["tx_verify;-net;foobar;-chain;main;-tx;0x8A766B43EF8A18D1F6F86F19636D6EDEFD504EFD7BC03226DA07D2CF95A098C0"], "id":"1"}'

Response:


"type": 2,
"result": "same as cli response",
"errors": null,
"id": 1	
}
Link to original

Node Command - TX_COND_CREATE

Creates conditional transaction

CLI Example

Command syntax:

tx_cond_create 
-net <net_name> 
-token <token_ticker> 
-w <wallet_name> 
-cert <pub_cert_name> 
-value <value_datoshi> 
-fee <value> 
-unit { b | sec } 
-srv_uid <numeric_uid>

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
-token - kind of tocken
-w - name of the wallet
-cert - name of public certificate
-value - cost of transaction in datoshi
-fee - commission for creating transaction
-unit - measure unit: values - b (bytes) \ sec (seconds)
-srv_uid - UID of the service
 

Example:

Command:

cellframe-node-cli tx_cond_create 
-net foobar 
-token BUZ 
-w foobar_root_0 
-cert certname 
-value 5.0e+18 
-fee 0.1e+18 
-unit sec 
-srv_uid 1

Response:

 256bit TX created succefully, hash=0xB3D9052F434CD56A79869138E23BC77331C6CFBCD74E9D49CF4CED2DAF8B905AConditional

JSON-RPC Example

Command:

curl -X POST http://rpc.cellframe.net/connect -d '{"method":"tx_cond_create", "params":["tx_cond_create;-net;foobar;-token;BUZ;-w;foobar_root_0;-cert;certname;-value;5.0e+18;-fee;0.1e+18;-unit;sec;-srv_uid;1"], "id":"1"}'

Response:


"type": 0,
"result": "0x8A766B43EF8A18D1F6F86F19636D6EDEFD504EFD7BC03226DA07D2CF95A098C0Conditional 256bit TX created succefully, hash=\n",
"errors": null,
"id": 1
}
Link to original

Node Command - TX_CREATE

Creates transaction

CLI Example

Command syntax:

tx_create -net <net_name> 
-chain <chain_name> 
-token <token_ticker> 
-to_addr <addr>
-value <value> 
{-from_wallet <wallet_name> | -from_emission <emission_hash> {-cert <cert_name> | -wallet_fee <wallet_name>}} 
-fee <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
-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
-token - type of tocken
-to_addr - address of the receiving wallet (can be multiple)
-value - amount of datoshi user wants to send (can be multiple and written corresponding to wallet addresses)
-from_wallet/from_emission - name of wallet/hash of the emission which is used to send tokens
-cert - certificate which allows to use emission
-wallet_fee - wallet which is used to pay commission if native tokens were used
-fee - validator's commission (not lower than minimum comission in chain)
 
 

Example:

Command:

cellframe-node-cli tx_create 
-net foobar 
-chain main 
-value 1000.0e+18 
-token BUZ 
-to_addr ptV4n68gTebdUTcbozov2BjMQBFhKKkwdrbiU7cL2Sn8GGsKH6ef5AD39mH363M5sCVAHnBUNoyGLSfyBb6dz172KrcTgzBAydvw1PMZ 
-from_wallet foobar_root_0 
-fee 1.0e+18

Response:

transfer=Ok

tx_hash=0x476132A194AC1C74738093994DF9744EEC62843B8B2F1AC148ED66E2FC72E409

JSON-RPC Example

Command:

curl -X POST http://rpc.cellframe.net/connect -d '{"method":"tx_create", "params":["tx_create;-net;foobar;-chain;main;-value;1000.0e+18;-token;BUZ;-to_addr;ptV4n68gTebdUTcbozov2BjMQBFhKKkwdrbiU7cL2Sn8GGsKH6ef5AD39mH363M5sCVAHnBUNoyGLSfyBb6dz172KrcTgzBAydvw1PMZ;-from_wallet;foobar_root_0;-fee;1.0e+18"], "id":"1"}'

Response:


"type": 0,
"result": "transfer=Ok\ntx_hash=0x56CD2CD2B70B1FF698219E4A7E9B1744336CFD6338E8901E248836598E0D8823\n",
"errors": null,
"id": 1
}
Link to original

Node Command - TX_CREATE_JSON

Creates transaction from JSON file

CLI Example

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:

{
    "chain": "main",
    "items": [
        {
            "addr_from": "Rj7J7MiX2bWy8sNybTStGPaBEJLjxMnyXJinDezXE8D5LGUmkQZSPfXHATXePY9PXi5qWo4NLRUWu89AjQ5QmEWCH1C9H7zYqceKHrTF",
            "token": "CELL",
            "type": "in"
        },
        {
            "addr": "Rj7J7MiX2bWy8sNya4sPJaQsAqhULtVZi51JFSpXKKx7B5JDjbGtXPjN943iLFJuaHe3PukbBWzUM5VSo6HQZ6DkLUvnKUQVQVjLAnum",
            "type": "out",
            "value": "1000000000000000000"
        },
        {
            "type": "sign",
            "wallet": "testwallet"
        },
        {
            "subtype": "fee",
            "type": "out_cond",
            "value": "500000000000000000"
        }
    ],
    "net": "Backbone"
}

JSON-file template:

{
    "chain": "name of the chain (main or zero)",
    "items": [
        {
            "type": "" ,
            "addr_from": "",
            "token": ""
        },
        {
            "type": "",
            "addr": "",
            "value": ""
        },
        {
            "type": "",
            "wallet": ""
        },
        {
            "type": "",
            "subtype": "",
            "value": ""
        }
    ],
    "net": "Name of the network"
}

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

Command:

curl -X POST http://rpc.cellframe.net/connect  -d '{"method":"tx_create_json", "params":["tx_create_json;-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", "errors": null,
"id": 1
}
Link to original