Skip to content

Daemon RPC

Igor Grkavac edited this page Apr 22, 2021 · 1 revision

Safex Daemon RPC Documentation

This is a list of the safex daemon(safexd) RPC calls, their inputs and outputs, and examples of each. There are 3 types of RPC calls used: JSON, Protobuf and custom interface.

Note: Safex blockchain has two currency allowed within. Safex Cash (Safex) and Safex Token (SFT). Safex Cash is divisible up to 10 decimal places. Every value is rendered in atomic units. Atomic unit refer to smallest fraction of 1 Safex coin.

NOTE2: Safex Tokens are not divisible but value is still expressed in atomic units.

Index of JSON RPC Methods:

Protobuf RPC methods:

Other RPC methods:


get_block_count

Look up how many blocks are in the longest chain known to the node.

Alias: getblockcount.

Inputs: None.

Outputs:

  • count - unsigned int; Number of blocks in longest chain seen by the node.
  • status - string; General RPC error code. "OK" means everything looks good.

Example:

$ curl http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block_count"}' -H 'Content-Type: application/json'  

{
"id": "0",
"jsonrpc": "2.0",
"result": {
"count": 993163,
"status": "OK"
}
}


on_get_block_hash

Look up a block's hash by its height.

Alias: on_getblockhash.

Inputs:

  • block height (int array of length 1)

Outputs:

  • block hash (string)

Example:

$ curl http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"on_get_block_hash","params":[1000]}' -H 'Content-Type: application/json'

{ "id": "0", "jsonrpc": "2.0", "result": "83ae6093f372081aa353b134b8274b321fd22bc6053ab6f7ce491419490f80c6" }


get_block_template

Get a block template on which mining a new block.

Alias: getblocktemplate.

Inputs:

  • wallet_address - string; Address of wallet to receive coinbase transactions if block is successfully mined.
  • reserve_size - unsigned int; Reserve size.

Outputs:

  • blocktemplate_blob - string; Blob on which to try to mine a new block.
  • blockhashing_blob - string; Blob on which to try to find a valid nonce.
  • difficulty - unsigned int; Difficulty of next block.
  • expected_reward - unsigned int; Coinbase reward expected to be received if block is successfully mined.
  • height - unsigned int; Height on which to mine.
  • prev_hash - string; Hash of the most recent block on which to mine the next block.
  • reserved_offset - unsigned int; Reserved offset.
  • status - string; General RPC error code. "OK" means everything looks good.
  • untrusted - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).
  • seed_hash - string; RandomX seed hash
  • next_seed_hash - string; RandomX next seed hash

Example:

$ curl http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block_template","params":{"wallet_address":"44GBHzv6ZyQdJkjqZje6KLZ3xSyN1hBSFAnLP6EAqJtCRVzMzZmeXTC2AHKDS9aEDTRKmo6a6o9r9j86pYfhCWDkKjbtcns","reserve_size":60}' -H 'Content-Type: application/json'

{ "id": "0", "jsonrpc": "2.0", "result": { "blockhashing_blob": "070786a498d705f8dc58791266179087907a2ff4cd883615216749b97d2f12173171c725a6f84a00000000fc751ea4a94c2f840751eaa36138eee66dda15ef554e7d6594395827994e31da10", "blocktemplate_blob": "070786a498d705f8dc58791266179087907a2ff4cd883615216749b97d2f12173171c725a6f84a0000000002aeab5f01fff2aa5f01e0a9d0f2f08a01028fdb3d5b5a2c363d36ea17a4add99a23a3ec7935b4c3e1e0364fcc4295c7a2ef5f01f912b15f5d17c1539d4722f79d8856d8654c5af87f54cfb3a4ff7f6b512b2a08023c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f1755090c809421d69873c161e7969b8bf33cee3b451dd4859bfc244a705f0b4900498f804b6023e13fa023a0fb759e8b7c9a39506a21442bc47077beeedc6b78d34c4ebdae91bd96097ccc9a882bc5056568b0d2f1f06559368fea4acba8e745444e883e53156d5083c1fd260edf05292934c8b40c098b81fe4e261720bdd272b209e317247a1d2c55dc4718891af0d16273c5a610f36f382a3bf50f54808aaa6a508e51d4601dd0d8fbf8b3b1685066ce121666a1409e8ac7a4d673c1cc36d10b825f764af647441f53230518e4d2efbcf8791c6060912c76e90db4982a66d51bbd96290bbb34db8080b216c2940cec407260bf5e2c3a5ee280835f15298f0801e9d98c4d414792282fbc2c28c3e20bc0fcb1829b5c3ad8f8d20847be8fdb2a949fd96f0205fbd6d271c880c5d8c83e9813606cd803a44d377fdeae45bfa67112132af601e9b3b0613ba7dff2ec3d4b935c447b47bfe39f7b950981b2f4c66c0d853e2218f1f69229a9b608c3d98be09b6d4d640a9f6ff0e920dbacf7e58b59554c0b398b1ae4b1d497104b4e4e745d850eed7eddb8aa93437427bf442ae5beb22cbf10a8fa738ea38cfa5d86dfd30675d4be11a38016e36936fd5601e52643e8b8bc433702ea7ae6149309c95b898cc854850e73fe0b95c5b8879b7325ecd4", "difficulty": 61043624293, "expected_reward": 4771949057248, "height": 1561970, "prev_hash": "f8dc58791266179087907a2ff4cd883615216749b97d2f12173171c725a6f84a", "reserved_offset": 129, "status": "OK", "untrusted": false } }


submit_block

Submit a mined block to the network.

Alias: submitblock.

Inputs:

  • Block blob data - array of strings; list of block blobs which have been mined. See get_block_template to get a blob on which to mine.

Outputs:

  • status - string; Block submit status.

In this example, a block blob which has not been mined is submitted:

$ curl http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"submit_block","params":["0707e6bdfedc053771512f1bc27c62731ae9e8f2443db64ce742f4e57f5cf8d393de28551e441a0000000002fb830a01ffbf830a018cfe88bee283060274c0aae2ef5730e680308d9c00b6da59187ad0352efe3c71d36eeeb28782f29f2501bd56b952c3ddc3e350c2631d3a5086cac172c56893831228b17de296ff4669de020200000000"]' -H 'Content-Type: application/json'

{ "id": "0", "jsonrpc": "2.0", "error": { "code": -7, "message": "Block not accepted" } }


get_last_block_header

Block header information for the most recent block is easily retrieved with this method. No inputs are needed.

Alias: getlastblockheader.

Inputs: None.

Outputs:

  • block_header - A structure containing block header information.
    • block_size - unsigned int; The block size in bytes.
    • depth - unsigned int; The number of blocks succeeding this block on the blockchain. A larger number means an older block.
    • difficulty - unsigned int; The strength of the Safex network based on mining power.
    • hash - string; The hash of this block.
    • height - unsigned int; The number of blocks preceding this block on the blockchain.
    • major_version - unsigned int; The major version of the Safex protocol at this block height.
    • minor_version - unsigned int; The minor version of the Safex protocol at this block height.
    • nonce - unsigned int; a cryptographic random one-time number used in mining a block.
    • num_txes - unsigned int; Number of transactions in the block, not counting the coinbase tx.
    • orphan_status - boolean; Usually false. If true, this block is not part of the longest chain.
    • prev_hash - string; The hash of the block immediately preceding this block in the chain.
    • reward - unsigned int; The amount of new atomic unitsgenerated in this block and rewarded to the miner.
    • timestamp - unsigned int; The unix time at which the block was recorded into the blockchain.
  • status - string; General RPC error code. "OK" means everything looks good.
  • untrusted - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

In this example, the most recent block (1562023 at the time) is returned:

$ curl http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_last_block_header"}' -H 'Content-Type: application/json'

{ "id": "0", "jsonrpc": "2.0", "result": { "block_header": { "block_size": 103, "depth": 0, "difficulty": 2777559569, "hash": "4e50d76a0765acf6ab6e0fcbc41fd21be4ff0d32793f56829619ea6e917ba3fc", "height": 660361, "major_version": 7, "minor_version": 7, "nonce": 1906564, "num_txes": 0, "orphan_status": false, "prev_hash": "c3033e59450505a21e5ea14baf2e433f459eae1f7d679661b93e8b996f579f61", "reward": 2000000000000, "timestamp": 1615998304 }, "status": "OK", "untrusted": false } }


get_block_header_by_hash

Block header information can be retrieved using either a block's hash or height. This method includes a block's hash as an input parameter to retrieve basic information about the block.

Alias: getblockheaderbyhash.

Inputs:

  • hash - string; The block's sha256 hash.

Outputs:

  • block_header - A structure containing block header information. See get_last_block_header.
  • status - string; General RPC error code. "OK" means everything looks good.
  • untrusted - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

In this example, block 660361 is looked up by its hash:

$ curl http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block_header_by_hash","params":{"hash":"4e50d76a0765acf6ab6e0fcbc41fd21be4ff0d32793f56829619ea6e917ba3fc"}}' -H 'Content-Type: application/json'

{ "id": "0", "jsonrpc": "2.0", "result": { "block_header": { "block_size": 103, "depth": 2, "difficulty": 2777559569, "hash": "4e50d76a0765acf6ab6e0fcbc41fd21be4ff0d32793f56829619ea6e917ba3fc", "height": 660361, "major_version": 7, "minor_version": 7, "nonce": 1906564, "num_txes": 0, "orphan_status": false, "prev_hash": "c3033e59450505a21e5ea14baf2e433f459eae1f7d679661b93e8b996f579f61", "reward": 2000000000000, "timestamp": 1615998304 }, "status": "OK", "untrusted": false } }


get_block_header_by_height

Similar to get_block_header_by_hash above, this method includes a block's height as an input parameter to retrieve basic information about the block.

Alias: getblockheaderbyheight.

Inputs:

  • height - unsigned int; The block's height.

Outputs:

  • block_header - A structure containing block header information. See get_last_block_header.
  • status - string; General RPC error code. "OK" means everything looks good.
  • untrusted - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

In this example, block 660300 is looked up by its height (notice that the returned information is the same as in the previous example):

$ curl http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block_header_by_height","params":{"height":660300}}' -H 'Content-Type: application/json'

{ "id": "0", "jsonrpc": "2.0", "result": { "block_header": { "block_size": 103, "depth": 65, "difficulty": 2395400053, "hash": "28d8a53b705aef33ac7297e8b0d54afb8dc5e373a02f5ab44502fafd119e1d5d", "height": 660300, "major_version": 7, "minor_version": 7, "nonce": 723982, "num_txes": 0, "orphan_status": false, "prev_hash": "da58f2286e54d5815d92a0b891a04368636b8f72076aec3bd39e0da8bb9b1b00", "reward": 2000000000000, "timestamp": 1615990985 }, "status": "OK", "untrusted": false } }


get_block_headers_range

Similar to get_block_header_by_height above, but for a range of blocks. This method includes a starting block height and an ending block height as parameters to retrieve basic information about the range of blocks.

Alias: getblockheadersrange.

Inputs:

  • start_height - unsigned int; The starting block's height.
  • end_height - unsigned int; The ending block's height.

Outputs:

  • headers - array of block_header (a structure containing block header information. See get_last_block_header).
  • status - string; General RPC error code. "OK" means everything looks good.
  • untrusted - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

