xcash-daemon-rpc

Use X-Cash RPC Daemon (xcash-daemon-rpc) to interact with a daemon through JSON-RPC commands

JSON RPC Methods

This is a list of the xcashd daemon RPC calls, their inputs and outputs, and examples for each.

Many RPC calls use the daemon's JSON RPC interface while others use their own interfaces, as illustrated below.

Note: "atomic units" refer to the smallest fraction of 1 XCASH according to the xcashd implementation. 1 XCASH = 1e6 atomic units of XCASH.

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 -X POST http://EUSEED1.x-cash.org:18281/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block_count"}' -H 'Content-Type: application/json'
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"count": 425000,
"status": "OK"
}
}

on_get_block_hash

Look up a block's hash by its height.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 inform

Alias: on_getblockhash.

Inputs:

  • block height (int array of length 1)

Outputs:

  • block hash (string)

Example:

$ curl -X POST http://EUSEED1.x-cash.org:18281/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"on_get_block_hash","params":[425000]}' -H 'Content-Type: application/json'
{
"id": "0",
"jsonrpc": "2.0",
"result": "c8580494eca2ce274dcd39a43bb0f0e22328bdf805037b5fe878784f44e64b08"
}

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

Example:

$ curl -X POST http://EUSEED1.x-cash.org:18281/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block_template","params":{"wallet_address":"XCA1XPzaSeXgwrBrGbh96UD5bk21a4WabcrgtB14A7WGGdcagjVQVV1PMAg5Rj1SM3ca8ZPDvysi78HyZF9imGg48wRK2Ntqov","reserve_size":128}' -H 'Content-Type: application/json'
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"blockhashing_blob": "0c0ceadfe6eb051eb5164dfe508a6d7681d8b490a915cde9d0762d1b936beda7d4c9ee8bc9dc280000000093764ab48e856bb76960191001b5a22405ac317156acf4a0e8f9d4947123484303",
"blocktemplate_blob": "0c0ceadfe6eb051eb5164dfe508a6d7681d8b490a915cde9d0762d1b936beda7d4c9ee8bc9dc280000000002c7a31a01ff8ba31a01f69a92cabb0102ecb13a092850dd0387b40a162e6b154c677e6a4a5ab6530b9c508fac4c5b9168a30101b53cfbe508ca940be5544d91c7cb6f34d4a62af1faa16453a3406f443979ca52028000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002acc77f92091e5ebccdd904da4a03e4eb9153f13e338add4b314b436858fb7ea33bc2ea30b4982c4336311f38caed30601f72ae22a44f11ae04ccd59663e135df",
"difficulty": 272538347,
"expected_reward": 50352917878,
"height": 430475,
"prev_hash": "1eb5164dfe508a6d7681d8b490a915cde9d0762d1b936beda7d4c9ee8bc9dc28",
"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 -X POST http://EUSEED1.x-cash.org:18281/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"submit_block","params":["0c0ceadfe6eb051eb5164dfe508a6d7681d8b490a915cde9d0762d1b936beda7d4c9ee8bc9dc280000000002c7a31a01ff8ba31a01f69a92cabb0102ecb13a092850dd0387b40a162e6b154c677e6a4a5ab6530b9c508fac4c5b9168a30101b53cfbe508ca940be5544d91c7cb6f34d4a62af1faa16453a3406f443979ca52028000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002acc77f92091e5ebccdd904da4a03e4eb9153f13e338add4b314b436858fb7ea33bc2ea30b4982c4336311f38caed30601f72ae22a44f11ae04ccd59663e135df"]' -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 X-Cash 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 xcash protocol at this block height.

    • minor_version - unsigned int; The minor version of the xcash protocol at this block height.

    • nonce - unsigned int; a cryptographic random one-time number used in mining a X-Cash 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 units generated in this block and rewarded to the miner. Note: 1 XCASH = 1e6 atomic units.

    • 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 -X POST http://EUSEED1.x-cash.org:18281/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,
