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=18281
METHOD='gettransactions'
PARAMS='{"txs_hashes":["d6e48158472848e6687173a91ae6eebfa3e1d778e65252ee99d7515d63090408"]}'
curl \
    -X POST http://$IP:$PORT/$METHOD \
    -d $PARAMS \
    -H 'Content-Type: application/json'

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).

/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:

/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 :

/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. Currently empty or "Not relayed" if transaction was accepted but not relayed.

  • 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).

  • 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).

/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:

/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 xcash 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):

/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:

/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:

Example without input to set the default categories:

/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_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:

      • 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 "transaction ID" but can be used to include any random 32 bytes.

      • rct_signatures - Ring signatures:

        • type

        • txnFee

        • ecdhInfo - array of Diffie Helman Elipctic curves structures as follows:

          • mask - String

          • amount - String

        • outPk

      • rctsig_prunable

        • rangeSigs - array of structures as follows:

          • asig

          • Ci

        • MGs - array of structures as follows:

          • ss - array of arrays of two strings.

          • cc - String

/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:

/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:

/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_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:

/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:

/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:

/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:

/start_save_graph

Alias: None.

Inputs: None.

Outputs:

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

Example:

/stop_save_graph

Alias: None.

Inputs: None.

Outputs:

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

Example:

/get_outs

Get outputs.

Alias: None.

Inputs:

  • outputs array of get_outputs_out structure as follows:

    • amount - unsigned int;

    • index - unsigned int;

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).

/update

Alias: None.

Inputs:

  • command - String; command to use, either check or download

  • path - String; Optional, path where to download the update.

Outputs:

  • auto_uri - string;

  • hash - string;

  • path - String; path to download the update

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

  • update - boolean; States if an update is available to download (true) or not (false)

  • user_uri - string;

  • version - string; Version available for download.

Example:

Last updated