In this example, blocks range from height 1545999 to 1546000 is looked up (notice that the returned informations are ascending order and that it is at the April 2018 network upgrade time):

$ curl http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block_headers_range","params":{"start_height":133122,"end_height":133123}}' -H 'Content-Type: application/json'

{ "id": "0", "jsonrpc": "2.0", "result": { "headers": [{ "block_size": 99, "depth": 527247, "difficulty": 623375389, "hash": "27f70ce34214daa428252ddbc150841c0db75370f8b618ee280099d03b90875f", "height": 133122, "major_version": 3, "minor_version": 3, "nonce": 2164323472, "num_txes": 0, "orphan_status": false, "prev_hash": "d7311d24204ce60be4789cb913a0b545d0c8d8e96afab711c7e684977ee059bb", "reward": 600000000000, "timestamp": 1551629096 },{ "block_size": 99, "depth": 527246, "difficulty": 643579611, "hash": "8fcf7ad136e55a828f5a24b7e614fa705c11abe99f97e8d8edcdbb882f1ad5a1", "height": 133123, "major_version": 3, "minor_version": 3, "nonce": 3120566849, "num_txes": 0, "orphan_status": false, "prev_hash": "27f70ce34214daa428252ddbc150841c0db75370f8b618ee280099d03b90875f", "reward": 600000000000, "timestamp": 1551629134 }], "status": "OK", "untrusted": false } }


get_block

Full block information can be retrieved by either block height or hash, like with the above block header calls. For full block information, both lookups use the same method, but with different input parameters.

Alias: getblock.

Inputs (pick one of the following):

  • height - unsigned int; The block's height.
  • hash - string; The block's hash.

Outputs:

  • blob - string; Hexadecimal blob of block information.
  • block_header - A structure containing block header information. See get_last_block_header.
  • json - json string; JSON formatted block details:
    • major_version - Same as in block header.
    • minor_version - Same as in block header.
    • timestamp - Same as in block header.
    • prev_id - Same as prev_hash in block header.
    • nonce - Same as in block header.
    • miner_tx - Miner transaction information
      • version - Transaction version number.
      • unlock_time - The block height when the coinbase transaction becomes spendable.
      • vin - List of transaction inputs:
        • gen - Miner txs are coinbase txs, or "gen".
          • height - This block height, a.k.a. when the coinbase is generated.
      • vout - List of transaction outputs. Each output contains:
        • amount - The amount of the output, in atomic units.
        • target - txout_target_v
          • key - crypto::public_key
      • extra - Usually called the "transaction ID" but can be used to include any random 32 byte/64 character hex string.
      • signatures - Contain signatures of tx signers. Coinbased txs do not have signatures.
    • tx_hashes - List of hashes of non-coinbase transactions in the block. If there are no other transactions, this will be an empty list.
  • status - string; General RPC error code. "OK" means everything looks good.
  • untrusted - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

Look up by height:

In the following example, block 213213 is looked up by its height. Note that block 213213 does not have any non-coinbase transactions. (See the next example for a block with extra transactions):

$ curl http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block","params":{"height":213213}}' -H 'Content-Type: application/json'

{ "id": "0", "jsonrpc": "2.0", "result": { "blob": "0303f2d8bbe80531d29a97c49fd50d18a4ace79f37bce0a5893b7845dadd5487abfc2c31fb254b2c6400450199820d01ffdd810d0180e0a596bb110002813a733f22a18a4e1824eba8e60830da608ef1b223dbe99c6f4363e04593d0cd3001eb3eebb2a61b4b04eadcc569282bf6642cf67d797ea17713c5b0030ecdd069e5020d3930303100070000002590c0a400", "block_header": { "block_size": 99, "depth": 447156, "difficulty": 427087817, "hash": "b1620d5ecb4ac98a0351405356ed96f56e9df199b5287df90a800046882f6da2", "height": 213213, "major_version": 3, "minor_version": 3, "nonce": 1157653548, "num_txes": 0, "orphan_status": false, "prev_hash": "31d29a97c49fd50d18a4ace79f37bce0a5893b7845dadd5487abfc2c31fb254b", "reward": 600000000000, "timestamp": 1561259122 }, "json": "{\n "major_version": 3, \n "minor_version": 3, \n "timestamp": 1561259122, \n "prev_id": "31d29a97c49fd50d18a4ace79f37bce0a5893b7845dadd5487abfc2c31fb254b", \n "nonce": 1157653548, \n "miner_tx": {\n "version": 1, \n "unlock_time": 213273, \n "vin": [ {\n "gen": {\n "height": 213213\n }\n }\n ], \n "vout": [ {\n "amount": 600000000000, \n "token_amount": 0, \n "target": {\n "key": "813a733f22a18a4e1824eba8e60830da608ef1b223dbe99c6f4363e04593d0cd"\n }\n }\n ], \n "extra": [ 1, 235, 62, 235, 178, 166, 27, 75, 4, 234, 220, 197, 105, 40, 43, 246, 100, 44, 246, 125, 121, 126, 161, 119, 19, 197, 176, 3, 14, 205, 208, 105, 229, 2, 13, 57, 48, 48, 49, 0, 7, 0, 0, 0, 37, 144, 192, 164\n ], \n "signatures": [ ]\n }, \n "tx_hashes": [ ]\n}", "miner_tx_hash": "eb38e10c80a8581dcb4c5925a14dd24dcdc9f9300dd0acd10f7bd69dd07af3e9", "status": "OK", "untrusted": false } }

Look up by hash:

In the following example, block 213213 is looked up by its hash:

$ curl http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block","params":{"hash":"b1620d5ecb4ac98a0351405356ed96f56e9df199b5287df90a800046882f6da2"}}' -H 'Content-Type: application/json'

{ "id": "0", "jsonrpc": "2.0", "result": { "blob": "0303f2d8bbe80531d29a97c49fd50d18a4ace79f37bce0a5893b7845dadd5487abfc2c31fb254b2c6400450199820d01ffdd810d0180e0a596bb110002813a733f22a18a4e1824eba8e60830da608ef1b223dbe99c6f4363e04593d0cd3001eb3eebb2a61b4b04eadcc569282bf6642cf67d797ea17713c5b0030ecdd069e5020d3930303100070000002590c0a400", "block_header": { "block_size": 99, "depth": 447156, "difficulty": 427087817, "hash": "b1620d5ecb4ac98a0351405356ed96f56e9df199b5287df90a800046882f6da2", "height": 213213, "major_version": 3, "minor_version": 3, "nonce": 1157653548, "num_txes": 0, "orphan_status": false, "prev_hash": "31d29a97c49fd50d18a4ace79f37bce0a5893b7845dadd5487abfc2c31fb254b", "reward": 600000000000, "timestamp": 1561259122 }, "json": "{\n "major_version": 3, \n "minor_version": 3, \n "timestamp": 1561259122, \n "prev_id": "31d29a97c49fd50d18a4ace79f37bce0a5893b7845dadd5487abfc2c31fb254b", \n "nonce": 1157653548, \n "miner_tx": {\n "version": 1, \n "unlock_time": 213273, \n "vin": [ {\n "gen": {\n "height": 213213\n }\n }\n ], \n "vout": [ {\n "amount": 600000000000, \n "token_amount": 0, \n "target": {\n "key": "813a733f22a18a4e1824eba8e60830da608ef1b223dbe99c6f4363e04593d0cd"\n }\n }\n ], \n "extra": [ 1, 235, 62, 235, 178, 166, 27, 75, 4, 234, 220, 197, 105, 40, 43, 246, 100, 44, 246, 125, 121, 126, 161, 119, 19, 197, 176, 3, 14, 205, 208, 105, 229, 2, 13, 57, 48, 48, 49, 0, 7, 0, 0, 0, 37, 144, 192, 164\n ], \n "signatures": [ ]\n }, \n "tx_hashes": [ ]\n}", "miner_tx_hash": "eb38e10c80a8581dcb4c5925a14dd24dcdc9f9300dd0acd10f7bd69dd07af3e9", "status": "OK", "untrusted": false } }


get_connections

Retrieve information about incoming and outgoing connections to your node.

Alias: None.

Inputs: None.

Outputs:

  • connections - List of all connections and their info:
    • address - string; The peer's address, actually IPv4 & port
    • avg_download - unsigned int; Average bytes of data downloaded by node.
    • avg_upload - unsigned int; Average bytes of data uploaded by node.
    • connection_id - string; The connection ID
    • current_download - unsigned int; Current bytes downloaded by node.
    • current_upload - unsigned int; Current bytes uploaded by node.
    • height- unsigned int; The peer height
    • host - string; The peer host
    • incoming - boolean; Is the node getting information from your node?
    • ip - string; The node's IP address.
    • live_time - unsigned int
    • local_ip - boolean
    • localhost - boolean
    • peer_id - string; The node's ID on the network.
    • port - string; The port that the node is using to connect to the network.
    • recv_count - unsigned int
    • recv_idle_time - unsigned int
    • send_count - unsigned int
    • send_idle_time - unsigned int
    • state - string
    • support_flags - unsigned int

Following is an example of get_connections and it's return:

$ curl http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_connections"}' -H 'Content-Type: application/json'

{ "id": "0", "jsonrpc": "2.0", "result": { "connections": [{ "address": "78.113.187.55:34850", "avg_download": 0, "avg_upload": 0, "connection_id": "123218949fa033dbbb5733cccd851802", "current_download": 0, "current_upload": 0, "height": 660370, "host": "78.113.187.55", "incoming": true, "ip": "78.113.187.55", "live_time": 802, "local_ip": false, "localhost": false, "peer_id": "8ce16c15b1750a88", "port": "34850", "recv_count": 72426, "recv_idle_time": 9, "send_count": 48170, "send_idle_time": 10, "state": "state_normal", "support_flags": 1 }], "status": "OK" } }


get_info

Retrieve general information about the state of your node and the network.

Alias:

  • /get_info
  • /getinfo

See other RPC Methods /get_info (not JSON)

Inputs: None.

Outputs:

  • alt_blocks_count - unsigned int; Number of alternative blocks to main chain.
  • block_size_limit - unsigned int; Maximum allowed block size
  • block_size_median - unsigned int; Median block size of latest 100 blocks
  • bootstrap_daemon_address - string; Bootstrap node to give immediate usability to wallets while syncing by proxying RPC to it. (Note: the replies may be untrustworthy).
  • cumulative_difficulty - unsigned int; Cumulative difficulty of all blocks in the blockchain.
  • difficulty - unsigned int; Network difficulty (analogous to the strength of the network)
  • free_space - unsigned int; Available disk space on the node.
  • grey_peerlist_size - unsigned int; Grey Peerlist Size
  • height - unsigned int; Current length of longest chain known to daemon.
  • height_without_bootstrap - unsigned int; Current length of the local chain of the daemon.
  • incoming_connections_count - unsigned int; Number of peers connected to and pulling from your node.
  • mainnet - boolean; States if the node is on the mainnet (true) or not (false).
  • offline - boolean; States if the node is offline (true) or online (false).
  • outgoing_connections_count - unsigned int; Number of peers that you are connected to and getting information from.
  • rpc_connections_count - unsigned int; Number of RPC client connected to the daemon (Including this RPC request).
  • stagenet - boolean; States if the node is on the stagenet (true) or not (false).
  • start_time - unsigned int; Start time of the daemon, as UNIX time.
  • status - string; General RPC error code. "OK" means everything looks good.
  • target - unsigned int; Current target for next proof of work.
  • target_height - unsigned int; The height of the next block in the chain.
  • testnet - boolean; States if the node is on the testnet (true) or not (false).
  • top_block_hash - string; Hash of the highest block in the chain.
  • tx_count - unsigned int; Total number of non-coinbase transaction in the chain.
  • tx_pool_size - unsigned int; Number of transactions that have been broadcast but not included in a block.
  • untrusted - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).
  • was_bootstrap_ever_used - boolean; States if a bootstrap node has ever been used since the daemon started.
  • white_peerlist_size - unsigned int; White Peerlist Size