"block_weight": 103,
"cumulative_difficulty": 106864747145143,
"depth": 0,
"difficulty": 271286564,
"hash": "062537808276507cb05b5d5f80dbc8dd2bb79a9213be9958dfed1517742cc6a1",
"height": 430477,
"major_version": 12,
"minor_version": 12,
"nonce": 42288,
"num_txes": 0,
"orphan_status": false,
"pow_hash": "",
"prev_hash": "d097546bd225af6957910154f55516072474f6173737ab45cfa50f9134580fb9",
"reward": 50350297727,
"timestamp": 1568256049
},
"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 430477 is looked up by its hash:

$ curl -X POST http://EUSEED1.x-cash.org:18281/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block_header_by_hash","params":{"hash":"062537808276507cb05b5d5f80dbc8dd2bb79a9213be9958dfed1517742cc6a1"}}' -H 'Content-Type: application/json'
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"block_header": {
"block_size": 103,
"block_weight": 103,
"cumulative_difficulty": 106864747145143,
"depth": 1,
"difficulty": 271286564,
"hash": "062537808276507cb05b5d5f80dbc8dd2bb79a9213be9958dfed1517742cc6a1",
"height": 430477,
"major_version": 12,
"minor_version": 12,
"nonce": 42288,
"num_txes": 0,
"orphan_status": false,
"pow_hash": "",
"prev_hash": "d097546bd225af6957910154f55516072474f6173737ab45cfa50f9134580fb9",
"reward": 50350297727,
"timestamp": 1568256049
},
"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 430477 is looked up by its height (notice that the returned information is the same as in the previous example):

$ curl -X POST http://EUSEED1.x-cash.org:18281/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block_header_by_height","params":{"height":430477}}' -H 'Content-Type: application/json'
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"block_header": {
"block_size": 103,
"block_weight": 103,
"cumulative_difficulty": 106864747145143,
"depth": 4,
"difficulty": 271286564,
"hash": "062537808276507cb05b5d5f80dbc8dd2bb79a9213be9958dfed1517742cc6a1",
"height": 430477,
"major_version": 12,
"minor_version": 12,
"nonce": 42288,
"num_txes": 0,
"orphan_status": false,
"pow_hash": "",
"prev_hash": "d097546bd225af6957910154f55516072474f6173737ab45cfa50f9134580fb9",
"reward": 50350297727,
"timestamp": 1568256049
},
"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).

$ curl -X POST http://EUSEED1.x-cash.org:18281/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block_headers_range","params":{"start_height":430477,"end_height":430478}}' -H 'Content-Type: application/json'
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"headers": [{
"block_size": 103,
"block_weight": 103,
"cumulative_difficulty": 106864747145143,
"depth": 5,
"difficulty": 271286564,
"hash": "062537808276507cb05b5d5f80dbc8dd2bb79a9213be9958dfed1517742cc6a1",
"height": 430477,
"major_version": 12,
"minor_version": 12,
"nonce": 42288,
"num_txes": 0,
"orphan_status": false,
"pow_hash": "",
"prev_hash": "d097546bd225af6957910154f55516072474f6173737ab45cfa50f9134580fb9",
"reward": 50350297727,
"timestamp": 1568256049
},{
"block_size": 4137,
"block_weight": 4137,
"cumulative_difficulty": 106865020737874,
"depth": 4,
"difficulty": 273592731,
"hash": "0e078893024b2425652e8d5e4a8f29ae2e31de49784f4953a2293113f1683ece",
"height": 430478,
"major_version": 12,
"minor_version": 12,
"nonce": 3400194129,
"num_txes": 1,
"orphan_status": false,
"pow_hash": "",
"prev_hash": "062537808276507cb05b5d5f80dbc8dd2bb79a9213be9958dfed1517742cc6a1",
"reward": 50351553081,
"timestamp": 1568256056
}],
"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 -

          • 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 430477 is looked up by its height. Note that block 912345 does not have any non-coinbase transactions. (See the next example for a block with extra transactions):

$ curl -X POST http://EUSEED1.x-cash.org:18281/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block","params":{"height":430477}}' -H 'Content-Type: application/json'

Look up by hash:

