Skip to content

Introduction

This is a list of the RPC calls, their inputs and outputs, and examples of each. This list is autogenerated and was last generated on: 2019-04-08

Many RPC calls use the JSON RPC interface while others use their own interfaces, as demonstrated below.

Note: "atomic units" refer to the smallest fraction of 1 LOKI which is 1e9 atomic units.

RPC Methods


COMMAND_RPC_GET_HEIGHT

Get the node's current height.

Endpoints: /get_height, /getheight

Example Request:

curl -X POST http://127.0.0.1:22023/get_height -d '{ }' -H 'Content-Type: application/json'

Example Response:

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

Inputs:

Outputs:

  • height - uint64: The current blockchain height according to the queried daemon.
  • status - string: Generic RPC error code. "OK" is the success value.
  • untrusted - bool: If the result is obtained using bootstrap mode, and therefore not trusted true, or otherwise false.

COMMAND_RPC_GET_BLOCKS_FAST

Get all blocks info. Binary request.

Endpoints: /get_blocks.bin, /getblocks.bin

Example Request:

curl -X POST http://127.0.0.1:22023/get_blocks.bin -d '
{
  "block_ids": ["bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70", ...],
  "start_height": 123,
  "prune": true,
  "no_miner_tx": true
}' -H 'Content-Type: application/json'

Example Response:

{
  "blocks": [{
      "block": "sd2b5f838e8cc7774d92f5a6ce0d72cb9bd8db2ef28948087f8a50ff46d188dd9",
      "txs": ["sd2b5f838e8cc7774d92f5a6ce0d72cb9bd8db2ef28948087f8a50ff46d188dd9", ...]
    }, ...],
  "start_height": 123,
  "current_height": 123,
  "status": "OK",
  "output_indices": [{
      "indices": [{
          "indices": [123, ...]
        }, ...]
    }, ...],
  "untrusted": false
}

Inputs:

  • block_ids - string[64][]: 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 - uint64: The starting block's height.
  • prune - bool: Prunes the blockchain, drops off 7/8 off the block iirc.
  • no_miner_tx - bool: Optional (false by default).

Outputs:

  • blocks - block_complete_entry[]: Array of block complete entries
    • block - string
    • txs - string[]
  • start_height - uint64: The starting block's height.
  • current_height - uint64: The current block height.
  • status - string: General RPC error code. "OK" means everything looks good.
  • output_indices - block_output_indices[]: Array of indices.
    • indices - tx_output_indices[]: Array of TX output indices:
      • indices - uint64[]: Array of unsigned int.
  • untrusted - bool: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

COMMAND_RPC_GET_BLOCKS_BY_HEIGHT

Get blocks by height. Binary request.

Endpoints: /get_blocks_by_height.bin, /getblocks_by_height.bin

Example Request:

curl -X POST http://127.0.0.1:22023/get_blocks_by_height.bin -d '
{
  "heights": [123, ...]
}' -H 'Content-Type: application/json'

Example Response:

{
  "blocks": [{
      "block": "sd2b5f838e8cc7774d92f5a6ce0d72cb9bd8db2ef28948087f8a50ff46d188dd9",
      "txs": ["sd2b5f838e8cc7774d92f5a6ce0d72cb9bd8db2ef28948087f8a50ff46d188dd9", ...]
    }, ...],
  "status": "OK",
  "untrusted": false
}

Inputs:

  • heights - uint64[]: List of block heights

Outputs:

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

COMMAND_RPC_GET_ALT_BLOCKS_HASHES

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

Endpoints: /get_alt_blocks_hashes

Example Request:

curl -X POST http://127.0.0.1:22023/get_alt_blocks_hashes -d '{ }' -H 'Content-Type: application/json'

Example Response:

{
  "blks_hashes": ["bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70", ...],
  "status": "OK",
  "untrusted": false
}

Inputs:

Outputs:

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

COMMAND_RPC_GET_HASHES_FAST

Get hashes. Binary request.

Endpoints: /get_hashes.bin, /gethashes.bin

Example Request:

curl -X POST http://127.0.0.1:22023/get_hashes.bin -d '
{
  "block_ids": ["bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70", ...],
  "start_height": 123
}' -H 'Content-Type: application/json'

Example Response:

{
  "m_block_ids": ["bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70", ...],
  "start_height": 123,
  "current_height": 123,
  "status": "OK",
  "untrusted": false
}

Inputs:

  • block_ids - string[64][]: 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 - uint64: The starting block's height.

Outputs:

  • m_block_ids - string[64][]: Binary array of hashes, See block_ids above.
  • start_height - uint64: The starting block's height.
  • current_height - uint64: The current block height.
  • status - string: General RPC error code. "OK" means everything looks good.
  • untrusted - bool: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

COMMAND_RPC_GET_ADDRESS_TXS

TODO: Undocumented light wallet RPC call

Inputs:

  • address - string: Address of wallet to receive tx information.
  • view_key - string: View key of Address.