Following is an example get_info call and its return:

$ curl http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_info"}' -H 'Content-Type: application/json'
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "alt_blocks_count": 0,
    "block_size_limit": 120000,
    "block_size_median": 103,
    "bootstrap_daemon_address": "",
    "cumulative_difficulty": 982944443793350,
    "difficulty": 2779626728,
    "free_space": 507204501504,
    "grey_peerlist_size": 414,
    "height": 660371,
    "height_without_bootstrap": 660371,
    "incoming_connections_count": 4,
    "issued_coins": 868422182176519064,
    "issued_tokens": 1885974016,
    "mainnet": true,
    "migrated_tokens": 1641289609,
    "offline": false,
    "outgoing_connections_count": 8,
    "rpc_connections_count": 2,
    "stagenet": false,
    "start_time": 1615997493,
    "status": "OK",
    "target": 120,
    "target_height": 660360,
    "testnet": false,
    "top_block_hash": "25927a3ec729858a41afbfb7caf5ce82ea3b7ad68cd32b67a9187cb39b2712c4",
    "tx_count": 551978,
    "tx_pool_size": 5,
    "untrusted": false,
    "was_bootstrap_ever_used": false,
    "white_peerlist_size": 33
  }
}

hard_fork_info

Look up information regarding hard fork voting and readiness.

Alias: None.

Inputs: None.

Outputs:

  • earliest_height - unsigned int; Block height at which hard fork would be enabled if voted in.
  • enabled - boolean; Tells if hard fork is enforced.
  • state - unsigned int; Current hard fork state: 0 (There is likely a hard fork), 1 (An update is needed to fork properly), or 2 (Everything looks good).
  • status - string; General RPC error code. "OK" means everything looks good.
  • threshold - unsigned int; Minimum percent of votes to trigger hard fork. Default is 80.
  • untrusted - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).
  • version - unsigned int; The major block version for the fork.
  • votes - unsigned int; Number of votes towards hard fork.
  • voting - unsigned int; Hard fork voting status.
  • window - unsigned int; Number of blocks over which current votes are cast. Default is 10080 blocks.

Example:

$ curl http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"hard_fork_info"}' -H 'Content-Type: application/json'
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "earliest_height": 605700,
    "enabled": true,
    "state": 2,
    "status": "OK",
    "threshold": 0,
    "untrusted": false,
    "version": 7,
    "votes": 10080,
    "voting": 7,
    "window": 10080
  }
}

set_bans

Ban another node by IP.

Alias: None.

Inputs:

  • bans - A list of nodes to ban:
    • host - string; Host to ban (IP in A.B.C.D form - will support I2P address in the future).
    • ip - unsigned int; IP address to ban, in Int format.
    • ban - boolean; Set true to ban.
    • seconds - unsigned int; Number of seconds to ban node.

Outputs:

  • status - string; General RPC error code. "OK" means everything looks good.

Examples:

banning by host

In the following example, host is banned with its IP address string-formatted as A.B.C.D:

$ curl http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"set_bans","params":{"bans":[{"host":"55.113.22.35","ban":true,"seconds":30}]}}' -H  'Content-Type: application/json'

{ "id": "0", "jsonrpc": "2.0", "result": { "status": "OK" } }

banning by ip

In the following example, integer-formatted IP is banned:

$ curl http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"set_bans","params":{"bans":[{"ip":588673335,"ban":true,"seconds":30}]}}' -H  'Content-Type: application/json' 

{ "id": "0", "jsonrpc": "2.0", "result": { "status": "OK" } }


get_bans

Get list of banned IPs.

Alias: None.

Inputs: None.

Outputs:

  • bans - List of banned nodes:
    • host - string; Banned host (IP in A.B.C.D form).
    • ip - unsigned int; Banned IP address, in Int format.
    • seconds - unsigned int; Local Unix time that IP is banned until.
  • status - string; General RPC error code. "OK" means everything looks good.

Example:

$ curl http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_bans"}' -H 'Content-Type: application/json'

{ "id": "0", "jsonrpc": "2.0", "result": { "bans": [{ "host": "55.113.22.35", "ip": 588673335, "seconds": 28 }], "status": "OK" } }


flush_txpool

Flush tx ids from transaction pool

Alias: None.

Inputs:

  • txids - array of strings; Optional, list of transactions IDs to flush from pool (all tx ids flushed if empty).

Outputs:

  • status - string; General RPC error code. "OK" means everything looks good.

Example:

$ curl http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"flush_txpool","params":{"txids":["f7e2f96cacec029df5f365c6be11c8f9dcd728f5b138ba8e43ff5bf223f23c7e"]}}' -H 'Content-Type: application/json'

{ "id": "0", "jsonrpc": "2.0", "result": { "status": "OK" } }


get_output_histogram

Get a histogram of output amounts. For all amounts (possibly filtered by parameters), gives the number of outputs on the chain for that amount. RingCT outputs counts as 0 amount.

Inputs:

  • amounts - list of unsigned int
  • min_count - unsigned int
  • max_count - unsigned int
  • unlocked - boolean
  • recent_cutoff - unsigned int
  • out_type - tx_out_type (used when sending via binaries)
  • out_type_as_int - unsigned int (used when sending from from generic command. If this field is present, out_type is overriden)

Outputs:

  • histogram - list of histogram entries, in the following structure:
    • amount - unsigned int; Output amount in atomic units.
    • total_instances - unsigned int;
    • unlocked_instances - unsigned int;
    • recent_instances - unsigned int;
  • status - string; General RPC error code. "OK" means everything looks good.
  • untrusted - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

Example:

$ curl http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_output_histogram","params":{"amounts":[20000000000], "out_type_as_int":0}}' -H 'Content-Type: application/json'

{ "id": "0", "jsonrpc": "2.0", "result": { "histogram": [{ "amount": 20000000000, "recent_instances": 0, "total_instances": 381458, "unlocked_instances": 0 }], "status": "OK", "untrusted": false } }


get_coinbase_tx_sum

Get the coinbase amount and the fees amount for n last blocks starting at particular height

Alias: None.

Inputs:

  • height - unsigned int; Block height from which getting the amounts
  • count - unsigned int; number of blocks to include in the sum

Outputs:

  • emission_amount - unsigned int; amount of coinbase reward in atomic units.
  • fee_amount - unsigned int; amount of fees in atomic units.
  • status - string; General RPC error code. "OK" means everything looks good.

Example:

$ curl http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_coinbase_tx_sum","params":{"height":200000,"count":200}}' -H 'Content-Type: application/json'

{ "id": "0", "jsonrpc": "2.0", "result": { "emission_amount": 120000000000000, "fee_amount": 23840000000, "status": "OK" } }


get_version

Give the node current version

Alias: None.

Inputs: None.

Outputs:

  • status - string; General RPC error code. "OK" means everything looks good.
  • untrusted - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).
  • version - unsigned int;

Example:

$ curl http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_version"}' -H 'Content-Type: application/json'

{ "id": "0", "jsonrpc": "2.0", "result": { "status": "OK", "untrusted": false, "version": 65555 } }


get_fee_estimate

Gives an estimation on fees per byte.

Alias: None.

Inputs:

  • grace_blocks - unsigned int; Optional

Outputs:

  • fee - unsigned int; Amount of fees estimated per byte in atomic units.
  • quantization_mask - unsigned int; Final fee should be rounded up to an even multiple of this value
  • status - string; General RPC error code. "OK" means everything looks good.
  • untrusted - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

Example:

$ curl http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_fee_estimate"}' -H 'Content-Type: application/json'

{ "id": "0", "jsonrpc": "2.0", "result": { "fee": 333340000, "status": "OK", "untrusted": false } }


get_alternate_chains

Display alternative chains seen by the node.

Alias: None.

Inputs: None.

Outputs:

  • chains - array of chains, the following structure:
    • block_hash - string; the block hash of the first diverging block of this alternative chain.
    • difficulty - unsigned int; the cumulative difficulty of all blocks in the alternative chain.
    • height - unsigned int; the block height of the first diverging block of this alternative chain.
    • length - unsigned int; the length in blocks of this alternative chain, after divergence.
  • status - string; General RPC error code. "OK" means everything looks good.

Example:

$ curl http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_alternate_chains"}' -H 'Content-Type: application/json'

{ "id": "0", "jsonrpc": "2.0", "result": { "chains": [{ "block_hash": "95e4ffcfc39497cee585d8b935568302ac6f428172c229edf972885f82fa2efb", "difficulty": 6383156800115, "height": 157359, "length": 2 }], "status": "OK" } }


relay_tx

Relay a list of transaction IDs.

Alias: None.

Inputs:

  • txids - array of string; list of transaction IDs to relay

Outputs:

  • status - string; General RPC error code. "OK" means everything looks good.

Example:

$ curl http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"relay_tx","params":{"txids":["83e30998256d7d28760074954d6883efb19e2443a97d723dd41ea633298e470c"]}}' -H 'Content-Type: application/json'

{ "id": "0", "jsonrpc": "2.0", "result": { "status": "OK" } }


sync_info

Get synchronisation informations

Alias: None.

Inputs: None.

Outputs:

  • height - unsigned int;
  • peers - array of peer structure, defined as follows:
  • spans - array of span structure, defined as follows (optional, absent if node is fully synced):
    • connection_id - string; Id of connection
    • nblocks - unsigned int; number of blocks in that span
    • rate - unsigned int; connection rate
    • remote_address - string; peer address the node is downloading (or has downloaded) than span from
    • size - unsigned int; total number of bytes in that span's blocks (including txes)
    • speed - unsigned int; connection speed
    • start_block_height - unsigned int; block height of the first block in that span
  • status - string; General RPC error code. "OK" means everything looks good.
  • target_height - unsigned int; target height the node is syncing from (will be 0 if node is fully synced)

Example:

$ curl http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"sync_info"}' -H 'Content-Type: application/json'

{ "id": "0", "jsonrpc": "2.0", "result": { "height": 1563543, "peers": [{ "info": { "address": "51.43.11.128:17401", "avg_download": 0, "avg_upload": 5, "connection_id": "9773a76819002aad137ceb5f0f463356", "current_download": 2, "current_upload": 0, "height": 661094, "host": "51.43.11.128", "incoming": false, "ip": "51.43.11.128", "live_time": 475, "local_ip": false, "localhost": false, "peer_id": "32bedc24031a3183", "port": "17401", "recv_count": 953247, "recv_idle_time": 11, "send_count": 179119, "send_idle_time": 11, "state": "state_normal", "support_flags": 1 } }], "status": "OK", "target_height": 661068 } }