In the following example, block 430477 is looked up by its hash. Note that block 993056 has 3 non-coinbase transactions:

$ curl -X POST http://EUSEED1.x-cash.org:18281/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block","params":{"hash":"0e078893024b2425652e8d5e4a8f29ae2e31de49784f4953a2293113f1683ece"}}' -H 'Content-Type: application/json'
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"blob": "0c0cb1e0e6eb05d097546bd225af6957910154f55516072474f6173737ab45cfa50f9134580fb930a5000002c9a31a01ff8da31a01ffa4f2c8bb01025ba00bae99b2ec6c7186dcda040cd6d98d28c604f8901bdf33b9d7b2baa91ef334018a8f0ef8e4b77e57ce1a2f887fec07548817f311d07a485e05aeeb9b290d274c021100000042105c1e000000000000000000000000",
"block_header": {
"block_size": 103,
"block_weight": 103,
"cumulative_difficulty": 106864747145143,
"depth": 5,
"difficulty": 271286564,
"hash": "062537808276507cb05b5d5f80dbc8dd2bb79a9213be9958dfed1517742cc6a1",
"height": 430477,
"major_version": 12,
"minor_version": 12,
"nonce": 42288,
"num_txes": 0,
"orphan_status": false,
"pow_hash": "",
"prev_hash": "d097546bd225af6957910154f55516072474f6173737ab45cfa50f9134580fb9",
"reward": 50350297727,
"timestamp": 1568256049
},
"json": "{\n \"major_version\": 12, \n \"minor_version\": 12, \n \"timestamp\": 1568256049, \n \"prev_id\": \"d097546bd225af6957910154f55516072474f6173737ab45cfa50f9134580fb9\", \n \"nonce\": 42288, \n \"miner_tx\": {\n \"version\": 2, \n \"unlock_time\": 430537, \n \"vin\": [ {\n \"gen\": {\n \"height\": 430477\n }\n }\n ], \n \"vout\": [ {\n \"amount\": 50350297727, \n \"target\": {\n \"key\": \"5ba00bae99b2ec6c7186dcda040cd6d98d28c604f8901bdf33b9d7b2baa91ef3\"\n }\n }\n ], \n \"extra\": [ 1, 138, 143, 14, 248, 228, 183, 126, 87, 206, 26, 47, 136, 127, 236, 7, 84, 136, 23, 243, 17, 208, 122, 72, 94, 5, 174, 235, 155, 41, 13, 39, 76, 2, 17, 0, 0, 0, 66, 16, 92, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0\n ], \n \"rct_signatures\": {\n \"type\": 0\n }\n }, \n \"tx_hashes\": [ ]\n}",
"miner_tx_hash": "2e51fbf452789bb4fd27dc85136c97452b96ec33d60b68764bca77743d0966ff",
"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 -X POST http://EUSEED1.x-cash.org:18281/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_connections"}' -H 'Content-Type: application/json'
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"connections": [{
"address": "192.168.1.51:62950",
"avg_download": 0,
"avg_upload": 2,
"connection_id": "083c301a3030329a487adb12ad981d2c",
"current_download": 0,
"current_upload": 2,
"height": 1562127,
"host": "192.168.1.51",
"incoming": true,
"ip": "192.168.1.51",
"live_time": 8,
"local_ip": false,
"localhost": false,
"peer_id": "c959fbfbed9e44fb",
"port": "62950",
"recv_count": 259,
"recv_idle_time": 8,
"send_count": 24342,
"send_idle_time": 8,
"state": "state_normal",
"support_flags": 0
},{
...
}],
"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 -X POST http://EUSEED1.x-cash.org:18281/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": 70,
"block_size_limit": 600000,
"block_size_median": 2637,
"block_weight_limit": 600000,
"block_weight_median": 2637,
"bootstrap_daemon_address": "",
"cumulative_difficulty": 106868133013691,
"database_size": 0,
"difficulty": 282970761,
"free_space": 18446744073709551615,
"grey_peerlist_size": 273,
"height": 430490,
"height_without_bootstrap": 430490,
"incoming_connections_count": 24,
"mainnet": true,
"nettype": "mainnet",
"offline": false,
"outgoing_connections_count": 8,
"rpc_connections_count": 5,
"stagenet": false,
"start_time": 1566064866,
"status": "OK",
"target": 120,
"target_height": 430207,
"testnet": false,
"top_block_hash": "5d0a508ece6b903284260d4835494f5fa3a75495e07c8ad0ed71a5ce97aa0be9",
"tx_count": 1168985,
"tx_pool_size": 3,
"untrusted": false,
"update_available": false,
"was_bootstrap_ever_used": false,
"white_peerlist_size": 1000
}
}

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.

  • 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 -X POST http://EUSEED1.x-cash.org:18281/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": 281000,