Outputs:

  • total_received - uint64: Total Loki received in atomic units.
  • total_received_unlocked - uint64: OpenMonero only
  • scanned_height - uint64
  • transactions - transaction[]
    • id - uint64: The transaction identifier.
    • hash - string: The hash of this transaction.
    • timestamp - uint64: The unix time at which the block was recorded into the blockchain.
    • total_received - uint64: Total Loki received in atomic units.
    • total_sent - uint64: Total loki sent in atomic units.
    • unlock_time - uint64: Unlock time in blocks.
    • height - uint64: Block height transaction was made.
    • spent_outputs - spent_output[]: List of spent outputs.
      • amount - uint64: Amount transferred.
      • key_image - string: Unique cryptographic key associated with output.
      • tx_pub_key - string: Pubkey associated with transaction.
      • out_index - uint64: Index for transaction.
      • mixin - uint32: The number of other signatures (aside from yours) in the ring signature that authorises the transaction.
    • payment_id - string: The payment ID of the transaction.
    • coinbase - bool: States if the transaction is a coinbase transaction. true if the transaction is coinbase, false if not.
    • mempool - bool: States if the transaction is sitting in the mempool. true if the transaction is,false` if not.
    • mixin - uint32: The number of other signatures (aside from yours) in the ring signature that authorises the transaction.
  • blockchain_height - uint64
  • scanned_block_height - uint64
  • status - string

COMMAND_RPC_GET_ADDRESS_INFO

TODO: Undocumented light wallet RPC call

Inputs:

  • address - string
  • view_key - string

Outputs:

  • locked_funds - uint64
  • total_received - uint64
  • total_sent - uint64
  • scanned_height - uint64
  • scanned_block_height - uint64
  • start_height - uint64
  • transaction_height - uint64
  • blockchain_height - uint64
  • spent_outputs - spent_output[]
    • amount - uint64
    • key_image - string
    • tx_pub_key - string
    • out_index - uint64
    • mixin - uint32

COMMAND_RPC_GET_UNSPENT_OUTS

TODO: Undocumented light wallet RPC call

Inputs:

  • amount - string
  • address - string
  • view_key - string: OpenMonero specific
  • mixin - uint64
  • use_dust - bool
  • dust_threshold - string

Outputs:

  • amount - uint64
  • outputs - output[]
    • amount - uint64
    • public_key - string
    • index - uint64
    • global_index - uint64
    • rct - string
    • tx_hash - string
    • tx_pub_key - string
    • tx_prefix_hash - string
    • spend_key_images - string[]
    • timestamp - uint64
    • height - uint64
  • per_kb_fee - uint64
  • status - string
  • reason - string

COMMAND_RPC_GET_RANDOM_OUTS

TODO: Undocumented light wallet RPC call

Inputs:

  • amounts - string[]
  • count - uint32

Outputs:

  • amount_outs - amount_out[]
    • amount - uint64
    • outputs - output[]
      • public_key - string
      • global_index - uint64
      • rct - string: 64+64+64 characters long ( + + )
  • Error - string

COMMAND_RPC_SUBMIT_RAW_TX

TODO: Undocumented light wallet RPC call

Inputs:

  • address - string
  • view_key - string
  • tx - string

Outputs:

  • status - string
  • error - string

COMMAND_RPC_LOGIN

TODO: Undocumented light wallet RPC call

Inputs:

  • address - string
  • view_key - string
  • create_account - bool

Outputs:

  • status - string
  • reason - string
  • new_address - bool

COMMAND_RPC_IMPORT_WALLET_REQUEST

TODO: Undocumented light wallet RPC call

Inputs:

  • address - string
  • view_key - string

Outputs:

  • payment_id - string
  • import_fee - uint64
  • new_request - bool
  • request_fulfilled - bool
  • payment_address - string
  • status - string

COMMAND_RPC_GET_TRANSACTIONS

Look up one or more transactions by hash.

Endpoints: /get_transactions, /gettransactions

Example Request:

curl -X POST http://127.0.0.1:22023/get_transactions -d '
{
  "txs_hashes": ["b605cab7e3b9fe1f6d322e3167cd26e1e61c764afa9d733233ef716787786123", ...],
  "decode_as_json": true,
  "prune": true,
  "split": true
}' -H 'Content-Type: application/json'

Example Response:

{
  "txs_as_hex": ["TODO(loki): Write example string", ...],
  "txs_as_json": ["TODO(loki): Write example string", ...],
  "missed_tx": ["b605cab7e3b9fe1f6d322e3167cd26e1e61c764afa9d733233ef716787786123", ...],
  "txs": [{
      "tx_hash": "b605cab7e3b9fe1f6d322e3167cd26e1e61c764afa9d733233ef716787786123",
      "as_hex": "TODO(loki): Write example string",
      "pruned_as_hex": "TODO(loki): Write example string",
      "prunable_as_hex": "TODO(loki): Write example string",
      "prunable_hash": "b605cab7e3b9fe1f6d322e3167cd26e1e61c764afa9d733233ef716787786123",
      "as_json": "TODO(loki): Write example string",
      "in_pool": true,
      "double_spend_seen": true,
      "block_height": 123,
      "block_timestamp": 123,
      "output_indices": [123, ...]
    }, ...],
  "status": "OK",
  "untrusted": false
}

Inputs:

  • txs_hashes - string[]: List of transaction hashes to look up.
  • decode_as_json - bool: Optional (false by default). If set true, the returned transaction information will be decoded rather than binary.
  • prune - bool: Prunes the blockchain, drops off 7/8 off the block iirc. Optional (False by default).
  • split - bool: Optional (false by default).

Outputs:

  • txs_as_hex - string[]: Full transaction information as a hex string (old compatibility parameter)
  • txs_as_json - string[]: Transactions decoded as json (old compat)
  • missed_tx - string[]: (Optional - returned if not empty) Transaction hashes that could not be found.
  • txs - entry[]: Array of structure entry as follows:
    • tx_hash - string: Transaction hash.
    • as_hex - string: Full transaction information as a hex string.
    • pruned_as_hex - string
    • prunable_as_hex - string
    • prunable_hash - string
    • as_json - string: List of transaction info.
    • in_pool - bool: States if the transaction is in pool (true) or included in a block (false).
    • double_spend_seen - bool: States if the transaction is a double-spend (true) or not (false).
    • block_height - uint64: Block height including the transaction.
    • block_timestamp - uint64: Unix time at chich the block has been added to the blockchain.
    • output_indices - uint64[]: List of transaction indexes.
  • status - string: General RPC error code. "OK" means everything looks good.
  • untrusted - bool: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

COMMAND_RPC_IS_KEY_IMAGE_SPENT

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

Endpoints: /is_key_image_spent

Example Request:

curl -X POST http://127.0.0.1:22023/is_key_image_spent -d '
{
  "key_images": ["TODO(loki): Write example string", ...]
}' -H 'Content-Type: application/json'

Example Response:

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

Inputs:

  • key_images - string[]: List of key image hex strings to check.

Outputs:

  • spent_status - int[]: 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 - bool: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

COMMAND_RPC_GET_TX_GLOBAL_OUTPUTS_INDEXES

Get global outputs of transactions. Binary request.

Endpoints: /get_o_indexes.bin

Example Request:

curl -X POST http://127.0.0.1:22023/get_o_indexes.bin -d '
{
  "txid": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70"
}' -H 'Content-Type: application/json'

Example Response:

{
  "o_indexes": [123, ...],
  "status": "OK",
  "untrusted": false
}

Inputs:

  • txid - string[64]: Binary txid.

Outputs:

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

COMMAND_RPC_GET_OUTPUTS_BIN

Get outputs. Binary request.

Endpoints: /get_outs.bin

Example Request:

curl -X POST http://127.0.0.1:22023/get_outs.bin -d '
{
  "outputs": [{
      "amount": 123,
      "index": 123
    }, ...],
  "get_txid": true
}' -H 'Content-Type: application/json'

Example Response:

{
  "outs": [{
      "key": ,
      "mask": ,
      "unlocked": true,
      "height": 234767,
      "txid": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70"
    }, ...],
  "status": "OK",
  "untrusted": false
}

Inputs:

  • outputs - get_outputs_out[]: Array of structure get_outputs_out.
    • amount - uint64: Amount of Loki in TXID.
    • index - uint64
  • get_txid - bool: TXID

Outputs:

  • outs - outkey[]: List of outkey information.
    • key - crypto::public_key: The public key of the output.
    • mask - rct::key
    • unlocked - bool: States if output is locked (false) or not (true).
    • height - uint64: Block height of the output.
    • txid - string[64]: Transaction id.
  • status - string: General RPC error code. "OK" means everything looks good.
  • untrusted - bool: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

COMMAND_RPC_GET_OUTPUTS

Endpoints: /get_outs

Example Request:

curl -X POST http://127.0.0.1:22023/get_outs -d '
{
  "outputs": [{
      "amount": 123,
      "index": 123
    }, ...]
}' -H 'Content-Type: application/json'

Example Response:

{
  "outs": [{
      "key": "TODO(loki): Write example string",
      "mask": "TODO(loki): Write example string",
      "unlocked": true,
      "height": 234767,
      "txid": "b605cab7e3b9fe1f6d322e3167cd26e1e61c764afa9d733233ef716787786123"
    }, ...],
  "status": "OK",
  "untrusted": false
}

Inputs:

  • outputs - get_outputs_out[]: Array of structure get_outputs_out.
    • amount - uint64: Amount of Loki in TXID.
    • index - uint64

Outputs:

  • outs - outkey[]: List of outkey information.
    • key - string: The public key of the output.
    • mask - string
    • unlocked - bool: States if output is locked (false) or not (true).
    • height - uint64: Block height of the output.
    • txid - string: Transaction id.
  • status - string: General RPC error code. "OK" means everything looks good.
  • untrusted - bool: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

COMMAND_RPC_SEND_RAW_TX

Broadcast a raw transaction to the network.

Endpoints: /send_raw_transaction, /sendrawtransaction

Example Request:

curl -X POST http://127.0.0.1:22023/send_raw_transaction -d '
{
  "tx_as_hex": "TODO(loki): Write example string",
  "do_not_relay": true
}' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK",
  "reason": "TODO(loki): Write example string",
  "not_relayed": true,
  "untrusted": false,
  "tvc": 
}

Inputs:

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

Outputs:

  • 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 - bool: Transaction was not relayed (true) or relayed (false).
  • untrusted - bool: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).
  • tvc - tx_verification_context

COMMAND_RPC_START_MINING

Start mining on the daemon.

Endpoints: /start_mining

Example Request:

curl -X POST http://127.0.0.1:22023/start_mining -d '
{
  "miner_address": "L8KJf3nRQ53NTX1YLjtHryjegFRa3ZCEGLKmRxUfvkBWK19UteEacVpYqpYscSJ2q8WRuHPFdk7Q5W8pQB7Py5kvUs8vKSk",
  "threads_count": 123,
  "do_background_mining": true,
  "ignore_battery": true
}' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK"
}

Inputs:

  • miner_address - string: Account address to mine to.
  • threads_count - uint64: Number of mining thread to run.
  • do_background_mining - bool: States if the mining should run in background (true) or foreground (false).
  • ignore_battery - bool: States if battery state (on laptop) should be ignored (true) or not (false).

Outputs:

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

COMMAND_RPC_GET_INFO

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

Endpoints: /get_info, /getinfo, get_info

Example Request:

curl -X POST http://127.0.0.1:22023/json_rpc -d '{ "jsonrpc":"2.0", "id":"0", "method":"get_info"}' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK",
  "height": 234767,
  "target_height": 123,
  "difficulty": 123,
  "target": 123,
  "tx_count": 123,
  "tx_pool_size": 123,
  "alt_blocks_count": 123,
  "outgoing_connections_count": 123,
  "incoming_connections_count": 123,
  "rpc_connections_count": 123,
  "white_peerlist_size": 123,
  "grey_peerlist_size": 123,
  "mainnet": true,
  "testnet": true,
  "stagenet": true,
  "nettype": "MAINNET",
  "top_block_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
  "cumulative_difficulty": 123,
  "block_size_limit": 123,
  "block_weight_limit": 123,
  "block_size_median": 123,
  "block_weight_median": 123,
  "start_time": 123,
  "free_space": 123,
  "offline": true,
  "untrusted": false,
  "bootstrap_daemon_address": "127.0.0.1:22023",
  "height_without_bootstrap": 123,
  "was_bootstrap_ever_used": true,
  "database_size": 123,
  "update_available": true,
  "version": "TODO(loki): Write example string"
}

Inputs:

Outputs:

  • status - string: General RPC error code. "OK" means everything looks good.
  • height - uint64: Current length of longest chain known to daemon.
  • target_height - uint64: The height of the next block in the chain.
  • difficulty - uint64: Network difficulty (analogous to the strength of the network).
  • target - uint64: Current target for next proof of work.
  • tx_count - uint64: Total number of non-coinbase transaction in the chain.
  • tx_pool_size - uint64: Number of transactions that have been broadcast but not included in a block.
  • alt_blocks_count - uint64: Number of alternative blocks to main chain.
  • outgoing_connections_count - uint64: Number of peers that you are connected to and getting information from.
  • incoming_connections_count - uint64: Number of peers connected to and pulling from your node.
  • rpc_connections_count - uint64: Number of RPC client connected to the daemon (Including this RPC request).
  • white_peerlist_size - uint64: White Peerlist Size
  • grey_peerlist_size - uint64: Grey Peerlist Size
  • mainnet - bool: States if the node is on the mainnet (true) or not (false).
  • testnet - bool: States if the node is on the testnet (true) or not (false).
  • stagenet - bool: States if the node is on the stagenet (true) or not (false).
  • nettype - string: Nettype value used.
  • top_block_hash - string: Hash of the highest block in the chain.
  • cumulative_difficulty - uint64: Cumulative difficulty of all blocks in the blockchain.
  • block_size_limit - uint64: Maximum allowed block size.
  • block_weight_limit - uint64: Maximum allowed block weight.
  • block_size_median - uint64: Median block size of latest 100 blocks.
  • block_weight_median - uint64: Median block weight of latest 100 blocks.
  • start_time - uint64: Start time of the daemon, as UNIX time.
  • free_space - uint64: Available disk space on the node.
  • offline - bool: States if the node is offline (true) or online (false).
  • untrusted - bool: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).
  • 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).
  • height_without_bootstrap - uint64: Current length of the local chain of the daemon.
  • was_bootstrap_ever_used - bool: States if a bootstrap node has ever been used since the daemon started.
  • database_size - uint64: Current size of Blockchain data.
  • update_available - bool: States if a update is available ('true') and if one is not available ('false').
  • version - string: Current version of software running.

COMMAND_RPC_GET_ALL_SERVICE_NODES_KEYS

Retrieve all Service Node Keys.

Endpoints: get_all_service_nodes_keys

Example Request:

curl -X POST http://127.0.0.1:22023/json_rpc -d '
{
  "jsonrpc":"2.0", "id":"0", "method":"get_all_service_nodes_keys",
  "params": {
    "fully_funded_nodes_only": true
  }
}' -H 'Content-Type: application/json'

Example Response:

{
  "keys": ["TODO(loki): Write example string", ...]
}

Inputs:

  • fully_funded_nodes_only - bool: Return keys for service nodes if they are funded and working on the network

Outputs:

  • keys - string[]: Returns as base32z of the hex key, for Lokinet internal usage

COMMAND_RPC_STOP_MINING

Stop mining on the daemon.

Endpoints: /stop_mining

Example Request:

curl -X POST http://127.0.0.1:22023/stop_mining -d '{ }' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK"
}

Inputs:

Outputs:

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

COMMAND_RPC_MINING_STATUS

Get the mining status of the daemon.

Endpoints: /mining_status

Example Request:

curl -X POST http://127.0.0.1:22023/mining_status -d '{ }' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK",
  "active": true,
  "speed": 123,
  "threads_count": 8,
  "address": "L8KJf3nRQ53NTX1YLjtHryjegFRa3ZCEGLKmRxUfvkBWK19UteEacVpYqpYscSJ2q8WRuHPFdk7Q5W8pQB7Py5kvUs8vKSk",
  "is_background_mining_enabled": true
}

Inputs:

Outputs:

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

COMMAND_RPC_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 Hardware crashes.

Endpoints: /save_bc

Example Request:

curl -X POST http://127.0.0.1:22023/save_bc -d '{ }' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK"
}

Inputs:

Outputs:

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

COMMAND_RPC_GETBLOCKCOUNT

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

Endpoints: get_block_count, getblockcount

Example Request:

curl -X POST http://127.0.0.1:22023/json_rpc -d '
{
  "jsonrpc":"2.0", "id":"0", "method":"getblockcount",
  "params": {
    "request": ["TODO(loki): Write example string", ...]
  }
}' -H 'Content-Type: application/json'

Example Response:

{
  "count": 123,
  "status": "OK"
}

Inputs:

  • request - string[]

Outputs:

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

COMMAND_RPC_GETBLOCKHASH

Look up a block's hash by its height.

Endpoints: on_get_block_hash, on_getblockhash

Example Request:

curl -X POST http://127.0.0.1:22023/json_rpc -d '
{
  "jsonrpc":"2.0", "id":"0", "method":"on_getblockhash",
  "params": {
    "request": [123, ...]
  }
}' -H 'Content-Type: application/json'

Example Response:

{
  "response": "TODO(loki): Write example string"
}

Inputs:

  • request - uint64[]: Block height (int array of length 1).

Outputs:

  • response - string: Block hash (string).

COMMAND_RPC_GETBLOCKTEMPLATE

Get a block template on which mining a new block.

Endpoints: get_block_template, getblocktemplate

Example Request:

curl -X POST http://127.0.0.1:22023/json_rpc -d '
{
  "jsonrpc":"2.0", "id":"0", "method":"getblocktemplate",
  "params": {
    "reserve_size": 123,
    "wallet_address": "L8KJf3nRQ53NTX1YLjtHryjegFRa3ZCEGLKmRxUfvkBWK19UteEacVpYqpYscSJ2q8WRuHPFdk7Q5W8pQB7Py5kvUs8vKSk"
  }
}' -H 'Content-Type: application/json'

Example Response:

{
  "difficulty": 123,
  "height": 234767,
  "reserved_offset": 123,
  "expected_reward": 123,
  "prev_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
  "blocktemplate_blob": "sd2b5f838e8cc7774d92f5a6ce0d72cb9bd8db2ef28948087f8a50ff46d188dd9",
  "blockhashing_blob": "sd2b5f838e8cc7774d92f5a6ce0d72cb9bd8db2ef28948087f8a50ff46d188dd9",
  "status": "OK",
  "untrusted": false
}

Inputs:

  • reserve_size - uint64: Max 255 bytes
  • wallet_address - string: Address of wallet to receive coinbase transactions if block is successfully mined.

Outputs:

  • difficulty - uint64: Difficulty of next block.
  • height - uint64: Height on which to mine.
  • reserved_offset - uint64: Reserved offset.
  • expected_reward - uint64: Coinbase reward expected to be received if block is successfully mined.
  • prev_hash - string: Hash of the most recent block on which to mine the next block.
  • 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.
  • status - string: General RPC error code. "OK" means everything looks good.
  • untrusted - bool: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

COMMAND_RPC_SUBMITBLOCK

Submit a mined block to the network.

Endpoints: submit_block, submitblock

Example Request:

curl -X POST http://127.0.0.1:22023/json_rpc -d '
{
  "jsonrpc":"2.0", "id":"0", "method":"submitblock",
  "params": {
    "request": ["TODO(loki): Write example string", ...]
  }
}' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK"
}

Inputs:

  • request - string[]: 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.

COMMAND_RPC_GENERATEBLOCKS

Developer only.

Endpoints: generateblocks

Example Request:

curl -X POST http://127.0.0.1:22023/json_rpc -d '
{
  "jsonrpc":"2.0", "id":"0", "method":"generateblocks",
  "params": {
    "amount_of_blocks": 123,
    "wallet_address": "L8KJf3nRQ53NTX1YLjtHryjegFRa3ZCEGLKmRxUfvkBWK19UteEacVpYqpYscSJ2q8WRuHPFdk7Q5W8pQB7Py5kvUs8vKSk"
  }
}' -H 'Content-Type: application/json'

Example Response:

{
  "height": 234767,
  "status": "OK"
}

Inputs:

  • amount_of_blocks - uint64
  • wallet_address - string

Outputs:

  • height - uint64
  • status - string: General RPC error code. "OK" means everything looks good.

COMMAND_RPC_GET_LAST_BLOCK_HEADER

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

Endpoints: get_last_block_header, getlastblockheader

Example Request:

curl -X POST http://127.0.0.1:22023/json_rpc -d '
{
  "jsonrpc":"2.0", "id":"0", "method":"getlastblockheader",
  "params": {
    "fill_pow_hash": true
  }
}' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK",
  "block_header": {
    "major_version": 11,
    "minor_version": 11,
    "timestamp": 123,
    "prev_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
    "nonce": 2130706433,
    "orphan_status": true,
    "height": 234767,
    "depth": 123,
    "hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
    "difficulty": 25179406071,
    "cumulative_difficulty": 25179406071,
    "reward": 123,
    "miner_reward": 123,
    "block_size": 123,
    "block_weight": 123,
    "num_txes": 123,
    "pow_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
    "long_term_weight": 123
  },
  "untrusted": false
}

Inputs:

  • fill_pow_hash - bool: Tell the daemon if it should fill out pow_hash field.

Outputs:

  • status - string: General RPC error code. "OK" means everything looks good.
  • block_header - block_header_response: A structure containing block header information.
    • major_version - uint8: The major version of the loki protocol at this block height.
    • minor_version - uint8: The minor version of the loki protocol at this block height.
    • timestamp - uint64: The unix time at which the block was recorded into the blockchain.
    • prev_hash - string: The hash of the block immediately preceding this block in the chain.
    • nonce - uint32: A cryptographic random one-time number used in mining a Loki block.
    • orphan_status - bool: Usually false. If true, this block is not part of the longest chain.
    • height - uint64: The number of blocks preceding this block on the blockchain.
    • depth - uint64: The number of blocks succeeding this block on the blockchain. A larger number means an older block.
    • hash - string: The hash of this block.
    • difficulty - uint64: The strength of the Loki network based on mining power.
    • cumulative_difficulty - uint64: The cumulative strength of the Loki network based on mining power.
    • reward - uint64: The amount of new generated in this block and rewarded to the miner, foundation and service Nodes. Note: 1 LOKI = 1e12 atomic units.
    • miner_reward - uint64: The amount of new generated in this block and rewarded to the miner. Note: 1 LOKI = 1e12 atomic units.
    • block_size - uint64: The block size in bytes.
    • block_weight - uint64: The block weight in bytes.
    • num_txes - uint64: Number of transactions in the block, not counting the coinbase tx.
    • pow_hash - string: The hash of the block's proof of work.
    • long_term_weight - uint64: Long term weight of the block.
  • untrusted - bool: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

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

Endpoints: get_block_header_by_hash, getblockheaderbyhash

Example Request:

curl -X POST http://127.0.0.1:22023/json_rpc -d '
{
  "jsonrpc":"2.0", "id":"0", "method":"getblockheaderbyhash",
  "params": {
    "hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
    "fill_pow_hash": true
  }
}' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK",
  "block_header": {
    "major_version": 11,
    "minor_version": 11,
    "timestamp": 123,
    "prev_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
    "nonce": 2130706433,
    "orphan_status": true,
    "height": 234767,
    "depth": 123,
    "hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
    "difficulty": 25179406071,
    "cumulative_difficulty": 25179406071,
    "reward": 123,
    "miner_reward": 123,
    "block_size": 123,
    "block_weight": 123,
    "num_txes": 123,
    "pow_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
    "long_term_weight": 123
  },
  "untrusted": false
}

Inputs:

  • hash - string: The block's SHA256 hash.
  • fill_pow_hash - bool: Tell the daemon if it should fill out pow_hash field.

Outputs:

  • status - string: General RPC error code. "OK" means everything looks good.
  • block_header - block_header_response: A structure containing block header information.
    • major_version - uint8: The major version of the loki protocol at this block height.
    • minor_version - uint8: The minor version of the loki protocol at this block height.
    • timestamp - uint64: The unix time at which the block was recorded into the blockchain.
    • prev_hash - string: The hash of the block immediately preceding this block in the chain.
    • nonce - uint32: A cryptographic random one-time number used in mining a Loki block.
    • orphan_status - bool: Usually false. If true, this block is not part of the longest chain.
    • height - uint64: The number of blocks preceding this block on the blockchain.
    • depth - uint64: The number of blocks succeeding this block on the blockchain. A larger number means an older block.
    • hash - string: The hash of this block.
    • difficulty - uint64: The strength of the Loki network based on mining power.
    • cumulative_difficulty - uint64: The cumulative strength of the Loki network based on mining power.
    • reward - uint64: The amount of new generated in this block and rewarded to the miner, foundation and service Nodes. Note: 1 LOKI = 1e12 atomic units.
    • miner_reward - uint64: The amount of new generated in this block and rewarded to the miner. Note: 1 LOKI = 1e12 atomic units.
    • block_size - uint64: The block size in bytes.
    • block_weight - uint64: The block weight in bytes.
    • num_txes - uint64: Number of transactions in the block, not counting the coinbase tx.
    • pow_hash - string: The hash of the block's proof of work.
    • long_term_weight - uint64: Long term weight of the block.
  • untrusted - bool: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

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

Endpoints: get_block_header_by_height, getblockheaderbyheight

Example Request:

curl -X POST http://127.0.0.1:22023/json_rpc -d '
{
  "jsonrpc":"2.0", "id":"0", "method":"getblockheaderbyheight",
  "params": {
    "height": 234767,
    "fill_pow_hash": true
  }
}' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK",
  "block_header": {
    "major_version": 11,
    "minor_version": 11,
    "timestamp": 123,
    "prev_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
    "nonce": 2130706433,
    "orphan_status": true,
    "height": 234767,
    "depth": 123,
    "hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
    "difficulty": 25179406071,
    "cumulative_difficulty": 25179406071,
    "reward": 123,
    "miner_reward": 123,
    "block_size": 123,
    "block_weight": 123,
    "num_txes": 123,
    "pow_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
    "long_term_weight": 123
  },
  "untrusted": false
}

Inputs:

  • height - uint64: The block's height.
  • fill_pow_hash - bool: Tell the daemon if it should fill out pow_hash field.

Outputs:

  • status - string: General RPC error code. "OK" means everything looks good.
  • block_header - block_header_response: A structure containing block header information.
    • major_version - uint8: The major version of the loki protocol at this block height.
    • minor_version - uint8: The minor version of the loki protocol at this block height.
    • timestamp - uint64: The unix time at which the block was recorded into the blockchain.
    • prev_hash - string: The hash of the block immediately preceding this block in the chain.
    • nonce - uint32: A cryptographic random one-time number used in mining a Loki block.
    • orphan_status - bool: Usually false. If true, this block is not part of the longest chain.
    • height - uint64: The number of blocks preceding this block on the blockchain.
    • depth - uint64: The number of blocks succeeding this block on the blockchain. A larger number means an older block.
    • hash - string: The hash of this block.
    • difficulty - uint64: The strength of the Loki network based on mining power.
    • cumulative_difficulty - uint64: The cumulative strength of the Loki network based on mining power.
    • reward - uint64: The amount of new generated in this block and rewarded to the miner, foundation and service Nodes. Note: 1 LOKI = 1e12 atomic units.
    • miner_reward - uint64: The amount of new generated in this block and rewarded to the miner. Note: 1 LOKI = 1e12 atomic units.
    • block_size - uint64: The block size in bytes.
    • block_weight - uint64: The block weight in bytes.
    • num_txes - uint64: Number of transactions in the block, not counting the coinbase tx.
    • pow_hash - string: The hash of the block's proof of work.
    • long_term_weight - uint64: Long term weight of the block.
  • untrusted - bool: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

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

Endpoints: get_block, getblock

Example Request:

curl -X POST http://127.0.0.1:22023/json_rpc -d '
{
  "jsonrpc":"2.0", "id":"0", "method":"getblock",
  "params": {
    "hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
    "height": 234767,
    "fill_pow_hash": true
  }
}' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK",
  "block_header": {
    "major_version": 11,
    "minor_version": 11,
    "timestamp": 123,
    "prev_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
    "nonce": 2130706433,
    "orphan_status": true,
    "height": 234767,
    "depth": 123,
    "hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
    "difficulty": 25179406071,
    "cumulative_difficulty": 25179406071,
    "reward": 123,
    "miner_reward": 123,
    "block_size": 123,
    "block_weight": 123,
    "num_txes": 123,
    "pow_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
    "long_term_weight": 123
  },
  "miner_tx_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
  "tx_hashes": ["b605cab7e3b9fe1f6d322e3167cd26e1e61c764afa9d733233ef716787786123", ...],
  "blob": "TODO(loki): Write example string",
  "json": "TODO(loki): Write example string",
  "untrusted": false
}

Inputs:

  • hash - string: The block's hash.
  • height - uint64: The block's height.
  • fill_pow_hash - bool: Tell the daemon if it should fill out pow_hash field.

Outputs:

  • status - string: General RPC error code. "OK" means everything looks good.
  • block_header - block_header_response: A structure containing block header information. See get_last_block_header.
    • major_version - uint8: The major version of the loki protocol at this block height.
    • minor_version - uint8: The minor version of the loki protocol at this block height.
    • timestamp - uint64: The unix time at which the block was recorded into the blockchain.
    • prev_hash - string: The hash of the block immediately preceding this block in the chain.
    • nonce - uint32: A cryptographic random one-time number used in mining a Loki block.
    • orphan_status - bool: Usually false. If true, this block is not part of the longest chain.
    • height - uint64: The number of blocks preceding this block on the blockchain.
    • depth - uint64: The number of blocks succeeding this block on the blockchain. A larger number means an older block.
    • hash - string: The hash of this block.
    • difficulty - uint64: The strength of the Loki network based on mining power.
    • cumulative_difficulty - uint64: The cumulative strength of the Loki network based on mining power.
    • reward - uint64: The amount of new generated in this block and rewarded to the miner, foundation and service Nodes. Note: 1 LOKI = 1e12 atomic units.
    • miner_reward - uint64: The amount of new generated in this block and rewarded to the miner. Note: 1 LOKI = 1e12 atomic units.
    • block_size - uint64: The block size in bytes.
    • block_weight - uint64: The block weight in bytes.
    • num_txes - uint64: Number of transactions in the block, not counting the coinbase tx.
    • pow_hash - string: The hash of the block's proof of work.
    • long_term_weight - uint64: Long term weight of the block.
  • miner_tx_hash - string: Miner transaction information
  • tx_hashes - string[]: List of hashes of non-coinbase transactions in the block. If there are no other transactions, this will be an empty list.
  • blob - string: Hexadecimal blob of block information.
  • json - string: JSON formatted block details.
  • untrusted - bool: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

COMMAND_RPC_SET_LOG_HASH_RATE

Set the log hash rate display mode.

Endpoints: /set_log_hash_rate

Example Request:

curl -X POST http://127.0.0.1:22023/set_log_hash_rate -d '
{
  "visible": true
}' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK"
}

Inputs:

  • visible - bool: 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.

COMMAND_RPC_SET_LOG_LEVEL

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

Endpoints: /set_log_level

Example Request:

curl -X POST http://127.0.0.1:22023/set_log_level -d '
{
  "level": 8
}' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK"
}

Inputs:

  • level - int8: 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.

COMMAND_RPC_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.trottle, 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.

Endpoints: /set_log_categories

Example Request:

curl -X POST http://127.0.0.1:22023/set_log_categories -d '
{
  "categories": "TODO(loki): Write example string"
}' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK",
  "categories": "TODO(loki): Write example string"
}

Inputs:

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

Outputs:

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

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

Endpoints: /get_transaction_pool

Example Request:

curl -X POST http://127.0.0.1:22023/get_transaction_pool -d '{ }' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK",
  "transactions": [{
      "id_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
      "tx_json": "TODO(loki): Write example string",
      "blob_size": 123,
      "weight": 123,
      "fee": 123,
      "max_used_block_id_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
      "max_used_block_height": 123,
      "kept_by_block": true,
      "last_failed_height": 123,
      "last_failed_id_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
      "receive_time": 123,
      "relayed": true,
      "last_relayed_time": 123,
      "do_not_relay": true,
      "double_spend_seen": true,
      "tx_blob": "TODO(loki): Write example string"
    }, ...],
  "spent_key_images": [{
      "id_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
      "txs_hashes": ["b605cab7e3b9fe1f6d322e3167cd26e1e61c764afa9d733233ef716787786123", ...]
    }, ...],
  "untrusted": false
}

Inputs:

Outputs:

  • status - string: General RPC error code. "OK" means everything looks good.
  • transactions - tx_info[]: List of transactions in the mempool are not in a block on the main chain at the moment:
    • id_hash - string: The transaction ID hash.
    • tx_json - string: JSON structure of all information in the transaction
    • blob_size - uint64: The size of the full transaction blob.
    • weight - uint64: The weight of the transaction.
    • fee - uint64: The amount of the mining fee included in the transaction, in atomic units.
    • max_used_block_id_hash - string: Tells the hash of the most recent block with an output used in this transaction.
    • max_used_block_height - uint64: Tells the height of the most recent block with an output used in this transaction.
    • kept_by_block - bool: States if the tx was included in a block at least once (true) or not (false).
    • last_failed_height - uint64: 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.
    • receive_time - uint64: The Unix time that the transaction was first seen on the network by the node.
    • relayed - bool: States if this transaction has been relayed
    • last_relayed_time - uint64: Last unix time at which the transaction has been relayed.
    • do_not_relay - bool: States if this transaction should not be relayed.
    • double_spend_seen - bool: States if this transaction has been seen as double spend.
    • tx_blob - string: Hexadecimal blob represnting the transaction.
  • spent_key_images - spent_key_image_info[]: List of spent output key images:
    • id_hash - string: Key image.
    • txs_hashes - string[]: List of tx hashes of the txes (usually one) spending that key image.
  • untrusted - bool: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

COMMAND_RPC_GET_TRANSACTION_POOL_HASHES_BIN

Get hashes from transaction pool. Binary request.

Endpoints: /get_transaction_pool_hashes.bin

Example Request:

curl -X POST http://127.0.0.1:22023/get_transaction_pool_hashes.bin -d '{ }' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK",
  "tx_hashes": ["bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70", ...],
  "untrusted": false
}

Inputs:

Outputs:

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

COMMAND_RPC_GET_TRANSACTION_POOL_HASHES

Get hashes from transaction pool.

Endpoints: /get_transaction_pool_hashes

Example Request:

curl -X POST http://127.0.0.1:22023/get_transaction_pool_hashes -d '{ }' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK",
  "tx_hashes": ["b605cab7e3b9fe1f6d322e3167cd26e1e61c764afa9d733233ef716787786123", ...],
  "untrusted": false
}

Inputs:

Outputs:

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

COMMAND_RPC_GET_TRANSACTION_POOL_BACKLOG

Get all transaction pool backlog.

Endpoints: get_txpool_backlog

Example Request:

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

Example Response:

{
  "status": "OK",
  "backlog": [{
      "weight": 123,
      "fee": 123,
      "time_in_pool": 123
    }, ...],
  "untrusted": false
}

Inputs:

Outputs:

  • status - string: General RPC error code. "OK" means everything looks good.
  • backlog - tx_backlog_entry[]: Array of structures tx_backlog_entry (in binary form):
    • weight - uint64
    • fee - uint64: Fee in Loki measured in atomic units.
    • time_in_pool - uint64
  • untrusted - bool: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

COMMAND_RPC_GET_CONNECTIONS

Retrieve information about incoming and outgoing connections to your node.

Endpoints: get_connections

Example Request:

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

Example Response:

{
  "status": "OK",
  "connections": [, ...]
}

Inputs:

Outputs:

  • status - string: General RPC error code. "OK" means everything looks good.
  • connections - connection_info[]: List of all connections and their info:

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

Endpoints: get_block_headers_range, getblockheadersrange

Example Request:

curl -X POST http://127.0.0.1:22023/json_rpc -d '
{
  "jsonrpc":"2.0", "id":"0", "method":"getblockheadersrange",
  "params": {
    "start_height": 123,
    "end_height": 123,
    "fill_pow_hash": true
  }
}' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK",
  "headers": [{
      "major_version": 11,
      "minor_version": 11,
      "timestamp": 123,
      "prev_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
      "nonce": 2130706433,
      "orphan_status": true,
      "height": 234767,
      "depth": 123,
      "hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
      "difficulty": 25179406071,
      "cumulative_difficulty": 25179406071,
      "reward": 123,
      "miner_reward": 123,
      "block_size": 123,
      "block_weight": 123,
      "num_txes": 123,
      "pow_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
      "long_term_weight": 123
    }, ...],
  "untrusted": false
}

Inputs:

  • start_height - uint64: The starting block's height.
  • end_height - uint64: The ending block's height.
  • fill_pow_hash - bool: Tell the daemon if it should fill out pow_hash field.

Outputs:

  • status - string: General RPC error code. "OK" means everything looks good.
  • headers - block_header_response[]: Array of block_header (a structure containing block header information. See get_last_block_header).
    • major_version - uint8: The major version of the loki protocol at this block height.
    • minor_version - uint8: The minor version of the loki protocol at this block height.
    • timestamp - uint64: The unix time at which the block was recorded into the blockchain.
    • prev_hash - string: The hash of the block immediately preceding this block in the chain.
    • nonce - uint32: A cryptographic random one-time number used in mining a Loki block.
    • orphan_status - bool: Usually false. If true, this block is not part of the longest chain.
    • height - uint64: The number of blocks preceding this block on the blockchain.
    • depth - uint64: The number of blocks succeeding this block on the blockchain. A larger number means an older block.
    • hash - string: The hash of this block.
    • difficulty - uint64: The strength of the Loki network based on mining power.
    • cumulative_difficulty - uint64: The cumulative strength of the Loki network based on mining power.
    • reward - uint64: The amount of new generated in this block and rewarded to the miner, foundation and service Nodes. Note: 1 LOKI = 1e12 atomic units.
    • miner_reward - uint64: The amount of new generated in this block and rewarded to the miner. Note: 1 LOKI = 1e12 atomic units.
    • block_size - uint64: The block size in bytes.
    • block_weight - uint64: The block weight in bytes.
    • num_txes - uint64: Number of transactions in the block, not counting the coinbase tx.
    • pow_hash - string: The hash of the block's proof of work.
    • long_term_weight - uint64: Long term weight of the block.
  • untrusted - bool: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

COMMAND_RPC_STOP_DAEMON

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

Endpoints: /stop_daemon

Example Request:

curl -X POST http://127.0.0.1:22023/stop_daemon -d '{ }' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK"
}

Inputs:

Outputs:

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

COMMAND_RPC_GET_LIMIT

Get daemon bandwidth limits.

Endpoints: /get_limit

Example Request:

curl -X POST http://127.0.0.1:22023/get_limit -d '{ }' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK",
  "limit_up": 123,
  "limit_down": 123,
  "untrusted": false
}

Inputs:

Outputs:

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

COMMAND_RPC_SET_LIMIT

Set daemon bandwidth limits.

Endpoints: /set_limit

Example Request:

curl -X POST http://127.0.0.1:22023/set_limit -d '
{
  "limit_down": 8192,
  "limit_up": 8192
}' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK",
  "limit_up": 8192,
  "limit_down": 8192
}

Inputs:

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

Outputs:

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

COMMAND_RPC_OUT_PEERS

Limit number of Outgoing peers.

Endpoints: /out_peers

Example Request:

curl -X POST http://127.0.0.1:22023/out_peers -d '
{
  "out_peers": 123
}' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK"
}

Inputs:

  • out_peers - uint64: Max number of outgoing peers

Outputs:

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

COMMAND_RPC_IN_PEERS

Limit number of Incoming peers.

Endpoints: /in_peers

Example Request:

curl -X POST http://127.0.0.1:22023/in_peers -d '
{
  "in_peers": 123
}' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK"
}

Inputs:

  • in_peers - uint64

Outputs:

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

COMMAND_RPC_START_SAVE_GRAPH

Obsolete. Conserved here for reference.

Endpoints: /start_save_graph

Example Request:

curl -X POST http://127.0.0.1:22023/start_save_graph -d '{ }' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK"
}

Inputs:

Outputs:

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

COMMAND_RPC_STOP_SAVE_GRAPH

Obsolete. Conserved here for reference.

Endpoints: /stop_save_graph

Example Request:

curl -X POST http://127.0.0.1:22023/stop_save_graph -d '{ }' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK"
}

Inputs:

Outputs:

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

COMMAND_RPC_HARD_FORK_INFO

Look up information regarding hard fork voting and readiness.

Endpoints: hard_fork_info

Example Request:

curl -X POST http://127.0.0.1:22023/json_rpc -d '
{
  "jsonrpc":"2.0", "id":"0", "method":"hard_fork_info",
  "params": {
    "version": 11
  }
}' -H 'Content-Type: application/json'

Example Response:

{
  "version": 11,
  "enabled": true,
  "window": 2130706433,
  "votes": 2130706433,
  "threshold": 2130706433,
  "voting": 11,
  "state": 2130706433,
  "earliest_height": 123,
  "status": "OK",
  "untrusted": false
}

Inputs:

  • version - uint8: The major block version for the fork.

Outputs:

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

COMMAND_RPC_GETBANS

Get list of banned IPs.

Endpoints: get_bans

Example Request:

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

Example Response:

{
  "status": "OK",
  "bans": [{
      "host": "127.0.0.1",
      "ip": 2130706433,
      "seconds": 2130706433
    }, ...]
}

Inputs:

Outputs:

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

COMMAND_RPC_SETBANS

Ban another node by IP.

Endpoints: set_bans

Example Request:

curl -X POST http://127.0.0.1:22023/json_rpc -d '
{
  "jsonrpc":"2.0", "id":"0", "method":"set_bans",
  "params": {
    "bans": [{
        "host": "127.0.0.1",
        "ip": 2130706433,
        "ban": true,
        "seconds": 2130706433
      }, ...]
  }
}' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK"
}

Inputs:

  • bans - ban[]: 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 - uint32: IP address to ban, in Int format.
    • ban - bool: Set true to ban.
    • seconds - uint32: Number of seconds to ban node.

Outputs:

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

COMMAND_RPC_FLUSH_TRANSACTION_POOL

Flush tx ids from transaction pool..

Endpoints: flush_txpool

Example Request:

curl -X POST http://127.0.0.1:22023/json_rpc -d '
{
  "jsonrpc":"2.0", "id":"0", "method":"flush_txpool",
  "params": {
    "txids": ["b605cab7e3b9fe1f6d322e3167cd26e1e61c764afa9d733233ef716787786123", ...]
  }
}' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK"
}

Inputs:

  • txids - string[]: 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.

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

Endpoints: get_output_histogram

Example Request:

curl -X POST http://127.0.0.1:22023/json_rpc -d '
{
  "jsonrpc":"2.0", "id":"0", "method":"get_output_histogram",
  "params": {
    "amounts": [123, ...],
    "min_count": 123,
    "max_count": 123,
    "unlocked": true,
    "recent_cutoff": 123
  }
}' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK",
  "histogram": [{
      "amount": 123,
      "total_instances": 123,
      "unlocked_instances": 123,
      "recent_instances": 123
    }, ...],
  "untrusted": false
}

Inputs:

  • amounts - uint64[]: list of amounts in Atomic Units.
  • min_count - uint64: The minimum amounts you are requesting.
  • max_count - uint64: The maximum amounts you are requesting.
  • unlocked - bool: Look for locked only.
  • recent_cutoff - uint64

Outputs:

  • status - string: General RPC error code. "OK" means everything looks good.
  • histogram - entry[]: List of histogram entries:
    • amount - uint64: Output amount in atomic units.
    • total_instances - uint64
    • unlocked_instances - uint64
    • recent_instances - uint64
  • untrusted - bool: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

COMMAND_RPC_GET_VERSION

Get node current version.

Endpoints: get_version

Example Request:

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

Example Response:

{
  "status": "OK",
  "version": 2130706433,
  "untrusted": false
}

Inputs:

Outputs:

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

COMMAND_RPC_GET_COINBASE_TX_SUM

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

Endpoints: get_coinbase_tx_sum

Example Request:

curl -X POST http://127.0.0.1:22023/json_rpc -d '
{
  "jsonrpc":"2.0", "id":"0", "method":"get_coinbase_tx_sum",
  "params": {
    "height": 234767,
    "count": 123
  }
}' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK",
  "emission_amount": 123,
  "fee_amount": 123
}

Inputs:

  • height - uint64: Block height from which getting the amounts.
  • count - uint64: Number of blocks to include in the sum.

Outputs:

  • status - string: General RPC error code. "OK" means everything looks good.
  • emission_amount - uint64: Amount of coinbase reward in atomic units.
  • fee_amount - uint64: Amount of fees in atomic units.

COMMAND_RPC_GET_BASE_FEE_ESTIMATE

Gives an estimation on fees per kB.

Endpoints: get_fee_estimate

Example Request:

curl -X POST http://127.0.0.1:22023/json_rpc -d '
{
  "jsonrpc":"2.0", "id":"0", "method":"get_fee_estimate",
  "params": {
    "grace_blocks": 123
  }
}' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK",
  "fee": 123,
  "quantization_mask": 123,
  "untrusted": false
}

Inputs:

  • grace_blocks - uint64: Optional

Outputs:

  • status - string: General RPC error code. "OK" means everything looks good.
  • fee - uint64: Amount of fees estimated per kB in atomic units
  • quantization_mask - uint64
  • untrusted - bool: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

COMMAND_RPC_GET_ALTERNATE_CHAINS

Display alternative chains seen by the node.

Endpoints: get_alternate_chains

Example Request:

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

Example Response:

{
  "status": "OK",
  "chains": [{
      "block_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
      "height": 234767,
      "length": 123,
      "difficulty": 123,
      "block_hashes": ["bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70", ...],
      "main_chain_parent_block": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70"
    }, ...]
}

Inputs:

Outputs:

  • status - string: General RPC error code. "OK" means everything looks good.
  • chains - chain_info[]: Array of Chains.
    • block_hash - string: The block hash of the first diverging block of this alternative chain.
    • height - uint64: The block height of the first diverging block of this alternative chain.
    • length - uint64: The length in blocks of this alternative chain, after divergence.
    • difficulty - uint64: The cumulative difficulty of all blocks in the alternative chain.
    • block_hashes - string[]
    • main_chain_parent_block - string

COMMAND_RPC_UPDATE

Update daemon.

Endpoints: /update

Example Request:

curl -X POST http://127.0.0.1:22023/update -d '
{
  "command": "TODO(loki): Write example string",
  "path": "TODO(loki): Write example string"
}' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK",
  "update": true,
  "version": "TODO(loki): Write example string",
  "user_uri": "TODO(loki): Write example string",
  "auto_uri": "TODO(loki): Write example string",
  "hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
  "path": "TODO(loki): Write example string"
}

Inputs:

  • command - string: Command to use, either check or download.
  • path - string: Optional, path where to download the update.

Outputs:

  • status - string: General RPC error code. "OK" means everything looks good.
  • update - bool: States if an update is available to download (true) or not (false).
  • version - string: Version available for download.
  • user_uri - string
  • auto_uri - string
  • hash - string
  • path - string: Path to download the update.

COMMAND_RPC_RELAY_TX

Relay a list of transaction IDs.

Endpoints: relay_tx

Example Request:

curl -X POST http://127.0.0.1:22023/json_rpc -d '
{
  "jsonrpc":"2.0", "id":"0", "method":"relay_tx",
  "params": {
    "txids": ["b605cab7e3b9fe1f6d322e3167cd26e1e61c764afa9d733233ef716787786123", ...]
  }
}' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK"
}

Inputs:

  • txids - string[]: 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.

COMMAND_RPC_SYNC_INFO

Get synchronisation information.

Endpoints: sync_info

Example Request:

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

Example Response:

{
  "status": "OK",
  "height": 234767,
  "target_height": 123,
  "next_needed_pruning_seed": 2130706433,
  "peers": [{
      "id": 123,
      "host": "127.0.0.1",
      "ip": 2130706433,
      "port": 12345,
      "last_seen": 1554685440,
      "pruning_seed": 2130706433
    }, ...],
  "spans": [{
      "start_block_height": 123,
      "nblocks": 123,
      "connection_id": "083c301a3030329a487adb12ad981d2c",
      "rate": 2130706433,
      "speed": 2130706433,
      "size": 123,
      "remote_address": "127.0.0.1:22023"
    }, ...],
  "overview": "TODO(loki): Write example string"
}

Inputs:

Outputs:

  • status - string: General RPC error code. "OK" means everything looks good. Any other value means that something went wrong.
  • height - uint64: Block height.
  • target_height - uint64: Target height the node is syncing from (optional, absent if node is fully synced).
  • next_needed_pruning_seed - uint32
  • peers - peer[]: Array of Peer structure
    • id - uint64: Peer id.
    • host - string: IP address in string format.
    • ip - uint32: IP address in integer format.
    • port - uint16: TCP port the peer is using to connect to loki network.
    • last_seen - uint64: Unix time at which the peer has been seen for the last time
    • pruning_seed - uint32
  • spans - span[]: Array of Span Structure.
    • start_block_height - uint64: Block height of the first block in that span.
    • nblocks - uint64: Number of blocks in that span.
    • connection_id - string: Id of connection.
    • rate - uint32: Connection rate.
    • speed - uint32: Connection speed.
    • size - uint64: Total number of bytes in that span's blocks (including txes).
    • remote_address - string: Peer address the node is downloading (or has downloaded) than span from.
  • overview - string

COMMAND_RPC_GET_OUTPUT_DISTRIBUTION

Endpoints: /get_output_distribution.bin, get_output_distribution

Example Request:

curl -X POST http://127.0.0.1:22023/json_rpc -d '
{
  "jsonrpc":"2.0", "id":"0", "method":"get_output_distribution",
  "params": {
    "amounts": [123, ...],
    "from_height": 123,
    "to_height": 123,
    "cumulative": true,
    "binary": true,
    "compress": true
  }
}' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK",
  "distributions": [{
      "data": ,
      "amount": 123,
      "compressed_data": "TODO(loki): Write example string",
      "binary": true,
      "compress": true
    }, ...],
  "untrusted": false
}

Inputs:

  • amounts - uint64[]: Amounts to look for in atomic units.
  • from_height - uint64: (optional, default is 0) starting height to check from.
  • to_height - uint64: (optional, default is 0) ending height to check up to.
  • cumulative - bool: (optional, default is false) States if the result should be cumulative (true) or not (false).
  • binary - bool
  • compress - bool

Outputs:

  • status - string: General RPC error code. "OK" means everything looks good.
  • distributions - distribution[]
    • data - rpc::output_distribution_data
    • amount - uint64
    • compressed_data - string
    • binary - bool
    • compress - bool
  • untrusted - bool: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).

COMMAND_RPC_POP_BLOCKS

Endpoints: /pop_blocks

Example Request:

curl -X POST http://127.0.0.1:22023/pop_blocks -d '
{
  "nblocks": 123
}' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK",
  "height": 234767
}

Inputs:

  • nblocks - uint64: Number of blocks in that span.

Outputs:

  • status - string: General RPC error code. "OK" means everything looks good.
  • height - uint64

COMMAND_RPC_PRUNE_BLOCKCHAIN

Endpoints: prune_blockchain

Example Request:

curl -X POST http://127.0.0.1:22023/json_rpc -d '
{
  "jsonrpc":"2.0", "id":"0", "method":"prune_blockchain",
  "params": {
    "check": true
  }
}' -H 'Content-Type: application/json'

Example Response:

{
  "pruning_seed": 2130706433,
  "status": "OK"
}

Inputs:

  • check - bool

Outputs:

  • pruning_seed - uint32
  • status - string

COMMAND_RPC_GET_QUORUM_STATE

Get the quorum state which is the list of public keys of the nodes

who are voting, and the list of public keys of the nodes who are being tested.

Endpoints: get_quorum_state

Example Request:

curl -X POST http://127.0.0.1:22023/json_rpc -d '
{
  "jsonrpc":"2.0", "id":"0", "method":"get_quorum_state",
  "params": {
    "height": 234767
  }
}' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK",
  "quorum_nodes": ["4a8c30cea9e729b06c91132295cce32d2a8e6e5bcf7b74a998e2ee1b3ed590b3", ...],
  "nodes_to_test": ["4a8c30cea9e729b06c91132295cce32d2a8e6e5bcf7b74a998e2ee1b3ed590b3", ...],
  "untrusted": false
}

Inputs:

  • height - uint64: The height to query the quorum state for.

Outputs:

  • status - string: Generic RPC error code. "OK" is the success value.
  • quorum_nodes - string[]: Array of public keys identifying service nodes which are being tested for the queried height.
  • nodes_to_test - string[]: Array of public keys identifying service nodes which are responsible for voting on the queried height.
  • untrusted - bool: If the result is obtained using bootstrap mode, and therefore not trusted true, or otherwise false.

COMMAND_RPC_GET_QUORUM_STATE_BATCHED

Get the quorum state which is the list of public keys of the nodes

who are voting, and the list of public keys of the nodes who are being tested.

Endpoints: get_quorum_state_batched

Example Request:

curl -X POST http://127.0.0.1:22023/json_rpc -d '
{
  "jsonrpc":"2.0", "id":"0", "method":"get_quorum_state_batched",
  "params": {
    "height_begin": 123,
    "height_end": 123
  }
}' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK",
  "quorum_entries": [{
      "height": 234767,
      "quorum_nodes": ["4a8c30cea9e729b06c91132295cce32d2a8e6e5bcf7b74a998e2ee1b3ed590b3", ...],
      "nodes_to_test": ["4a8c30cea9e729b06c91132295cce32d2a8e6e5bcf7b74a998e2ee1b3ed590b3", ...]
    }, ...],
  "untrusted": false
}

Inputs:

  • height_begin - uint64: The starting height (inclusive) to query the quorum state for.
  • height_end - uint64: The ending height (inclusive) to query the quorum state for.

Outputs:

  • status - string: Generic RPC error code. "OK" is the success value.
  • quorum_entries - response_entry[]: Array of quorums that was requested.
    • height - uint64: The height of this quorum state that was queried.
    • quorum_nodes - string[]: Array of public keys identifying service nodes which are being tested for the queried height.
    • nodes_to_test - string[]: Array of public keys identifying service nodes which are responsible for voting on the queried height.
  • untrusted - bool: If the result is obtained using bootstrap mode, and therefore not trusted true, or otherwise false.

COMMAND_RPC_GET_SERVICE_NODE_REGISTRATION_CMD_RAW

Endpoints: get_service_node_registration_cmd_raw

Example Request:

curl -X POST http://127.0.0.1:22023/json_rpc -d '
{
  "jsonrpc":"2.0", "id":"0", "method":"get_service_node_registration_cmd_raw",
  "params": {
    "args": ["TODO(loki): Write example string", ...],
    "make_friendly": true,
    "staking_requirement": 100000000000
  }
}' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK",
  "registration_cmd": "register_service_node 18446744073709551612 L8KJf3nRQ53NTX1YLjtHryjegFRa3ZCEGLKmRxUfvkBWK19UteEacVpYqpYscSJ2q8WRuHPFdk7Q5W8pQB7Py5kvUs8vKSk 18446744073709551612 1555894565 f90424b23c7969bb2f0191bca45e6433a59b0b37039a5e38a2ba8cc7ea1075a3 ba24e4bfb4af0f5f9f74e35f1a5685dc9250ee83f62a9ee8964c9a689cceb40b4f125c83d0cbb434e56712d0300e5a23fd37a5b60cddbcd94e2d578209532a0d"
}

Inputs:

  • args - string[]: (Developer) The arguments used in raw registration, i.e. portions
  • make_friendly - bool: Provide information about how to use the command in the result.
  • staking_requirement - uint64: The staking requirement to become a Service Node the registration command will be generated upon

Outputs:

  • status - string: Generic RPC error code. "OK" is the success value.
  • registration_cmd - string: The command to execute in the wallet CLI to register the queried daemon as a Service Node.

COMMAND_RPC_GET_SERVICE_NODE_REGISTRATION_CMD

Endpoints: get_service_node_registration_cmd

Example Request:

curl -X POST http://127.0.0.1:22023/json_rpc -d '
{
  "jsonrpc":"2.0", "id":"0", "method":"get_service_node_registration_cmd",
  "params": {
    "operator_cut": "1.1%",
    "contributions": [{
        "address": "L8KJf3nRQ53NTX1YLjtHryjegFRa3ZCEGLKmRxUfvkBWK19UteEacVpYqpYscSJ2q8WRuHPFdk7Q5W8pQB7Py5kvUs8vKSk",
        "amount": 26734261552878
      }, ...],
    "staking_requirement": 100000000000
  }
}' -H 'Content-Type: application/json'

Example Response:

{
  "status": "OK",
  "registration_cmd": "register_service_node 18446744073709551612 L8KJf3nRQ53NTX1YLjtHryjegFRa3ZCEGLKmRxUfvkBWK19UteEacVpYqpYscSJ2q8WRuHPFdk7Q5W8pQB7Py5kvUs8vKSk 18446744073709551612 1555894565 f90424b23c7969bb2f0191bca45e6433a59b0b37039a5e38a2ba8cc7ea1075a3 ba24e4bfb4af0f5f9f74e35f1a5685dc9250ee83f62a9ee8964c9a689cceb40b4f125c83d0cbb434e56712d0300e5a23fd37a5b60cddbcd94e2d578209532a0d"
}

Inputs:

  • operator_cut - string: The percentage of cut per reward the operator receives expressed as a string, i.e. "1.1%"
  • contributions - contribution_t[]: Array of contributors for this Service Node
    • address - string: The wallet address for the contributor
    • amount - uint64: The amount that the contributor will reserve in Loki atomic units towards the staking requirement
  • staking_requirement - uint64: The staking requirement to become a Service Node the registration command will be generated upon

Outputs:

  • status - string: Generic RPC error code. "OK" is the success value.
  • registration_cmd - string: The command to execute in the wallet CLI to register the queried daemon as a Service Node.

COMMAND_RPC_GET_SERVICE_NODE_KEY

Get the service node public key of the queried daemon.

The daemon must be started in --service-node mode otherwise this RPC command will fail.

Endpoints: get_service_node_key

Example Request:

curl -X POST http://127.0.0.1:22023/json_rpc -d '{ "jsonrpc":"2.0", "id":"0", "method":"get_service_node_key"}' -H 'Content-Type: application/json'

Example Response:

{
  "service_node_pubkey": "4a8c30cea9e729b06c91132295cce32d2a8e6e5bcf7b74a998e2ee1b3ed590b3",
  "status": "OK"
}

Inputs:

Outputs:

  • service_node_pubkey - string: The queried daemon's service node key.
  • status - string: Generic RPC error code. "OK" is the success value.

COMMAND_RPC_GET_SERVICE_NODES

Get information on Service Nodes.

Endpoints: get_service_nodes, get_all_service_nodes

Example Request:

curl -X POST http://127.0.0.1:22023/json_rpc -d '
{
  "jsonrpc":"2.0", "id":"0", "method":"get_all_service_nodes",
  "params": {
    "service_node_pubkeys": ["4a8c30cea9e729b06c91132295cce32d2a8e6e5bcf7b74a998e2ee1b3ed590b3", ...],
    "include_json": true
  }
}' -H 'Content-Type: application/json'

Example Response:

{
  "service_node_states": [{
      "service_node_pubkey": "4a8c30cea9e729b06c91132295cce32d2a8e6e5bcf7b74a998e2ee1b3ed590b3",
      "registration_height": 234767,
      "requested_unlock_height": 123,
      "last_reward_block_height": 234767,
      "last_reward_transaction_index": 2130706433,
      "last_uptime_proof": 123,
      "service_node_version": [3, 0, ...],
      "contributors": [{
          "amount": 123,
          "reserved": 123,
          "address": "L8KJf3nRQ53NTX1YLjtHryjegFRa3ZCEGLKmRxUfvkBWK19UteEacVpYqpYscSJ2q8WRuHPFdk7Q5W8pQB7Py5kvUs8vKSk",
          "locked_contributions": [{
              "key_image": "8d1bd8181bf7d857bdb281e0153d84cd55a3fcaa57c3e570f4a49f935850b5e3",
              "key_image_pub_key": "b1b696dd0a0d1815e341d9fed85708703c57b5d553a3615bcf4a06a36fa4bc38",
              "amount": 123
            }, ...]
        }, ...],
      "total_contributed": 123,
      "total_reserved": 123,
      "staking_requirement": 100000000000,
      "portions_for_operator": 18446744073709551612,
      "operator_address": "L8KJf3nRQ53NTX1YLjtHryjegFRa3ZCEGLKmRxUfvkBWK19UteEacVpYqpYscSJ2q8WRuHPFdk7Q5W8pQB7Py5kvUs8vKSk"
    }, ...],
  "status": "OK",
  "as_json": "TODO(loki): Write example string"
}

Inputs:

  • service_node_pubkeys - string[]: Array of public keys of active Service Nodes to get information about. Pass the empty array to query all Service Nodes.
  • include_json - bool: When set, the response's as_json member is filled out.

Outputs:

  • service_node_states - entry[]: Array of service node registration information
    • service_node_pubkey - string: The public key of the Service Node.
    • registration_height - uint64: The height at which the registration for the Service Node arrived on the blockchain.
    • requested_unlock_height - uint64: The height at which contributions will be released and the Service Node expires. 0 if not requested yet.
    • last_reward_block_height - uint64: The last height at which this Service Node received a reward.
    • last_reward_transaction_index - uint32: When multiple Service Nodes register on the same height, the order the transaction arrive dictate the order you receive rewards.
    • last_uptime_proof - uint64: The last time this Service Node's uptime proof was relayed by atleast 1 Service Node other than itself in unix epoch time.
    • service_node_version - uint16[]: The major, minor, patch version of the Service Node respectively.
    • contributors - contributor[]: Array of contributors, contributing to this Service Node.
      • amount - uint64: The total amount of locked Loki in atomic units for this contributor.
      • reserved - uint64: The amount of Loki in atomic units reserved by this contributor for this Service Node.
      • address - string: The wallet address for this contributor rewards are sent to and contributions came from.
      • locked_contributions - contribution[]: Array of contributions from this contributor.
        • key_image - string: The contribution's key image that is locked on the network.
        • key_image_pub_key - string: The contribution's key image, public key component
        • amount - uint64: The amount that is locked in this contribution.
    • total_contributed - uint64: The total amount of Loki in atomic units contributed to this Service Node.
    • total_reserved - uint64: The total amount of Loki in atomic units reserved in this Service Node.
    • staking_requirement - uint64: The staking requirement in atomic units that is required to be contributed to become a Service Node.
    • portions_for_operator - uint64: The operator percentage cut to take from each reward expressed in portions, see cryptonote_config.h's STAKING_PORTIONS.
    • operator_address - string: The wallet address of the operator to which the operator cut of the staking reward is sent to.
  • status - string: Generic RPC error code. "OK" is the success value.
  • as_json - string: If include_json is set in the request, this contains the json representation of the entry data structure

COMMAND_RPC_GET_STAKING_REQUIREMENT

Get the required amount of Loki to become a Service Node at the queried height.

For stagenet and testnet values, ensure the daemon is started with the

--stagenet or --testnet flags respectively.

Endpoints: get_staking_requirement

Example Request:

curl -X POST http://127.0.0.1:22023/json_rpc -d '
{
  "jsonrpc":"2.0", "id":"0", "method":"get_staking_requirement",
  "params": {
    "height": 234767
  }
}' -H 'Content-Type: application/json'

Example Response:

{
  "staking_requirement": 100000000000,
  "status": "OK"
}

Inputs:

  • height - uint64: The height to query the staking requirement for.

Outputs:

  • staking_requirement - uint64: The staking requirement in Loki, in atomic units.
  • status - string: Generic RPC error code. "OK" is the success value.

COMMAND_RPC_GET_SERVICE_NODE_BLACKLISTED_KEY_IMAGES

Get information on blacklisted Service Node key images.

Endpoints: get_service_node_blacklisted_key_images

Example Request:

curl -X POST http://127.0.0.1:22023/json_rpc -d '{ "jsonrpc":"2.0", "id":"0", "method":"get_service_node_blacklisted_key_images"}' -H 'Content-Type: application/json'

Example Response:

{
  "blacklist": [{
      "key_image": "8d1bd8181bf7d857bdb281e0153d84cd55a3fcaa57c3e570f4a49f935850b5e3",
      "unlock_height": 123
    }, ...],
  "status": "OK"
}

Inputs:

Outputs:

  • blacklist - entry[]: Array of blacklisted key images, i.e. unspendable transactions
    • key_image - string: The key image of the transaction that is blacklisted on the network.
    • unlock_height - uint64: The height at which the key image is removed from the blacklist and becomes spendable.
  • status - string: Generic RPC error code. "OK" is the success value.

COMMAND_RPC_GET_OUTPUT_BLACKLIST

Get information on output blacklist.

Endpoints: /get_output_blacklist.bin

Example Request:

curl -X POST http://127.0.0.1:22023/get_output_blacklist.bin -d '{ }' -H 'Content-Type: application/json'

Example Response:

{
  "blacklist": [123, ...],
  "status": "OK",
  "untrusted": false
}

Inputs:

Outputs:

  • blacklist - uint64[]: (Developer): Array of indexes from the global output list, corresponding to blacklisted key images.
  • status - string: Generic RPC error code. "OK" is the success value.
  • untrusted - bool: If the result is obtained using bootstrap mode, and therefore not trusted true, or otherwise false.