get_txpool_backlog

Get all transaction pool backlog

Alias: None.

Inputs: None.

Outputs:

  • backlog: array of structures tx_backlog_entry (in binary form):
    • blob_size - unsigned int (in binary form)
    • fee - unsigned int (in binary form)
    • time_in_pool - unsigned int (in binary form)
  • status - string; General RPC error code. "OK" means everything looks good.
  • untrusted - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

Example:

$ curl http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_txpool_backlog"}' -H 'Content-Type: application/json'

{ "id": "0", "jsonrpc": "2.0", "result": { "backlog": "...Binary...", "status": "OK", "untrusted": false } }


get_output_distribution

Alias: None.

Inputs:

  • amounts - array of unsigned int; amounts to look for
  • cumulative - boolean; (optional, default is false) States if the result should be cumulative (true) or not (false)
  • from_height - unsigned int; (optional, default is 0) starting height to check from
  • to_height - unsigned int; (optional, default is 0) ending height to check up to
  • out_type - tx_out_type (used when sending via binaries)
  • out_type_as_int - unsigned int (used when sending from from generic command. If this field is present, out_typem is overriden)

Outputs:

  • distributions - array of structure distribution as follows:
    • amount - unsigned int
    • base - unsigned int
    • distribution - array of unsigned int
    • start_height - unsigned int
  • status - string; General RPC error code. "OK" means everything looks good.

Example:

$ curl http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_output_distribution","params":{"amounts":[628780000],"from_height":1462078}}' -H 'Content-Type: application/json'

{ "id": "0", "jsonrpc": "2.0", "result": { "distributions": [{ "amount": 2628780000, "base": 0, "distribution": "", "start_height": 1462078 }], "status": "OK" } }


decode_safex_output

Alias: None.

Inputs:

  • data - array of unsigned int; Binary data of the output
  • output_type - unsigned int;

Outputs:

  • parsed_fields - array structured as follows:
    • field - string
    • value - string
  • status - string; General RPC error code. "OK" means everything looks good.

Example:

$ curl http://127.0.0.1:17402/json_rpc -d '{"jsonrpc":"2.0","id":"0", "method": "decode_safex_output", "params": {"data": [ 5, 97, 112, 112, 108, 101, 153, 214, 189, 84, 28, 13, 178, 17, 241, 159, 76, 199, 211, 218, 50, 35, 68, 124, 117, 142, 197, 173, 239, 20, 101, 32, 50, 251, 38, 140, 103, 121, 16, 102, 111, 114, 32, 115, 97, 108, 101, 32, 98, 121, 32, 107, 105, 110, 103], "output_type": 15}}' -H 'Content-Type: application/json'

