The majority of monerod RPC calls use the daemon's `json_rpc` interface to request various bits of information. These methods all follow a similar structure, for example:
* *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`).
* Block blob data - array of strings; list of block blobs which have been mined. See [get_block_template](#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:
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 Monero 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 monero protocol at this block height.
* *minor_version* - unsigned int; The minor version of the monero protocol at this block height.
* *nonce* - unsigned int; a cryptographic random one-time number used in mining a Monero 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 XMR = 1e12 @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:
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](#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 912345 is looked up by its hash:
Similar to [get_block_header_by_hash](#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](#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 912345 is looked up by its height (notice that the returned information is the same as in the previous example):
Similar to [get_block_header_by_height](#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](#get_last_block_header)).
* *status* - string; General RPC error code. "OK" means everything looks good.
* *untrusted* - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (`true`), or when the daemon is fully synced (`false`).
In this example, blocks range from height 1545999 to 1546000 is looked up (notice that the returned informations are ascending order and that it is at the April 2018 network upgrade time):
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](#get_last_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 912345 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):
Retrieve general information about the state of your node and the network.
Alias:
* */get_info*
* */getinfo*
See other RPC Methods [/get_info (not JSON)](#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.
* *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:
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.
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`).
* *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`).
* *fee* - unsigned int; Amount of fees estimated per byte in @atomic-units
* *quantization_mask* - unsigned int; Final fee should be rounded up to an even multiple of this value
* *status* - string; General RPC error code. "OK" means everything looks good.
* *untrusted* - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (`true`), or when the daemon is fully synced (`false`).
* *backlog*: array of structures *tx_backlog_entry* (in binary form):
* *blob_size* - unsigned int (in binary form)
* *fee* - unsigned int (in binary form)
* *time_in_pool* - unsigned int (in binary form)
* *status* - string; General RPC error code. "OK" means everything looks good.
* *untrusted* - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (`true`), or when the daemon is fully synced (`false`).
Not all daemon RPC calls use the JSON_RPC interface. This section gives examples of these calls.
The data structure for these calls is different than the JSON RPC calls. Whereas the JSON RPC methods were called using the `/json_rpc` extension and specifying a method, these methods are called at their own extensions. For example:
Note: It is recommended to use JSON RPC where such alternatives exist, rather than the following methods. For example, the recommended way to get a node's height is via the JSON RPC methods [get_info](#getinfo) or [get_last_block_header](#get_last_block_header), rather than [getheight](#getheight) below.
For calls that end with **.bin**, the data is exchanged in the form of binary, serialized objects, as defined in the [Core RPC Server](https://github.com/monero-project/monero/blob/master/src/rpc/core_rpc_server_commands_defs.h).
### **/get_height**
Get the node's current height.
Alias: */getheight*.
Inputs: *None*.
Outputs:
* *height* - unsigned int; Current length of longest chain known to daemon.
* *status* - string; General RPC error code. "OK" means everything looks good.
* *untrusted* - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (`true`), or when the daemon is fully synced (`false`).
* *block_ids* - binary array of hashes; first 10 blocks id goes sequential, next goes in pow(2,n) offset, like 2, 4, 8, 16, 32, 64 and so on, and the last one is always genesis block
* *start_height* - unsigned int
* *prune* - boolean
Outputs:
* *blocks* - array of block complete entries
* *current_height* - unsigned int
* *output_indices* - structure as follows:
* *indices* - array of tx output indices, structure as follows:
* *indices* - array of unsigned int
* *start_height* - unsigned int
* *status* - string; General RPC error code. "OK" means everything looks good.
* *untrusted* - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (`true`), or when the daemon is fully synced (`false`).
* *heights* - array of unsigned int; list of block heights
Outputs:
* *blocks* - array of block complete entries
* *status* - string; General RPC error code. "OK" means everything looks good.
* *untrusted* - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (`true`), or when the daemon is fully synced (`false`).
* *block_ids* - binary array of hashes; first 10 blocks id goes sequential, next goes in pow(2,n) offset, like 2, 4, 8, 16, 32, 64 and so on, and the last one is always genesis block
* *start_height* - unsigned int
Outputs:
* *current_height* - unsigned int
* *m_block_ids* - binary array of hashes; see *block_ids* above.
* *start_height* - unsigned int
* *status* - string; General RPC error code. "OK" means everything looks good.
* *untrusted* - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (`true`), or when the daemon is fully synced (`false`).
Get global outputs of transactions. Binary request.
Alias: *None*.
Inputs:
* *txid* - binary txid
Outputs:
* *o_indexes* - array of unsigned int; List of output indexes
* *status* - string; General RPC error code. "OK" means everything looks good.
* *untrusted* - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (`true`), or when the daemon is fully synced (`false`).
* *outputs* - array of structure *get_outputs_out* as follows:
* *amount* - unsigned int;
* *index* - unsigned int;
Outputs:
* *outs* - array of structure *outkey* as follows:
* *amount* - unsigned int;
* *height* - unsigned int; block height of the output
* *key* - the public key of the output
* *mask*
* *txid* - transaction id
* *unlocked* - boolean; States if output is locked (`false`) or not (`true`)
* *status* - string; General RPC error code. "OK" means everything looks good.
* *untrusted* - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (`true`), or when the daemon is fully synced (`false`).
Example 2: Decode returned transaction information in JSON format. Note: the "vin", "vout" and "signatures" list have been truncated in the displayed return for space considerations.
Get the known blocks hashes which are not on the main chain.
Alias: *None*.
Inputs: *None*
Outputs:
* *blks_hashes* - array of strings; list of alternative blocks hashes to main chain
* *status* - string; General RPC error code. "OK" means everything looks good.
* *untrusted* - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (`true`), or when the daemon is fully synced (`false`).
Check if outputs have been spent using the key image associated with the output.
Alias: *None*.
Inputs:
* *key_images* - string list; List of key image hex strings to check.
Outputs:
* *spent_status* - unsigned int list; List of statuses for each image checked. Statuses are follows: 0 = unspent, 1 = spent in blockchain, 2 = spent in transaction pool
* *status* - string; General RPC error code. "OK" means everything looks good.
* *untrusted* - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (`true`), or when the daemon is fully synced (`false`).
* *tx_as_hex* - string; Full transaction information as hexidecimal string.
* *do_not_relay* - boolean; Stop relaying transaction to other nodes (default is `false`).
Outputs:
* *double_spend* - boolean; Transaction is a double spend (`true`) or not (`false`).
* *fee_too_low* - boolean; Fee is too low (`true`) or OK (`false`).
* *invalid_input* - boolean; Input is invalid (`true`) or valid (`false`).
* *invalid_output* - boolean; Output is invalid (`true`) or valid (`false`).
* *low_mixin* - boolean; Mixin count is too low (`true`) or OK (`false`).
* *not_rct* - boolean; Transaction is a standard ring transaction (`true`) or a ring confidential transaction (`false`).
* *not_relayed* - boolean; Transaction was not relayed (`true`) or relayed (`false`).
* *overspend* - boolean; Transaction uses more money than available (`true`) or not (`false`).
* *reason* - string; Additional information. Currently empty or "Not relayed" if transaction was accepted but not relayed.
* *status* - string; General RPC error code. "OK" means everything looks good. Any other value means that something went wrong.
* *too_big* - boolean; Transaction size is too big (`true`) or OK (`false`).
* *untrusted* - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (`true`), or when the daemon is fully synced (`false`).
Save the blockchain. The blockchain does not need saving and is always saved when modified, however it does a sync to flush the filesystem cache onto the disk for safety purposes against Operating System or Harware crashes.
Alias: *None*.
Inputs: *None*.
Outputs:
* *status* - string; General RPC error code. "OK" means everything looks good. Any other value means that something went wrong.
Categories are represented as a comma separated list of `<Category>:<level>` (similarly to syslog standard `<Facility>:<Severity-level>`), where:
* *Category* is one of the following:
* *\** - All facilities
* *default*
* *net*
* *net.http*
* *net.p2p*
* *logging*
* *net.throttle*
* *blockchain.db*
* *blockchain.db.lmdb*
* *bcutil*
* *checkpoints*
* *net.dns*
* *net.dl*
* *i18n*
* *perf*
* *stacktrace*
* *updates*
* *account*
* *cn*
* *difficulty*
* *hardfork*
* *miner*
* *blockchain*
* *txpool*
* *cn.block_queue*
* *net.cn*
* *daemon*
* *debugtools.deserialize*
* *debugtools.objectsizes*
* *device.ledger*
* *wallet.gen_multisig*
* *multisig*
* *bulletproofs*
* *ringct*
* *daemon.rpc*
* *wallet.simplewallet*
* *WalletAPI*
* *wallet.ringdb*
* *wallet.wallet2*
* *wallet.rpc*
* *tests.core*
* *Level* is one of the following:
* *FATAL* - higher level
* *ERROR*
* *WARNING*
* *INFO*
* *DEBUG*
* *TRACE* - lower level
A level automatically includes higher level.
By default, categories are set to `*:WARNING,net:FATAL,net.p2p:FATAL,net.cn:FATAL,global:INFO,verify:FATAL,stacktrace:INFO,logging:INFO,msgwriter:INFO`.
Setting the categories to "" prevent any logs to be outputed.
Alias: *None*.
Inputs:
* *categories* - string; Optional, daemon log categories to enable
Show information about valid transactions seen by the node but not yet mined into a block, as well as spent key image information for the txpool in the node's memory.
Alias: *None*.
Inputs: *None*.
Outputs:
* *spent_key_images* - List of spent output key images:
* *id_hash* - string; Key image.
* *txs_hashes* - string list; tx hashes of the txes (usually one) spending that key image.
* *status* - string; General RPC error code. "OK" means everything looks good.
* *transactions* - List of transactions in the mempool are not in a block on the main chain at the moment:
* *blob_size* - unsigned int; The size of the full transaction blob.
* *double_spend_seen* - boolean; States if this transaction has been seen as double spend.
* *do_not_relay*; boolean; States if this transaction should not be relayed
* *fee* - unsigned int; The amount of the mining fee included in the transaction, in @atomic-units.
* *id_hash* - string; The transaction ID hash.
* *kept_by_block* - boolean; States if the tx was included in a block at least once (`true`) or not (`false`).
* *last_failed_height* - unsigned int; If the transaction validation has previously failed, this tells at what height that occured.
* *last_failed_id_hash* - string; Like the previous, this tells the previous transaction ID hash.
* *last_relayed_time* - unsigned int; Last unix time at which the transaction has been relayed.
* *max_used_block_height* - unsigned int; Tells the height of the most recent block with an output used in this transaction.
* *max_used_block_hash* - string; Tells the hash of the most recent block with an output used in this transaction.
* *receive_time* - unsigned int; The Unix time that the transaction was first seen on the network by the node.
* *relayed* - boolean; States if this transaction has been relayed
* *tx_blob* - unsigned int; Hexadecimal blob represnting the transaction.
* *tx_json* - json string; JSON structure of all information in the transaction:
* *version* - Transaction version
* *unlock_time* - If not 0, this tells when a transaction output is spendable.
* *vin* - List of inputs into transaction:
* *key* - The public key of the previous output spent in this transaction.
* *amount* - The amount of the input, in @atomic-units.
* *key_offsets* - A list of integer offets to the input.
* *k_image* - The key image for the given input
* *vout* - List of outputs from transaction:
* *amount* - Amount of transaction output, in @atomic-units.
* *target* - Output destination information:
* *key* - The stealth public key of the receiver. Whoever owns the private key associated with this key controls this transaction output.
* *extra* - Usually called the "transaction ID" but can be used to include any random 32 bytes.
* *rct_signatures* - Ring signatures:
* *type*
* *txnFee*
* *ecdhInfo* - array of Diffie Helman Elipctic curves structures as follows:
* *mask* - String
* *amount* - String
* *outPk*
* *rctsig_prunable*
* *rangeSigs* - array of structures as follows:
* *asig*
* *Ci*
* *MGs* - array of structures as follows:
* *ss* - array of arrays of two strings.
* *cc* - String
Example (Note: Some lists in the returned information have been truncated for display reasons):
* *status* - string; General RPC error code. "OK" means everything looks good.
* *tx_hashes* - binary array of transaction hashes.
* *untrusted* - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (`true`), or when the daemon is fully synced (`false`).
* *bytes_max* - unsigned int; Max transaction size in pool
* *bytes_med* - unsigned int; Median transaction size in pool
* *bytes_min* - unsigned int; Min transaction size in pool
* *bytes_total* - unsigned int; total size of all transactions in pool
* *histo* - structure *txpool_histo* as follows:
* *txs* - unsigned int; number of transactions
* *bytes* - unsigned int; size in bytes.
* *histo_98pc* unsigned int; the time 98% of txes are "younger" than
* *num_10m* unsigned int; number of transactions in pool for more than 10 minutes
* *num_double_spends* unsigned int; number of double spend transactions
* *num_failing* unsigned int; number of failing transactions
* *num_not_relayed* unsigned int; number of non-relayed transactions
* *oldest* unsigned int; unix time of the oldest transaction in the pool
* *txs_total* unsigned int; total number of transactions.
* *status* - string; General RPC error code. "OK" means everything looks good.
* *untrusted* - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (`true`), or when the daemon is fully synced (`false`).
This method is a convenient backward support and should not be used anymore. See [get_info](#get_info) JSON RPC for details.
Alias:
* */getinfo*
* *get_info*
### **/get_limit**
Get daemon bandwidth limits.
Alias: *None*.
Inputs: *None*.
Outputs:
* *limit_down* - unsigned int; Download limit in kBytes per second
* *limit_up* - unsigned int; Upload limit in kBytes per second
* *status* - string; General RPC error code. "OK" means everything looks good.
* *untrusted* - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (`true`), or when the daemon is fully synced (`false`).
* *outs* - array of structure *outkey* as follows:
* *height* - unsigned int; block height of the output
* *key* - String; the public key of the output
* *mask* - String
* *txid* - String; transaction id
* *unlocked* - boolean; States if output is locked (`false`) or not (`true`)
* *status* - string; General RPC error code. "OK" means everything looks good.
* *untrusted* - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (`true`), or when the daemon is fully synced (`false`).
### **/update**
Update daemon.
Alias: *None*.
Inputs:
* *command* - String; command to use, either `check` or `download`
* *path* - String; Optional, path where to download the update.
Outputs:
* *auto_uri* - string;
* *hash* - string;
* *path* - String; path to download the update
* *status* - string; General RPC error code. "OK" means everything looks good.
* *update* - boolean; States if an update is available to download (`true`) or not (`false`)
* *user_uri* - string;
* *version* - string; Version available for download.