"enabled": true,
"state": 1,
"status": "OK",
"threshold": 0,
"untrusted": false,
"version": 12,
"votes": 10080,
"voting": 12,
"window": 10080
}
}

set_bans

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 -X POST http://EUSEED1.x-cash.org:18281/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"set_bans","params":{"bans":[{"host":"192.168.1.51","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 -X POST http://EUSEED1.x-cash.org:18281/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"set_bans","params":{"bans":[{"ip":838969536,"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 -X POST http://EUSEED1.x-cash.org:18281/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_bans"}' -H 'Content-Type: application/json'
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"bans": [{
"host": "102.168.1.51",
"ip": 855746662,
"seconds": 15
},{
"host": "192.168.1.50",
"ip": 838969536,
"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 -X POST http://EUSEED1.x-cash.org:18281/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"flush_txpool"}' -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

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 -X POST http://EUSEED1.x-cash.org:18281/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_output_histogram","params":{"amounts":[100000000000]}}'
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"histogram": [{
"amount": 100000000000,
"recent_instances": 0,
"total_instances": 0,
"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 -X POST http://EUSEED1.x-cash.org:18281/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_coinbase_tx_sum","params":{"height":425000,"count":1}}' -H 'Content-Type: application/json'
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"emission_amount": 9387854817320,
"fee_amount": 83981380000,
"status": "OK"
}
}

get_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 -X POST http://EUSEED1.x-cash.org:18281/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": 131073
}
}

get_fee_estimate

Gives an estimation on fees per kB.

Alias: None.

Inputs:

  • grace_blocks - unsigned int; Optional

Outputs:

  • fee - unsigned int; Amount of fees estimated per kB in atomic units

  • 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 -X POST http://EUSEED1.x-cash.org:18281/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_fee_estimate"}' -H 'Content-Type: application/json'
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"fee": 335,
"quantization_mask": 1,
"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 -X POST http://EUSEED1.x-cash.org:18281/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": "697cf03c89a9b118f7bdf11b1b3a6a028d7b3617d2d0ed91322c5709acf75625",
"difficulty": 14114729638300280,
"height": 1562062,
"length": 2
}],
"status": "OK"
}
}

relay_tx

get_alternate_chainsRelay 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 -X POST http://EUSEED1.x-cash.org:18281/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"relay_tx","params":{"txids":["9fd75c429cbe52da9a52f2ffc5fbd107fe7fd2099c0d8de274dc8a67e0c98613"]}}' -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:

    • info - structure of connection info, as defined in get_connections

  • 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 (optional, absent if node is fully synced)

Example:

$ curl -X POST http://EUSEED1.x-cash.org:18281/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": "192.168.1.51:60064",
"avg_download": 0,
"avg_upload": 5,
"connection_id": "204067223b9b3415c265dd25ad29ee48",
"current_download": 0,
"current_upload": 1,
"height": 1559975,
"host": "192.168.1.51",
"incoming": true,
"ip": "192.168.1.51",
"live_time": 38,
"local_ip": false,
"localhost": false,
"peer_id": "96b8545dbc7a8866",
"port": "60064",
"recv_count": 1580,
"recv_idle_time": 28,
"send_count": 203603,
"send_idle_time": 8,
"state": "state_normal",
"support_flags": 1
}
},{
"info": {
...
}
},{
...
},{
...
},{
...
}],
"status": "OK",
"target_height": 1564067
}
}