{ "id": "0", "jsonrpc": "2.0", "result": { "parsed_fields": [{ "field": "username", "value": "apple" },{ "field": "account_data", "value": "for sale by king" },{ "field": "pkey", "value": "99d6bd541c0db211f19f4cc7d3da3223447c758ec5adef14652032fb268c6779" }], "status": "OK" } }`


Protobuf RPC Calls

Protobuf RPC calls are designed to allow basic interaction with a daemon needed to implement Safex wallet in almost any language without too much additional work.


proto/get_transactions

Alias: None.

Inputs:

  • txs_hashes - string list; List of transaction hashes to look up.
  • prune - boolean; Optional (false by default).

Outputs:

  • protobuf_content - txs in protobuf format
  • missed_tx - array of strings. (Optional - returned if not empty) Transaction hashes that could not be found.
  • status - string; General RPC error code. "OK" means everything looks good.
  • untrusted - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

proto/get_blocks

Alias: None.

Inputs:

  • start_height - unsigned int
  • end_height - unsigned int

Outputs:

  • protobuf_content - blocks in protobuf format

proto/get_output_histogram

Alias: None.

Inputs:

  • amounts - list of unsigned int
  • min_count - unsigned int
  • max_count - unsigned int
  • unlocked - boolean
  • recent_cutoff - unsigned int
  • out_type - unsigned int

Outputs:

  • protobuf_content - output histogram in protobuf format

proto/get_outputs

Alias: None.

Inputs:

  • outputs array of get_outputs_out structure as follows:
    • amount - unsigned int;
    • index - unsigned int;
  • out_type - unsigned int

Outputs:

  • protobuf_content - outputs in protobuf format
  • status - string; General RPC error code. "OK" means everything looks good.

proto/sendrawtransaction

Alias: None.

Inputs:

  • proto_content - Full transaction information in protobuf format
  • do_not_relay - boolean; Stop relaying transaction to other nodes (default is false).

Outputs:

  • txid - string; Transaction ID.
  • status - string; General RPC error code. "OK" means everything looks good. Any other value means that something went wrong.
  • reason - string; Additional information. Currently empty or "Not relayed" if transaction was accepted but not relayed.
  • not_relayed - boolean; Transaction was not relayed (true) or relayed (false).
  • low_mixin - boolean; Mixin count is too low (true) or OK (false).
  • double_spend - boolean; Transaction is a double spend (true) or not (false).
  • invalid_input - boolean; Input is invalid (true) or valid (false).
  • invalid_output - boolean; Output is invalid (true) or valid (false).
  • too_big - boolean; Transaction size is too big (true) or OK (false).
  • overspend - boolean; Transaction uses more money than available (true) or not (false).
  • fee_too_low - boolean; Fee is too low (true) or OK (false).
  • not_rct - boolean; Transaction is a standard ring transaction (true) or a ring confidential transaction (false).
  • untrusted - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

Other Daemon RPC Calls

Not all daemon RPC calls use the JSON_RPC interface. This section gives examples of these calls.

The data structure for these calls is different than the JSON RPC calls. Whereas the JSON RPC methods were called using the /json_rpc extension and specifying a method, these methods are called at their own extensions. For example:

IP=127.0.0.1
PORT=18081
METHOD='gettransactions'
PARAMS='{"txs_hashes":["d6e48158472848e6687173a91ae6eebfa3e1d778e65252ee99d7515d63090408"]}'
curl \
  http://$IP:$PORT/$METHOD \
  -d $PARAMS \
  -H 'Content-Type: application/json'

Note: It is recommended to use JSON RPC where such alternatives exist, rather than the following methods. For example, the recommended way to get a node's height is via the JSON RPC methods get_info or get_last_block_header, rather than getheight below.

For calls that end with .bin, the data is exchanged in the form of binary, serialized objects, as defined in the Core RPC Server.


/get_height

Get the node's current height.

Alias: /getheight.

Inputs: None.

Outputs:

  • height - unsigned int; Current length of longest chain known to daemon.
  • status - string; General RPC error code. "OK" means everything looks good.
  • untrusted - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).
$ curl http://127.0.0.1:17402/get_height -H 'Content-Type: application/json'

{ "height": 661107, "status": "OK", "untrusted": false }


/get_blocks.bin

Get all blocks info. Binary request.

Alias: /getblocks.bin.

Inputs:

  • block_ids - binary array of hashes; first 10 blocks id goes sequential, next goes in pow(2,n) offset, like 2, 4, 8, 16, 32, 64 and so on, and the last one is always genesis block
  • start_height - unsigned int
  • prune - boolean

Outputs:

  • blocks - array of block complete entries
  • current_height - unsigned int
  • output_indices - structure as follows:
    • indices - array of tx output indices, structure as follows:
      • indices - array of unsigned int
  • start_height - unsigned int
  • status - string; General RPC error code. "OK" means everything looks good.
  • untrusted - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

/get_blocks_by_height.bin

Get blocks by height. Binary request.

Alias: /getblocks_by_height.bin.

Inputs:

  • heights - array of unsigned int; list of block heights

Outputs:

  • blocks - array of block complete entries
  • status - string; General RPC error code. "OK" means everything looks good.
  • untrusted - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

/get_hashes.bin

Get hashes. Binary request.

Alias: /gethashes.bin.

Inputs:

  • block_ids - binary array of hashes; first 10 blocks id goes sequential, next goes in pow(2,n) offset, like 2, 4, 8, 16, 32, 64 and so on, and the last one is always genesis block
  • start_height - unsigned int

Outputs:

  • current_height - unsigned int
  • m_block_ids - binary array of hashes; see block_ids above.
  • start_height - unsigned int
  • status - string; General RPC error code. "OK" means everything looks good.
  • untrusted - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

/get_o_indexes.bin

Get global outputs of transactions. Binary request.

Alias: None.

Inputs:

  • txid - binary txid

Outputs:

  • o_indexes - array of unsigned int; List of output indexes
  • status - string; General RPC error code. "OK" means everything looks good.
  • untrusted - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

/get_random_outs.bin

Get outputs. Binary request.

Alias: getrandom_outs.bin.

Inputs:

  • amounts - array of unsigned int
  • out_type - tx_out_type
  • outs_count - unsigned int; Number of outs needed.

Outputs:

  • outs - array of structure outs_for_amount as follows:
    • amount - unsigned int;
    • output_type - tx_out_type
    • outs - array of structure out_entry as follows:
      • global_amount_index - unsigned int;
      • out_key - crypto::public_key
  • status - string; General RPC error code. "OK" means everything looks good.
  • untrusted - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

/get_outs.bin

Get outputs. Binary request.

Alias: None.

Inputs:

  • outputs - array of structure get_outputs_out as follows:
    • amount - unsigned int;
    • index - unsigned int;
  • out_type - tx_out_type

Outputs:

  • outs - array of structure outkey as follows:
    • amount - unsigned int;
    • height - unsigned int; block height of the output
    • key - the public key of the output
    • mask
    • txid - transaction id
    • unlocked - boolean; States if output is locked (false) or not (true)
  • status - string; General RPC error code. "OK" means everything looks good.
  • untrusted - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

/get_transactions

Look up one or more transactions by hash.

Alias: /gettransactions.

Inputs:

  • txs_hashes - string list; List of transaction hashes to look up.
  • decode_as_json - boolean; Optional (false by default). If set true, the returned transaction information will be decoded rather than binary.
  • prune - boolean; Optional (false by default).

Outputs:

  • missed_tx - array of strings. (Optional - returned if not empty) Transaction hashes that could not be found.
  • status - General RPC error code. "OK" means everything looks good.
  • txs - array of structure entry as follows:
    • as_hex - string; Full transaction information as a hex string.
    • as_json - json string; List of transaction info:
      • version - Transaction version
      • unlock_time - If not 0, this tells when a transaction output is spendable.
      • vin - List of inputs into transaction:
        • key - The public key of the previous output spent in this transaction.
          • amount - The amount of the input, in atomic units.
          • key_offsets - A list of integer offets to the input.
          • k_image - The key image for the given input
      • vout - List of outputs from transaction:
        • amount - Amount of transaction output, in atomic units.
        • target - Output destination information:
          • key - The stealth public key of the receiver. Whoever owns the private key associated with this key controls this transaction output.
      • extra - Usually called the "payment ID" but can be used to include any random 32 bytes.
      • signatures - List of signatures used in ring signature to hide the true origin of the transaction.
    • block_height - unsigned int; block height including the transaction
    • block_timestamp - unsigned int; Unix time at chich the block has been added to the blockchain
    • double_spend_seen - boolean; States if the transaction is a double-spend (true) or not (false)
    • in_pool - boolean; States if the transaction is in pool (true) or included in a block (false)
    • output_indices - array of unsigned int; transaction indexes
    • tx_hash - string; transaction hash
  • txs_as_hex - string; Full transaction information as a hex string (old compatibility parameter)
  • txs_as_json - json string; (Optional - returned if set in inputs. Old compatibility parameter) List of transaction as in as_json above:

Example 1: Return transaction information in binary format.

$ curl http://127.0.0.1:17402/get_transactions -d '{"txs_hashes":["d6e48158472848e6687173a91ae6eebfa3e1d778e65252ee99d7515d63090408"]}' -H 'Content-Type: application/json'

{ "status": "OK", "txs": [{ "as_hex": "...", "as_json": "", "block_height": 993442, "block_timestamp": 1457749396, "double_spend_seen": false, "in_pool": false, "output_indices": [198769,418598,176616,50345,509], "tx_hash": "d6e48158472848e6687173a91ae6eebfa3e1d778e65252ee99d7515d63090408" }], "txs_as_hex": ["..."], "untrusted": false }

Example 2: Decode returned transaction information in JSON format. Note: the "vin", "vout" and "signatures" list have been truncated in the displayed return for space considerations.

$ curl http://127.0.0.1:17402/get_transactions -d '{"txs_hashes":["d6e48158472848e6687173a91ae6eebfa3e1d778e65252ee99d7515d63090408"],"decode_as_json":true}' -H 'Content-Type: application/json'

{ "status": "OK", "txs": [{ "as_hex": "...", "as_json": "{\n "version": 1, \n "unlock_time": 0, \n "vin": [ {\n "key": {\n "amount": 9999999999, \n "key_offsets": [ 691\n ], \n "k_image": "6ebee1b651a8da723462b4891d471b990ddc226049a0866d3029b8e2f75b7012"\n }\n }, {\n "key": {\n "amount": 9000000000000, \n "key_offsets": [ 175760\n ], \n "k_image": "200bd02b70ee707441a8863c5279b4e4d9f376dc97a140b1e5bc7d72bc508069"\n }\n }, ... \n ], \n "vout": [ {\n "amount": 60000000000, \n "target": {\n "key": "8c792dea94dab48160e067fb681edd6247ba375281fbcfedc03cb970f3b98e2d"\n }\n }, {\n "amount": 700000000000, \n "target": {\n "key": "1ab33e69737e157d23e33274c42793be06a8711670e73fa10ecebc604f87cc71"\n }\n }, ... \n ], \n "extra": [ 1, 3, 140, 109, 156, 205, 47, 148, 153, 9, 17, 93, 83, 33, 162, 110, 152, 1, 139, 70, 121, 19, 138, 10, 44, 6, 55, 140, 242, 124, 143, 219, 172\n ], \n "signatures": [ "fd82214a59c99d9251fa00126d353f9cf502a80d8993a6c223e3c802a40ab405555637f495903d3ba558312881e586d452e6e95826d8e128345f6c0a8f9f350e", "8c04ef50cf34afa3a9ec19c457143496f8cf7045ed869b581f9efa2f1d65e30f1cec5272b00e9c61a34bdd3c78cf82ae8ef4df3132f70861391069b9c255cd08", ... ]\n}", "block_height": 993442, "block_timestamp": 1457749396, "double_spend_seen": false, "in_pool": false, "output_indices": [198769,418598,176616,50345,509], "tx_hash": "d6e48158472848e6687173a91ae6eebfa3e1d778e65252ee99d7515d63090408" }], "txs_as_hex": ["..."], "txs_as_json": ["{\n "version": 1, \n "unlock_time": 0, \n "vin": [ {\n "key": {\n "amount": 9999999999, \n "key_offsets": [ 691\n ], \n "k_image": "6ebee1b651a8da723462b4891d471b990ddc226049a0866d3029b8e2f75b7012"\n }\n }, {\n "key": {\n "amount": 9000000000000, \n "key_offsets": [ 175760\n ], \n "k_image": "200bd02b70ee707441a8863c5279b4e4d9f376dc97a140b1e5bc7d72bc508069"\n }\n }, ... \n ], \n "vout": [ {\n "amount": 60000000000, \n "target": {\n "key": "8c792dea94dab48160e067fb681edd6247ba375281fbcfedc03cb970f3b98e2d"\n }\n }, {\n "amount": 700000000000, \n "target": {\n "key": "1ab33e69737e157d23e33274c42793be06a8711670e73fa10ecebc604f87cc71"\n }\n }, ... \n ], \n "extra": [ 1, 3, 140, 109, 156, 205, 47, 148, 153, 9, 17, 93, 83, 33, 162, 110, 152, 1, 139, 70, 121, 19, 138, 10, 44, 6, 55, 140, 242, 124, 143, 219, 172\n ], \n "signatures": [ "fd82214a59c99d9251fa00126d353f9cf502a80d8993a6c223e3c802a40ab405555637f495903d3ba558312881e586d452e6e95826d8e128345f6c0a8f9f350e", "8c04ef50cf34afa3a9ec19c457143496f8cf7045ed869b581f9efa2f1d65e30f1cec5272b00e9c61a34bdd3c78cf82ae8ef4df3132f70861391069b9c255cd08", ... ]\n}"], "untrusted": false }

Example 3: Returned a missed (unexisting) transaction.

curl http://127.0.0.1:17402/get_transactions -d '{"txs_hashes":["d6e48158472848e6687173a91ae6eebfa3e1d778e65252ee99d7515d63090409"]}' -H 'Content-Type: application/json'

{ "missed_tx": ["d6e48158472848e6687173a91ae6eebfa3e1d778e65252ee99d7515d63090409"], "status": "OK", "untrusted": false }


/get_alt_blocks_hashes

Get the known blocks hashes which are not on the main chain.

Alias: None.

Inputs: None

Outputs:

  • blks_hashes - array of strings; list of alternative blocks hashes to main chain
  • status - string; General RPC error code. "OK" means everything looks good.
  • untrusted - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

Example:

$ curl http://127.0.0.1:17402/get_alt_blocks_hashes -H 'Content-Type: application/json'

{ "blks_hashes": ["9c2277c5470234be8b32382cdf8094a103aba4fcd5e875a6fc159dc2ec00e011","637c0e0f0558e284493f38a5fcca3615db59458d90d3a5eff0a18ff59b83f46f","6f3adc174a2e8082819ebb965c96a095e3e8b63929ad9be2d705ad9c086a6b1c","697cf03c89a9b118f7bdf11b1b3a6a028d7b3617d2d0ed91322c5709acf75625","d99b3cf3ac6f17157ac7526782a3c3b9537f89d07e069f9ce7821d74bd9cad0e","e97b62109a6303233dcd697fa8545c9fcbc0bf8ed2268fede57ddfc36d8c939c","70ff822066a53ad64b04885c89bbe5ce3e537cdc1f7fa0dc55317986f01d1788","b0d36b209bd0d4442b55ea2f66b5c633f522401f921f5a85ea6f113fd2988866"], "status": "OK", "untrusted": false }


/is_key_image_spent

Check if outputs have been spent using the key image associated with the output.

Alias: None.

Inputs:

  • key_images - string list; List of key image hex strings to check.

Outputs:

  • spent_status - unsigned int list; List of statuses for each image checked. Statuses are follows: 0 = unspent, 1 = spent in blockchain, 2 = spent in transaction pool
  • status - string; General RPC error code. "OK" means everything looks good.
  • untrusted - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

Example:

$ curl http://127.0.0.1:17402/is_key_image_spent -d '{"key_images":["8d1bd8181bf7d857bdb281e0153d84cd55a3fcaa57c3e570f4a49f935850b5e3","7319134bfc50668251f5b899c66b005805ee255c136f0e1cecbb0f3a912e09d4"]}' -H 'Content-Type: application/json'

{ "spent_status": [1,2], "status": "OK" "untrusted": false }


/send_raw_transaction

Broadcast a raw transaction to the network.

Alias: /sendrawtransaction.

Inputs:

  • tx_as_hex - string; Full transaction information as hexidecimal string.
  • do_not_relay - boolean; Stop relaying transaction to other nodes (default is false).

Outputs:

  • double_spend - boolean; Transaction is a double spend (true) or not (false).
  • fee_too_low - boolean; Fee is too low (true) or OK (false).
  • invalid_input - boolean; Input is invalid (true) or valid (false).
  • invalid_output - boolean; Output is invalid (true) or valid (false).
  • low_mixin - boolean; Mixin count is too low (true) or OK (false).
  • not_rct - boolean; Transaction is a standard ring transaction (true) or a ring confidential transaction (false).
  • not_relayed - boolean; Transaction was not relayed (true) or relayed (false).
  • overspend - boolean; Transaction uses more money than available (true) or not (false).
  • reason - string; Additional information.
  • status - string; General RPC error code. "OK" means everything looks good. Any other value means that something went wrong.
  • too_big - boolean; Transaction size is too big (true) or OK (false).
  • non_supported_version - boolean; Transaction is not a supported version (true) or a version that is supported by the blockchain (false).
  • safex_verification_failed - boolean; Safex related verifications failed (true) or Safex related verifications passed (false).
  • safex_invalid_command - boolean; Safex command code is invalid (true) or valid (false).
  • safex_invalid_command_params - boolean; Safex command params are not valid and verifications for inputs failed (true) or valid (false).
  • safex_command_execution_failed - boolean; Safex command verification for inputs failed (true) or passed (false).
  • safex_invalid_input - boolean; Safex inputs are invalid and not verified with outputs (true) or inputs are valid (false).
  • untrusted - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

Example (No return information included here.):

$ curl http://127.0.0.1:17402/send_raw_transaction -d '{"tx_as_hex":"de6a3...", "do_not_relay":false}' -H 'Content-Type: application/json'

/start_mining

Start mining on the daemon.

Alias: None.

Inputs:

  • do_background_mining - boolean; States if the mining should run in background (true) or foreground (false).
  • ignore_battery - boolean; States if batery state (on laptop) should be ignored (true) or not (false).
  • miner_address - string; Account address to mine to.
  • threads_count - unsigned int; Number of mining thread to run.

Outputs:

  • status - string; General RPC error code. "OK" means everything looks good. Any other value means that something went wrong.

Example:

$ curl http://127.0.0.1:17402/start_mining -d '{"do_background_mining":false,"ignore_battery":true,"miner_address":"47xu3gQpF569au9C2ajo5SSMrWji6xnoE5vhr94EzFRaKAGw6hEGFXYAwVADKuRpzsjiU1PtmaVgcjUJF89ghGPhUXkndHc","threads_count":1}' -H 'Content-Type: application/json'

{ "status": "OK" }


/stop_mining

Stop mining on the daemon.

Alias: None.

Inputs: None.

Outputs:

  • status - string; General RPC error code. "OK" means everything looks good. Any other value means that something went wrong.

Example:

$ curl http://127.0.0.1:17402/stop_mining -H 'Content-Type: application/json'

{ "status": "OK" }


/mining_status

Get the mining status of the daemon.

Alias: None.

Inputs: None.

Outputs:

  • active - boolean; States if mining is enabled (true) or disabled (false).
  • address - string; Account address daemon is mining to. Empty if not mining.
  • is_background_mining_enabled - boolean; States if the mining is running in background (true) or foreground (false).
  • pow_algorithm - string; Algorithm that is in use.
  • speed - unsigned int; Mining power in hashes per seconds.
  • status - string; General RPC error code. "OK" means everything looks good. Any other value means that something went wrong.
  • threads_count - unsigned int; Number of running mining threads.

Example while mining:

$ curl http://127.0.0.1:17402/mining_status -H 'Content-Type: application/json'

{ "active": true, "address": "47xu3gQpF569au9C2ajo5SSMrWji6xnoE5vhr94EzFRaKAGw6hEGFXYAwVADKuRpzsjiU1PtmaVgcjUJF89ghGPhUXkndHc", "is_background_mining_enabled": false, "speed": 20, "status": "OK", "threads_count": 1 }

Example while not mining:

$ curl http://127.0.0.1:17402/mining_status -H 'Content-Type: application/json'

{ "active": false, "address": "", "is_background_mining_enabled": false, "speed": 0, "status": "OK", "threads_count": 0 }


/save_bc

Save the blockchain. The blockchain does not need saving and is always saved when modified, however it does a sync to flush the filesystem cache onto the disk for safety purposes against Operating System or Harware crashes.

Alias: None.

Inputs: None.

Outputs:

  • status - string; General RPC error code. "OK" means everything looks good. Any other value means that something went wrong.

Example:

$ curl http://127.0.0.1:17402/save_bc -H 'Content-Type: application/json'

{ "status": "OK" }


/get_peer_list

Get the known peers list.

Alias: None.

Inputs: None.

Outputs:

  • gray_list - array of offline peer structure as follows:
    • host - unsigned int; IP address in integer format
    • id - string; Peer id
    • ip - unsigned int; IP address in integer format
    • last_seen - unsigned int; unix time at which the peer has been seen for the last time
    • port - unsigned int; TCP port the peer is using to connect to the Safex network.
  • status - string; General RPC error code. "OK" means everything looks good. Any other value means that something went wrong.
  • white_list - array of online peer structure, as above.

Example (truncated lists):

$ curl http://127.0.0.1:17402/get_peer_list -H 'Content-Type: application/json'

{ "gray_list": [{ "host": "640304833", "id": 5345237316225602120, "ip": 640304833, "last_seen": 1525540510, "port": 18080 },{ "host": "2183731038", "id": 14955030573998424430, "ip": 2183731038, "last_seen": 1525540499, "port": 28080 }, ... ], "status": "OK", "white_list": [{ "host": "1221637955", "id": 10354694710033118926, "ip": 1221637955, "last_seen": 1525540511, "port": 18080 },{ "host": "1780407354", "id": 17193661050352240890, "ip": 1780407354, "last_seen": 1525540510, "port": 18080 }, ... ] }


/set_log_hash_rate

Set the log hash rate display mode.

Alias: None.

Inputs:

  • visible - boolean; States if hash rate logs should be visible (true) or hidden (false)

Outputs:

  • status - string; General RPC error code. "OK" means everything looks good. Any other value means that something went wrong.

Example while mining:

$ curl http://127.0.0.1:17402/set_log_hash_rate -d '{"visible":true}' -H 'Content-Type: application/json'

{ "status": "OK" }

Error while not mining:

$ curl http://127.0.0.1:17402/set_log_hash_rate -d '{"visible":true}' -H 'Content-Type: application/json'

{ "status": "NOT MINING" }


/set_log_level

Set the daemon log level. By default, log level is set to 0.

Alias: None.

Inputs:

  • level - integer; daemon log level to set from 0 (less verbose) to 4 (most verbose)

Outputs:

  • status - string; General RPC error code. "OK" means everything looks good. Any other value means that something went wrong.

Example:

$ curl http://127.0.0.1:17402/set_log_level -d '{"level":1}' -H 'Content-Type: application/json'

{ "status": "OK" }


/set_log_categories

Set the daemon log categories. Categories are represented as a comma separated list of <Category>:<level> (similarly to syslog standard <Facility>:<Severity-level>), where:

  • Category is one of the following:
    • * - All facilities
    • default
    • net
    • net.http
    • net.p2p
    • logging
    • net.throttle
    • blockchain.db
    • blockchain.db.lmdb
    • bcutil
    • checkpoints
    • net.dns
    • net.dl
    • i18n
    • perf
    • stacktrace
    • updates
    • account
    • cn
    • difficulty
    • hardfork
    • miner
    • blockchain
    • txpool
    • cn.block_queue
    • net.cn
    • daemon
    • debugtools.deserialize
    • debugtools.objectsizes
    • device.ledger
    • wallet.gen_multisig
    • multisig
    • bulletproofs
    • ringct
    • daemon.rpc
    • wallet.simplewallet
    • WalletAPI
    • wallet.ringdb
    • wallet.wallet2
    • wallet.rpc
    • tests.core
  • Level is one of the following:
    • FATAL - higher level
    • ERROR
    • WARNING
    • INFO
    • DEBUG
    • TRACE - lower level A level automatically includes higher level. By default, categories are set to *:WARNING,net:FATAL,net.p2p:FATAL,net.cn:FATAL,global:INFO,verify:FATAL,stacktrace:INFO,logging:INFO,msgwriter:INFO. Setting the categories to "" prevent any logs to be outputed.

Alias: None.

Inputs:

  • categories - string; Optional, daemon log categories to enable

Outputs:

  • categories - string; daemon log enabled categories
  • status - string; General RPC error code. "OK" means everything looks good. Any other value means that something went wrong.

Example to set all facilities to Security Level Info:

$ curl http://127.0.0.1:17402/set_log_categories -d '{"categories": "*:INFO"}' -H 'Content-Type: application/json'

{ "categories": "*:INFO", "status": "OK" }

Example without input to set the default categories:

$ curl http://127.0.0.1:17402/set_log_categories -H 'Content-Type: application/json'

{ "categories": "*:WARNING,net:FATAL,net.p2p:FATAL,net.cn:FATAL,global:INFO,verify:FATAL,stacktrace:INFO,logging:INFO,msgwriter:INFO", "status": "OK" }


/get_transaction_pool

Show information about valid transactions seen by the node but not yet mined into a block, as well as spent key image information for the txpool in the node's memory.

Alias: None.

Inputs: None.

Outputs:

  • spent_key_images - List of spent output key images:
    • id_hash - string; Key image.
    • txs_hashes - string list; tx hashes of the txes (usually one) spending that key image.
  • status - string; General RPC error code. "OK" means everything looks good.
  • transactions - List of transactions in the mempool are not in a block on the main chain at the moment:
    • blob_size - unsigned int; The size of the full transaction blob.
    • double_spend_seen - boolean; States if this transaction has been seen as double spend.
    • do_not_relay; boolean; States if this transaction should not be relayed
    • fee - unsigned int; The amount of the mining fee included in the transaction, in atomic units.
    • id_hash - string; The transaction ID hash.
    • kept_by_block - boolean; States if the tx was included in a block at least once (true) or not (false).
    • last_failed_height - unsigned int; If the transaction validation has previously failed, this tells at what height that occured.
    • last_failed_id_hash - string; Like the previous, this tells the previous transaction ID hash.
    • last_relayed_time - unsigned int; Last unix time at which the transaction has been relayed.
    • max_used_block_height - unsigned int; Tells the height of the most recent block with an output used in this transaction.
    • max_used_block_id_hash - string; Tells the hash of the most recent block with an output used in this transaction.
    • receive_time - unsigned int; The Unix time that the transaction was first seen on the network by the node.
    • relayed - boolean; States if this transaction has been relayed
    • tx_blob - unsigned int; Hexadecimal blob represnting the transaction.
    • tx_json - json string; JSON structure of all information in the transaction

Example (Note: Some lists in the returned information have been truncated for display reasons):

$ curl http://127.0.0.1:17402/get_transaction_pool -H 'Content-Type: application/json'

{ "spent_key_images": [{ "id_hash": "0e595fc9701bf18114f21a63e7fd8d64d53ec92b23ba56334f93beb88d2aa6d2", "txs_hashes": ["d20f40c421ee128c0f4c0ff725fc95c1c538b0d6aad06801cbf770a3421e5166"] },{ "id_hash": "33bbfaf2648aece0ecb4069b40f4c84bfc393bbbc30b67826f117b85e5f0a006", "txs_hashes": ["d20f40c421ee128c0f4c0ff725fc95c1c538b0d6aad06801cbf770a3421e5166"] },{ "id_hash": "5f3821e41d28e648865e951c2fc8d3b6490d0a438fa7b9d3628ada2c1bb004d9", "txs_hashes": ["d20f40c421ee128c0f4c0ff725fc95c1c538b0d6aad06801cbf770a3421e5166"] },{ "id_hash": "6398178e1b8826f8c821722bed665c8f01f7a0ccf40ec53262a60cf4bb61dbd9", "txs_hashes": ["d20f40c421ee128c0f4c0ff725fc95c1c538b0d6aad06801cbf770a3421e5166"] },{ "id_hash": "7598be9afdc2c8ef8531f7e30422c4b5dad03b770ef791ac87430ad322389f0b", "txs_hashes": ["d20f40c421ee128c0f4c0ff725fc95c1c538b0d6aad06801cbf770a3421e5166"] },{ "id_hash": "7773126322a4f714707d97988cd1d8135abc6cc0414453aa4239e3fa420891a8", "txs_hashes": ["d20f40c421ee128c0f4c0ff725fc95c1c538b0d6aad06801cbf770a3421e5166"] }], "status": "OK", "transactions": [{ "blob_size": 3163, "do_not_relay": false, "double_spend_seen": false, "fee": 1343000000, "id_hash": "d20f40c421ee128c0f4c0ff725fc95c1c538b0d6aad06801cbf770a3421e5166", "kept_by_block": false, "last_failed_height": 0, "last_failed_id_hash": "0000000000000000000000000000000000000000000000000000000000000000", "last_relayed_time": 1616508250, "max_used_block_height": 664366, "max_used_block_id_hash": "100bf3d42bf4fd74f7fb82274dbb2d8c3a1d88d89d7f1ed7b0ea0f740c7b875b", "receive_time": 1616508250, "relayed": true, "tx_blob": "...", "tx_json": "{\n "version": 1, \n "unlock_time": 0, \n "vin": [ {\n "key": {\n "amount": 9000000000, \n "key_offsets": [ 146166, 24673, 42334, 136, 15, 3\n ], \n "k_image": "7773126322a4f714707d97988cd1d8135abc6cc0414453aa4239e3fa420891a8"\n }\n }, {\n "key": {\n "amount": 9000000000, \n "key_offsets": [ 122635, 238, 90407, 26, 15, 15\n ], \n "k_image": "7598be9afdc2c8ef8531f7e30422c4b5dad03b770ef791ac87430ad322389f0b"\n }\n }, {\n "key": {\n "amount": 400000000, \n "key_offsets": [ 29294, 64281, 10907, 41641, 25, 15\n ], \n "k_image": "6398178e1b8826f8c821722bed665c8f01f7a0ccf40ec53262a60cf4bb61dbd9"\n }\n }, {\n "key": {\n "amount": 2000000000000, \n "key_offsets": [ 76944, 53311, 11886, 6993, 113, 319\n ], \n "k_image": "5f3821e41d28e648865e951c2fc8d3b6490d0a438fa7b9d3628ada2c1bb004d9"\n }\n }, {\n "key": {\n "amount": 800000000, \n "key_offsets": [ 80292, 46520, 18020, 60281, 7, 19\n ], \n "k_image": "33bbfaf2648aece0ecb4069b40f4c84bfc393bbbc30b67826f117b85e5f0a006"\n }\n }, {\n "key": {\n "amount": 3000000, \n "key_offsets": [ 1865, 2032, 612, 3, 1, 2\n ], \n "k_image": "0e595fc9701bf18114f21a63e7fd8d64d53ec92b23ba56334f93beb88d2aa6d2"\n }\n }\n ], \n "vout": [ {\n "amount": 100000000000, \n "token_amount": 0, \n "target": {\n "key": "a9f6e5a01d972736ccf27276117cc87eb28a7be688855f0b91d8cadabc113d82"\n }\n }, {\n "amount": 60000000, \n "token_amount": 0, \n "target": {\n "key": "b2b17b6ce87d8313e0761413b509425f5fe36a1b4fe5435b2e6cca9907c7f725"\n }\n }, {\n "amount": 10000000000, \n "token_amount": 0, \n "target": {\n "key": "851d2b0819ff44285194d5ad955c2cc7b9fa82b457969b1b22f6ad6a9542dfe0"\n }\n }, {\n "amount": 60000000000, \n "token_amount": 0, \n "target": {\n "key": "c656f2961120271f8390c5a261b96989197dcaf93578730ca030d1fec5a0b147"\n }\n }, {\n "amount": 800000000, \n "token_amount": 0, \n "target": {\n "key": "1d689d0ffb7ffeae430e7ff919b9b4fe47b445683d12729a4335fff7d093504e"\n }\n }, {\n "amount": 500000000000, \n "token_amount": 0, \n "target": {\n "key": "99f3e596201a87ce7758b02f588ac1a6adc63703731d6abc4472cd333587d034"\n }\n }, {\n "amount": 1000000000000, \n "token_amount": 0, \n "target": {\n "key": "e940d0009dd1bbc6d9b3e9265b299dc90e066008604fe5a32ce1d8025c4e079e"\n }\n }, {\n "amount": 60000000000, \n "token_amount": 0, \n "target": {\n "key": "6afe9125b576bd639f6fc29f350bdfc72fadd1241e67a32a4612c5f4d682931a"\n }\n }, {\n "amount": 60000000000, \n "token_amount": 0, \n "target": {\n "key": "7b0908eb0ce0cc2cdd03fddd579654ccb0be44ed143479fbbbc10d98fe7d0c2d"\n }\n }, {\n "amount": 100000000000, \n "token_amount": 0, \n "target": {\n "key": "1a03184fe72241074774de58abe5e538ea9fe51f07b168462088fb5231e84efe"\n }\n }, {\n "amount": 100000000000, \n "token_amount": 0, \n "target": {\n "key": "5e0531ebedd0681ce649e8d7c249b9782eebf7cf54072195c5695d48b716a976"\n }\n }, {\n "amount": 7000000000, \n "token_amount": 0, \n "target": {\n "key": "8ea6580a65d0030836f3bed94588176d84fe1aecfeb8ea8ba282715a376a59a1"\n }\n }, {\n "amount": 20000000000, \n "token_amount": 0, \n "target": {\n "key": "94f23737484b0f61f6afc7a2d92c8c13cc85c2d137ea608e0c3fa031b351350e"\n }\n }\n ], \n "extra": [ 1, 54, 28, 85, 136, 1, 177, 47, 215, 74, 133, 47, 131, 134, 49, 88, 174, 16, 216, 129, 154, 59, 227, 50, 47, 69, 125, 215, 200, 81, 131, 185, 32\n ], \n "signatures": [ "89f606711aac715898705ea21101434ab0bd1668ed258589b923972425002e07696185da84713cc14f34bf0ee5076555e21cc0caaf077454d759a850c530af03df046c98cfb470e3dc49739ccf49147b208bfe62443af5c3b86066e748c5be083b6089a1f7eff54d2f48ab2576a8e6ceebe279d5e6bf3658f56a2bebee95370e9852a7344469a8c7b63a8f0c45debc7692373da4bf98a7469a361ebf7ac66b01464f13903038e937ee6bfced8365f883ae16b6e660710b2f02a3bb160aba240b02b27390c3821d360bca3cc93a264ad26f367bc61ee3b614afa79be340441a0ff3a2e205375dc3d36908834e818f9cd94e082f7a0f2b18cfbe0c33c25fd59e0dd350a542678fa2075d71d4caf23aaefda7a75b32a69ea89331e159f457f36906dcc6e993aaa5f22bf39fa3f8c4c10308fd29b06e29d40a6236aa2b49512eb2038731f88e1e70604ad900858cbd9b51f273be06933a7acbdf456dc48b86f8fa05e6eeb1d37f7fb934dcdbb4c9b913839a079b6e15e29a7abb11185ea2d2388904", "4e53ba794bec525822071de1d1339101efee31690eaa9b54c9eee8adcaa348053d4b62cc126959ec16e3400b97e6f247f289d83189ae0919a70af1de8db0170aa35e8ed796eeb34f0ee20dfdd448212e6bcec5618801806d589a419995a7e903372511cbead1b6857f546e5618e257a743f01e39938d3ddb16da17fdbb9635013733d00139404ab3b31505239e85236983dab153859848fd41da41975abda804a4b5e585a03473e349526567b0ac1db447508a81547b3333ad4a45e617c91b0f26c6007b504596e0cfa16ec31fe519263976588468e18a97efe6f66258a99b05453862a9c75dedb8781fa177be27938760d17f52507757f4147276921299d507c286f5f113f45216aa7f94493fa1eacd843af32629394043dc2e8badcf4ff709fde76c20ce952e9b99c2df51d9712f52865b676dec360930b5b13fe3f57a6b07d53a2163c7ff5ec44e1ae70dbdebc1db0d75f5ad1fa27380cbd6e4e5dd4dd3065cb3913f3dbd4531b0b8c8e4d3cfe20bd6e259fef412fa424599267de1d8420d", "ad1061da360e7715db4ac1240728633d298ef40c5e1f64b4a55506a117de330d837390eb48fcbdface38df67147f3d60814a869f82403044248ae72cc8d7480cf1bfdf75c1b9921c26fb6c394a78224986833536abc38bbe429534a94c21ae085d6e86a8bdb52eb5bcae80ac5b1d2747165d09567f76caee20ba61a70fcece016c784d9d5745c2042466fb05281afd73e7f258a616cd03fc56bb2fccf68edd02121d4a60885ae643cb947742a69ab0118d9828106817d155bf8d7907edd168027f54faeb662a55f0c22bc9b466db9ec859608c54ecb89f833494be5c51964b0a9c51cd52c3e7c0977e5e1dcf5480abcf95ace20cdde92af0e33e97fabfdd3d039924d5ae072d5f3399c35988afa07484dee1a2d63953c88827ac6d1770fc2200bf234755aaa2f0929d2f2ecaf4d1b7ece0f89763b8c0df18d614490044b7cc032740b67ba85be8268fc9634cb33cb82a4f50b0e95277caf46bb810f9e2d80705b314cf509d3607724d3f1d7c10d1169d10c0e513b5f4cdd5a2760090b1c31708", "df039f9d6af2aac93acdec08c4ef837680250bd688ef2363b21442cf2b792e0acab8ef0b0de95c822f3fbc6a4a43f6fd6899879ff974a61eac0934342def1502e29cd709d3b1ac1d8fab8d4366901f1eec8bad52af792e5e0589a8131ea39b007263f3cd26969265d0470d53faf6bd2d807670d0ce7ecd44b5e261d94b22e40ea7e24087fb8322f9747433d9042f33f29822019695398da02eea35e77d2f550a9bf42cb2353eba68820874ce1c519b41a764fb8922dbcadeb964df16db178b0c49ab8a83df5973d620718a0b7f7e16a5201b4c8cee5e637079802b99c89c9204c48f33e59de8398c82d7d63ae37104cd8b28c54a78a22bc9ead8bd27da86c3079b819110a2e0be3f1d19e7b52bf42e0ab28a17925907a2af3f747c4c8800fb0a1903b2f959da7a241c20cef8cedbd8a0cc6bcc3d9e6a2d71a921f8d32fbb78097fe46b15ce9fb6548eeaa26ad8339bfe8b94e7368d11d19349b51bf430588e0ec57f4a47b205cdaa73a254c2fdd5edc36a44b30bfc760990a740a5be1582b805", "e43665e7bcac5d43b3fc52b076885e2af0324b7132e832209fd37ca60288fb0724955ba0f13c53ad782200e9b2d10075fe43e787e8b1d338542dc46c91a5d40bcbd88c40300bf1cfae06d7cbe027d2b08bbb7f0b06f28ba1b2757e0d70562402a1513e2fe5d44e091bb733e1e01c7ccc1033774ac263fdd590fa1b08f6832b09205dc4c41aceb890575dfbf7cf154cf161ffa584049c72b680282e69766d8a0d04926b62eadafac2a77a989b1e1e63a39a13fbbf10bf7a6c8654c2454aeca008ac7b235b7a7046f417859b8e54c5882be11f40aa90afe013d4773c83bb828c00de1d3aec7e5b036a8005a036ddad89a03b5d5ffc60a572dbbce37319142b3307f0016885496ca3b663fdb083ca4b7de20df52102b88d4b63c2ce632752a3300afded148125a1b13f235bc6a23658133d7eef3b6ef928ec3f81fd4c70b0cbfa05b93fa4342b939709a1b346f4925d640de7168fa14ac49a9ef02ca7475cdb9f05336f822ef24da27a1c9107fb5a91fc4637f212ecdb734acc62a085fe4618e905", "8b5ad9dd558a6bf114b620c8dfcdc1b3d4900e9f8e720a684ff52021dc138e0002a129914f6c3302f8487239973faba3562428b6f2b565cc1edca050c6083500bca2dbe15e0c6944a6aacf76c03bcd17e5c4d253f4bf3a310e68cc6958897603ebf4947e6f291e75cecba9aefeb6a142bcca4829b8c99c7aef8c4411f582fc01759c0948b9c1af7c858da768b18ddc00b110fd5f862b967d07ed03eeb353c906ed12c94c309e1ed88c952658cbf62aa7801a42043609c6d9ace7c9ab6160e509c4699dadc1489fcb73be348c5492f1ba86e1244631fb357faa39beb50fc69a000a138068d9c59fad5b3c119c6c1ba1d45d0f42e2fe5521aa7ee0e2fce13acf08ba6cd4300dcd91ab8392781c4794e703c5ab8fc586349c80fbd588df96b7980d89baab83188a1a01613d82a94c05f7f3c5eb6cc034f04e0e6aff5dad50d863051d7230b94795cc3c2dc8ab8f0febf39615a7e4ca2baa743debd6c565d02f3e046bc3eeea200792566c39a0866b696516012ba5ca2f81bd6881b5df6aa1e6b602"]\n}" }], "untrusted": false }


/get_transaction_pool_hashes.bin

Get hashes from transaction pool. Binary request.

Alias: None.

Inputs: None.

Outputs:

  • status - string; General RPC error code. "OK" means everything looks good.
  • tx_hashes - binary array of transaction hashes.
  • untrusted - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

Example:

$ curl http://127.0.0.1:17402/get_transaction_pool_hashes.bin -H 'Content-Type: application/json'

{ "status": "OK", "tx_hashes": " ... ", "untrusted": false }


/get_transaction_pool_stats

Get the transaction pool statistics.

Alias: None.

Inputs: None.

Outputs:

  • pool_stats - Structure as follows:
    • bytes_max - unsigned int; Max transaction size in pool
    • bytes_med - unsigned int; Median transaction size in pool
    • bytes_min - unsigned int; Min transaction size in pool
    • bytes_total - unsigned int; total size of all transactions in pool
    • histo - structure txpool_histo as follows:
      • txs - unsigned int; number of transactions
      • bytes - unsigned int; size in bytes.
    • histo_98pc unsigned int; the time 98% of txes are "younger" than
    • num_10m unsigned int; number of transactions in pool for more than 10 minutes
    • num_double_spends unsigned int; number of double spend transactions
    • num_failing unsigned int; number of failing transactions
    • num_not_relayed unsigned int; number of non-relayed transactions
    • oldest unsigned int; unix time of the oldest transaction in the pool
    • txs_total unsigned int; total number of transactions.
  • status - string; General RPC error code. "OK" means everything looks good.
  • untrusted - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

Example:

$ curl http://127.0.0.1:17402/get_transaction_pool_stats -H 'Content-Type: application/json'

{ "pool_stats": { "bytes_max": 47222, "bytes_med": 13290, "bytes_min": 13092, "bytes_total": 449511, "fee_total": 289715320000, "histo": "\t▒'▒5▒4▒/▒▒▒$3", "histo_98pc": 0, "num_10m": 18, "num_double_spends": 1, "num_failing": 17, "num_not_relayed": 0, "oldest": 1525457001, "txs_total": 26 }, "status": "OK", "untrusted": false }


/stop_daemon

Send a command to the daemon to safely disconnect and shut down.

Alias: None.

Inputs: None.

Outputs:

  • status - string; General RPC error code. "OK" means everything looks good.

Example:

$ curl http://127.0.0.1:17402/stop_daemon -H 'Content-Type: application/json'

{ "status": "OK" }


/get_info (not JSON)

This method is a convenient backward support and should not be used anymore. See get_info JSON RPC for details.

Alias:

  • /getinfo
  • get_info

/get_staked_tokens

Get amount of staked tokens for given interval or current one

Alias: None.

Inputs:

  • interval - unsigned int; Interval we want to get amount of staked tokens or starting interval if end is also given.
  • end - unsigned int; Interval until when we want the info.

Outputs:

  • pairs - array of result_t structure as follows:
    • interval - unsigned int;
    • amount - unsigned int;
  • status - string; General RPC error code. "OK" means everything looks good.

Example:

$ curl http://127.0.0.1:17402/get_staked_tokens -d '{"interval": 661, "end": 665}'  -H 'Content-Type: application/json'
{
  "pairs": [{
    "amount": 645315040000000000,
    "interval": 661
  },{
    "amount": 645315040000000000,
    "interval": 662
  },{
    "amount": 640315040000000000,
    "interval": 663
  },{
    "amount": 640315040000000000,
    "interval": 664
  }],
  "status": ""
}

/get_interest_map

Get amount of Safex cash each staked token can collect for each interval.

Alias: None.

Inputs:

  • begin_interval - unsigned int;
  • end_interval - unsigned int;

Outputs:

  • interest_per_interval - array of result_t structure as follows:
    • interval - unsigned int;
    • cash_per_token - unsigned int;
  • status - string; General RPC error code. "OK" means everything looks good.

Example:

$ curl http://127.0.0.1:17402/get_interest_map -d '{"begin_interval": 607, "end_interval": 615}'  -H 'Content-Type: application/json'

{ "interest_per_interval": [{ "cash_per_token": 0, "interval": 607 },{ "cash_per_token": 0, "interval": 608 },{ "cash_per_token": 0, "interval": 609 },{ "cash_per_token": 15966, "interval": 610 },{ "cash_per_token": 1115, "interval": 611 },{ "cash_per_token": 0, "interval": 612 },{ "cash_per_token": 0, "interval": 613 },{ "cash_per_token": 38448, "interval": 614 },{ "cash_per_token": 0, "interval": 615 }], "status": "OK" }


/get_network_fee

Get amount of network fee collected for given interval or domain of intervals

Alias: None.

Inputs:

  • interval - unsigned int; Interval we want to get amount of network fee or starting interval if end is also given.
  • end - unsigned int; Interval until when we want the info.

Outputs:

  • pairs - array of result_t structure as follows:
    • interval - unsigned int;
    • amount - unsigned int;
  • status - string; General RPC error code. "OK" means everything looks good.

Example:

$ curl http://127.0.0.1:17402/get_network_fee -d '{"interval": 609, "end": 615}'  -H 'Content-Type: application/json'

{ "pairs": [{ "amount": 0, "interval": 609 },{ "amount": 350000000000, "interval": 610 },{ "amount": 25000000000, "interval": 611 },{ "amount": 0, "interval": 612 },{ "amount": 0, "interval": 613 },{ "amount": 1165000000000, "interval": 614 }], "status": "OK" }


/get_safex_account_info

Get Safex account info for given username

Alias: None.

Inputs:

  • username - string;

Outputs:

  • pkey - string; Account public key
  • account_data - string; Account description
  • status - string; General RPC error code. "OK" means everything looks good.

Example:

$ curl http://127.0.0.1:17402/get_safex_account_info -d '{"username": "king"}'  -H 'Content-Type: application/json'

{ "account_data": "selling accounts", "pkey": "d4cd18343d06d8e6a167989c1405acb7c31c3158208ed1719548f16f8505b186", "status": "OK" }


/get_safex_accounts

Get list of all Safex accounts on the blockchain

Alias: None.

Inputs: None.

Outputs:

  • accounts - array of entry structure as follows:
    • username - string;
    • description - string;
  • status - string; General RPC error code. "OK" means everything looks good.
  • untrusted - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

/get_safex_offers

Get list of all Safex offers on the blockchain or all offers by a given seller

Alias: None.

Inputs:

  • seller - string;

Outputs:

  • offers - array of entry structure as follows:
    • title - string;
    • quantity - unsigned int;
    • price - unsigned int;
    • min_sfx_price - unsigned int;
    • description - array of unsigned int;
    • active - boolean;
    • price_peg_used - boolean;
    • shipping - array of unsigned int;
    • offer_id - string;
    • price_peg_id - string;
    • seller - string;
    • seller_address - string;
    • min_sfx_price - unsigned int;
    • height - unsigned int;
  • status - string; General RPC error code. "OK" means everything looks good.
  • untrusted - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

/get_safex_ratings

Get list of all Safex ratings for a given offer on the blockchain

Alias: None.

Inputs:

  • offer_id - crypto::hash;

Outputs:

  • offer_id - crypto::hash;
  • ratings - array of entry structure as follows:
    • comment - string;
    • star_rating - unsigned int;
  • status - string; General RPC error code. "OK" means everything looks good.
  • untrusted - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

/get_safex_price_pegs

Get list of all Safex price pegs or all for a given currency on the blockchain

Alias: None.

Inputs:

  • currency - string;

Outputs:

  • price_pegs - array of entry structure as follows:
    • title - string;
    • price_peg_id - string;
    • creator - string;
    • description - array of unsigned int;
    • currency - string;
    • rate - unsigned int;
  • status - string; General RPC error code. "OK" means everything looks good.
  • untrusted - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

/get_limit

Get daemon bandwidth limits.

Alias: None.

Inputs: None.

Outputs:

  • limit_down - unsigned int; Download limit in kBytes per second
  • limit_up - unsigned int; Upload limit in kBytes per second
  • status - string; General RPC error code. "OK" means everything looks good.
  • untrusted - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

Example:

$ curl http://127.0.0.1:17402/get_limit -H 'Content-Type: application/json'

{ "limit_down": 8192, "limit_up": 128, "status": "OK", "untrusted": false }


/set_limit

Set daemon bandwidth limits.

Alias: None.

Inputs:

  • limit_down - signed int; Download limit in kBytes per second (-1 reset to default, 0 don't change the current limit)
  • limit_up - signed int; Upload limit in kBytes per second (-1 reset to default, 0 don't change the current limit)

Outputs:

  • limit_down - unsigned int; Download limit in kBytes per second
  • limit_up - unsigned int; Upload limit in kBytes per second
  • status - string; General RPC error code. "OK" means everything looks good.

Example:

$ curl http://127.0.0.1:17402/set_limit -d '{"limit_down": 1024}' -H 'Content-Type: application/json'

{ "limit_down": 1024, "limit_up": 128, "status": "OK" }


/out_peers

Limit number of Outgoing peers.

Alias: None.

Inputs:

  • out_peers - unsigned int; Max number of outgoing peers

Outputs:

  • status - string; General RPC error code. "OK" means everything looks good.

Example:

$ curl http://127.0.0.1:17402/out_peers -d '{"out_peers": 3232235535}' -H 'Content-Type: application/json'

{ "status": "OK" }


/in_peers

Limit number of Incoming peers.

Alias: None.

Inputs:

  • in_peers - unsigned int; Max number of incoming peers

Outputs:

  • status - string; General RPC error code. "OK" means everything looks good.

Example:

$ curl http://127.0.0.1:17402/out_peers -d '{"in_peers": 3232235535}' -H 'Content-Type: application/json'

{ "status": "OK" }


/start_save_graph

Obsolete. Conserved here for reference.

Alias: None.

Inputs: None.

Outputs:

  • status - string; General RPC error code. "OK" means everything looks good.

Example:

$ curl http://127.0.0.1:17402/start_save_graph -H 'Content-Type: application/json'

{ "status": "OK" }


/stop_save_graph

Obsolete. Conserved here for reference.

Alias: None.

Inputs: None.

Outputs:

  • status - string; General RPC error code. "OK" means everything looks good.

Example:

$ curl http://127.0.0.1:17402/stop_save_graph -H 'Content-Type: application/json'

{ "status": "OK" }


/get_outs

Get outputs.

Alias: None.

Inputs:

  • outputs - array of structure get_outputs_out as follows:
    • amount - unsigned int;
    • index - unsigned int;
  • out_type - tx_out_type
  • out_type_as_int - unsigned int (used when sending from from generic command. If this field is present, out_type is overriden)

Outputs:

  • outs - array of structure outkey as follows:
    • height - unsigned int; block height of the output
    • key - String; the public key of the output
    • mask - String
    • txid - String; transaction id
    • unlocked - boolean; States if output is locked (false) or not (true)
  • status - string; General RPC error code. "OK" means everything looks good.
  • untrusted - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

RPC documentation

Advanced functionalities

Blockchain logic and database

Manuals

Clone this wiki locally