diff --git a/docs/en/rpc-library/monerod-rpc.md b/docs/en/rpc-library/monerod-rpc.md index 367778d..67f6e21 100644 --- a/docs/en/rpc-library/monerod-rpc.md +++ b/docs/en/rpc-library/monerod-rpc.md @@ -15,78 +15,77 @@ Note: "[atomic-units](https://www.getmonero.org/resources/moneropedia/atomic-uni ### [JSON RPC Methods](#json-rpc-methods): -- [get_block_count](#get_block_count) -- [on_get_block_hash](#on_get_block_hash) -- [get_block_template](#get_block_template) -- [submit_block](#submit_block) +- [add_aux_pow](#add_aux_pow) +- [banned](#banned) +- [calc_pow](#calc_pow) +- [flush_cache](#flush_cache) +- [flush_txpool](#flush_txpool) - [generateblocks](#generateblocks) -- [get_last_block_header](#get_last_block_header) +- [get_alternate_chains](#get_alternate_chains) +- [get_bans](#get_bans) +- [get_block](#get_block) +- [get_block_count](#get_block_count) - [get_block_header_by_hash](#get_block_header_by_hash) - [get_block_header_by_height](#get_block_header_by_height) - [get_block_headers_range](#get_block_headers_range) -- [get_block](#get_block) -- [get_connections](#get_connections) -- [get_info](#get_info) -- [hard_fork_info](#hard_fork_info) -- [set_bans](#set_bans) -- [get_bans](#get_bans) -- [banned](#banned) -- [flush_txpool](#flush_txpool) -- [get_output_histogram](#get_output_histogram) -- [get_version](#get_version) +- [get_block_template](#get_block_template) - [get_coinbase_tx_sum](#get_coinbase_tx_sum) +- [get_connections](#get_connections) - [get_fee_estimate](#get_fee_estimate) -- [get_alternate_chains](#get_alternate_chains) -- [relay_tx](#relay_tx) -- [sync_info](#sync_info) -- [get_txpool_backlog](#get_txpool_backlog) -- [get_output_distribution](#get_output_distribution) +- [get_info](#get_info) +- [get_last_block_header](#get_last_block_header) - [get_miner_data](#get_miner_data) +- [get_output_distribution](#get_output_distribution) +- [get_output_histogram](#get_output_histogram) +- [get_txpool_backlog](#get_txpool_backlog) +- [get_version](#get_version) +- [hard_fork_info](#hard_fork_info) +- [on_get_block_hash](#on_get_block_hash) - [prune_blockchain](#prune_blockchain) -- [calc_pow](#calc_pow) -- [flush_cache](#flush_cache) -- [add_aux_pow](#add_aux_pow) - +- [relay_tx](#relay_tx) +- [set_bans](#set_bans) +- [submit_block](#submit_block) +- [sync_info](#sync_info) ### [Other RPC Methods](#other-daemon-rpc-calls): -- [/get_height](#get_height) +- [/get_alt_blocks_hashes](#get_alt_blocks_hashes) - [/get_blocks.bin](#get_blocksbin) - [/get_blocks_by_height.bin](#get_blocks_by_heightbin) - [/get_hashes.bin](#get_hashesbin) -- [/get_o_indexes.bin](#get_o_indexesbin) -- [/get_outs.bin](#get_outsbin) -- [/get_output_distribution.bin](#get_output_distributionbin) -- [/get_transactions](#get_transactions) -- [/get_alt_blocks_hashes](#get_alt_blocks_hashes) -- [/is_key_image_spent](#is_key_image_spent) -- [/send_raw_transaction](#send_raw_transaction) -- [/start_mining](#start_mining) -- [/stop_mining](#stop_mining) -- [/mining_status](#mining_status) -- [/save_bc](#save_bc) -- [/get_peer_list](#get_peer_list) -- [/set_log_hash_rate](#set_log_hash_rate) -- [/set_log_level](#set_log_level) -- [/set_log_categories](#set_log_categories) -- [/set_bootstrap_daemon](#set_bootstrap_daemon) -- [/get_transaction_pool](#get_transaction_pool) -- [/get_transaction_pool_hashes.bin](#get_transaction_pool_hashesbin) -- [/get_transaction_pool_stats](#get_transaction_pool_stats) -- [/stop_daemon](#stop_daemon) +- [/get_height](#get_height) - [/get_info (not JSON)](#get_info-not-json) - [/get_limit](#get_limit) -- [/set_limit](#set_limit) -- [/out_peers](#out_peers) -- [/in_peers](#in_peers) - [/get_net_stats](#get_net_stats) -- [/start_save_graph](#start_save_graph) -- [/stop_save_graph](#stop_save_graph) +- [/get_o_indexes.bin](#get_o_indexesbin) +- [/get_output_distribution.bin](#get_output_distributionbin) - [/get_outs](#get_outs) -- [/update](#update) -- [/pop_blocks](#pop_blocks) -- [/get_transaction_pool_hashes](#get_transaction_pool_hashes) +- [/get_outs.bin](#get_outsbin) +- [/get_peer_list](#get_peer_list) - [/get_public_nodes](#get_public_nodes) +- [/get_transaction_pool](#get_transaction_pool) +- [/get_transaction_pool_hashes](#get_transaction_pool_hashes) +- [/get_transaction_pool_hashes.bin](#get_transaction_pool_hashesbin) +- [/get_transaction_pool_stats](#get_transaction_pool_stats) +- [/get_transactions](#get_transactions) +- [/in_peers](#in_peers) +- [/is_key_image_spent](#is_key_image_spent) +- [/mining_status](#mining_status) +- [/out_peers](#out_peers) +- [/pop_blocks](#pop_blocks) +- [/save_bc](#save_bc) +- [/send_raw_transaction](#send_raw_transaction) +- [/set_bootstrap_daemon](#set_bootstrap_daemon) +- [/set_limit](#set_limit) +- [/set_log_categories](#set_log_categories) +- [/set_log_hash_rate](#set_log_hash_rate) +- [/set_log_level](#set_log_level) +- [/start_mining](#start_mining) +- [/start_save_graph](#start_save_graph) +- [/stop_daemon](#stop_daemon) +- [/stop_mining](#stop_mining) +- [/stop_save_graph](#stop_save_graph) +- [/update](#update) --- @@ -109,148 +108,181 @@ curl \ Some methods include parameters, while others do not. Examples of each JSON RPC method follow. -### **get_block_count** +### **add_aux_pow** -Look up how many blocks are in the longest chain known to the node. +Easily enable merge mining with Monero without requiring software that manually alters the extra field in the coinbase tx to include the merkle root of the aux blocks. -Alias: _getblockcount_ . - -Inputs: _None_ . - -Outputs: - -- _count_ - unsigned int; Number of blocks in longest chain seen by the node. -- _status_ - string; General RPC error code. "OK" means everything looks good. -- _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 and thus handles the RPC locally (`false`) - -Example: - -```Bash -$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block_count"}' -H 'Content-Type: application/json' - -{ - "id": "0", - "jsonrpc": "2.0", - "result": { - "count": 993163, - "status": "OK" - "untrusted": "false" - } -} -``` - - -### **on_get_block_hash** - -Look up a block's hash by its height. - -Alias: _on_getblockhash_ . +Alias: _None_ . Inputs: -* block height (int array of length 1) +- _blocktemplate_blob_ - string; +- _aux_pow_ - array; + - _id_ - string; + - _hash_ - string; Outputs: -* block hash (string) +- _blocktemplate_blob_ - string; +- _blockhashing_blob_ - string; +- _merkle_root_ - string; +- _merkle_tree_depth_ - unsigned int; +- _aux_pow_ - array; + - _id_ - string; + - _hash_ - string; Example: ```Bash -$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"on_get_block_hash","params":[912345]}' -H 'Content-Type: application/json' - -{ - "id": "0", - "jsonrpc": "2.0", - "result": "e22cf75f39ae720e8b71b3d120a5ac03f0db50bba6379e2850975b4859190bc6" -} -``` - - -### **get_block_template** - -Get a block template on which mining a new block. - -Alias: _getblocktemplate_ . - -Inputs: - -- _wallet_address_ - string; Address of wallet to receive coinbase transactions if block is successfully mined. -- _reserve_size_ - unsigned int; Reserve size. - -Outputs: - -- _blocktemplate_blob_ - string; Blob on which to try to mine a new block. -- _blockhashing_blob_ - string; Blob on which to try to find a valid nonce. -- _difficulty_ - unsigned int; Least-significant 64 bits of the 128-bit network difficulty. -- _difficulty_top64_ - unsigned int; Most-significant 64 bits of the 128-bit network difficulty. -- _expected_reward_ - unsigned int; Coinbase reward expected to be received if block is successfully mined. -- _height_ - unsigned int; Height on which to mine. -- _next_seed_hash_ - string; Hash of the next block to use as seed for Random-X proof-of-work. -- _prev_hash_ - string; Hash of the most recent block on which to mine the next block. -- _reserved_offset_ - unsigned int; Reserved offset. -- _seed_hash_ - string; Hash of block to use as seed for Random-X proof-of-work. -- _seed_height_ - unsigned int; Height of block to use as seed for Random-X proof-of-work. -- _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 and thus handles the RPC locally (`false`) -- _wide_difficulty_ - string; Network difficulty (analogous to the strength of the network) as a hexadecimal string representing a 128-bit number. - -Example: - -```Bash -$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block_template","params":{"wallet_address":"44GBHzv6ZyQdJkjqZje6KLZ3xSyN1hBSFAnLP6EAqJtCRVzMzZmeXTC2AHKDS9aEDTRKmo6a6o9r9j86pYfhCWDkKjbtcns","reserve_size":60}}' -H 'Content-Type: application/json' +$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"add_aux_pow","params":{"blocktemplate_blob":" ... ","aux_pow":[{"id":"3200b4ea97c3b2081cd4190b58e49572b2319fed00d030ad51809dff06b5d8c8","hash":"7b35762de164b20885e15dbe656b1138db06bb402fa1796f5765a23933d8859a"}]}}' -H 'Content-Type: application/json'' { "id": "0", "jsonrpc": "2.0", "result": { - "blockhashing_blob": "0e0ed286da8006ecdc1aab3033cf1716c52f13f9d8ae0051615a2453643de94643b550d543becd00000000d130d22cf308b308498bbc16e2e955e7dbd691e6a8fab805f98ad82e6faa8bcc06", - "blocktemplate_blob": "0e0ed286da8006ecdc1aab3033cf1716c52f13f9d8ae0051615a2453643de94643b550d543becd0000000002abc78b0101ffefc68b0101fcfcf0d4b422025014bb4a1eade6622fd781cb1063381cad396efa69719b41aa28b4fce8c7ad4b5f019ce1dc670456b24a5e03c2d9058a2df10fec779e2579753b1847b74ee644f16b023c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000051399a1bc46a846474f5b33db24eae173a26393b976054ee14f9feefe99925233802867097564c9db7a36af5bb5ed33ab46e63092bd8d32cef121608c3258edd55562812e21cc7e3ac73045745a72f7d74581d9a0849d6f30e8b2923171253e864f4e9ddea3acb5bc755f1c4a878130a70c26297540bc0b7a57affb6b35c1f03d8dbd54ece8457531f8cba15bb74516779c01193e212050423020e45aa2c15dcb", - "difficulty": 226807339040, - "difficulty_top64": 0, - "expected_reward": 1182367759996, - "height": 2286447, - "next_seed_hash": "", - "prev_hash": "ecdc1aab3033cf1716c52f13f9d8ae0051615a2453643de94643b550d543becd", - "reserved_offset": 130, - "seed_hash": "d432f499205150873b2572b5f033c9c6e4b7c6f3394bd2dd93822cd7085e7307", - "seed_height": 2285568, + "aux_pow": [{ + "hash": "7b35762de164b20885e15dbe656b1138db06bb402fa1796f5765a23933d8859a", + "id": "3200b4ea97c3b2081cd4190b58e49572b2319fed00d030ad51809dff06b5d8c8" + }], + "blockhashing_blob": "1010ee97e2a106e9f8ebe8887e5b609949ac8ea6143e560ed13552b110cb009b21f0cfca1eaccf00000000b2685c1283a646bc9020c758daa443be145b7370ce5a6efacb3e614117032e2c22", + "blocktemplate_blob": " ... ", + "merkle_root": "7b35762de164b20885e15dbe656b1138db06bb402fa1796f5765a23933d8859a", + "merkle_tree_depth": 0, "status": "OK", - "untrusted": false, - "wide_difficulty": "0x34cec55820" + "untrusted": false } +} ``` -### **submit_block** +--- -Submit a mined block to the network. +### **banned** -Alias: _submitblock_ . +Check if an IP address is banned and for how long. + +Alias: _None_ Inputs: -* 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. +- _address_ - string; Outputs: -- _status_ - string; Block submit status. +- _status_ - string; General RPC error code. "OK" means everything looks good. +- _banned_ - boolean; +- _seconds_ - unsigned int; -In this example, a block blob which has not been mined is submitted: +Example: ```Bash -$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"submit_block","params":["0707e6bdfedc053771512f1bc27c62731ae9e8f2443db64ce742f4e57f5cf8d393de28551e441a0000000002fb830a01ffbf830a018cfe88bee283060274c0aae2ef5730e680308d9c00b6da59187ad0352efe3c71d36eeeb28782f29f2501bd56b952c3ddc3e350c2631d3a5086cac172c56893831228b17de296ff4669de020200000000"]}' -H 'Content-Type: application/json' +$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"banned","params":{"address":"95.216.203.255"}}' -H 'Content-Type: application/json' { - "error": { - "code": -7, - "message": "Block not accepted" - }, "id": "0", - "jsonrpc": "2.0" + "jsonrpc": "2.0", + "result": { + "banned": true, + "seconds": 690413, + "status": "OK" + } } ``` + +### **calc_pow** + +Calculate PoW hash for a block candidate. + +Alias: _None_ . + +Inputs: + +- _major_version_ - unsigned int; The major version of the monero protocol at this block height. +- _height_ - unsigned int; +- _block_blob_ - blobdata; +- _seed_hash_ - string; + +Outputs: + +- _result_ - string; PoW hash. + +Example: + +```Bash +$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"calc_pow","params":{"major_version":14,"height":2286447,"block_blob":"0e0ed286da8006ecdc1aab3033cf1716c52f13f9d8ae0051615a2453643de94643b550d543becd0000000002abc78b0101ffefc68b0101fcfcf0d4b422025014bb4a1eade6622fd781cb1063381cad396efa69719b41aa28b4fce8c7ad4b5f019ce1dc670456b24a5e03c2d9058a2df10fec779e2579753b1847b74ee644f16b023c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000051399a1bc46a846474f5b33db24eae173a26393b976054ee14f9feefe99925233802867097564c9db7a36af5bb5ed33ab46e63092bd8d32cef121608c3258edd55562812e21cc7e3ac73045745a72f7d74581d9a0849d6f30e8b2923171253e864f4e9ddea3acb5bc755f1c4a878130a70c26297540bc0b7a57affb6b35c1f03d8dbd54ece8457531f8cba15bb74516779c01193e212050423020e45aa2c15dcb","seed_hash":"d432f499205150873b2572b5f033c9c6e4b7c6f3394bd2dd93822cd7085e7307"}}' -H 'Content-Type: application/json' + +{ + "id": "0", + "jsonrpc": "2.0", + "result": "d0402d6834e26fb94a9ce38c6424d27d2069896a9b8b1ce685d79936bca6e0a8" +} +``` + + + +### **flush_cache** + +Flush bad transactions / blocks from the cache. + +Alias: _None_ . + +Inputs: + +- _bad_txs_ - boolean; Optional (`false` by default). +- _bad_blocks_ - boolean; Optional (`false` by default). + +Outputs: + +- _status_ - string; General RPC error code. "OK" means everything looks good. +- _untrusted_ - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (`true`), or when the daemon is fully synced and thus handles the RPC locally (`false`) + +Example: + +```Bash +$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"flush_cache","params":{"bad_txs":true,"bad_blocks":true}}' -H 'Content-Type: application/json' + +{ + "id": "0", + "jsonrpc": "2.0", + "result": { + "status": "OK", + "untrusted": false + } +} +``` + + + +### **flush_txpool** + +Flush tx ids from transaction pool + +Alias: _None_ . + +Inputs: + +- _txids_ - array of strings; Optional, list of transactions IDs to flush from pool (all tx ids flushed if empty). + +Outputs: + +- _status_ - string; General RPC error code. "OK" means everything looks good. + +Example: + +```Bash +$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"flush_txpool","params":{"txids":["dc16fa8eaffe1484ca9014ea050e13131d3acf23b419f33bb4cc0b32b6c49308",""]}}' -H 'Content-Type: application/json' + +{ + "id": "0", + "jsonrpc": "2.0", + "result": { + "status": "OK" + } +} +``` + + ### **generateblocks** Generate a block and specify the address to receive the coinbase reward. @@ -284,290 +316,99 @@ $ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"g } ``` -### **get_last_block_header** -Block header information for the most recent block is easily retrieved with this method. No inputs are needed. +### **get_alternate_chains** -Alias: _getlastblockheader_ . +Display alternative chains seen by the node. -Inputs: +Alias: _None_ . -- _fill_pow_hash_ - boolean; (Optional; defaults to `false`) Add PoW hash to block_header response. +Inputs: _None_ . Outputs: -- _block_header_ - A structure containing block header information. - - _block_size_ - unsigned int; Backward compatibility, same as _block_weight_ , use that instead - - _block_weight_ - unsigned int; The adjusted block size, in bytes. This is the raw size, plus a positive adjustment for any Bulletproof transactions with more than 2 outputs. - - _cumulative_difficulty_ - unsigned int; Least-significant 64 bits of the cumulative difficulty of all blocks up to the block in the reply. - - _cumulative_difficulty_top64_ - unsigned int; Most-significant 64 bits of the 128-bit cumulative difficulty. - - _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. +- _chains_ - array of chains, the following structure: + - _block_hash_ - string; the block hash of the first diverging block of this alternative chain. + - _block_hashes_ - array of strings; An array of all block hashes in the alternative chain that are not in the main chain. + - _difficulty_ - unsigned int; Least-significant 64 bits of 128-bit integer for the cumulative difficulty of all blocks in the alternative chain. - _difficulty_top64_ - unsigned int; Most-significant 64 bits of the 128-bit network difficulty. - - _hash_ - string; The hash of this block. - - _height_ - unsigned int; The number of blocks preceding this block on the blockchain. - - _long_term_weight_ - unsigned int; The long term block weight, based on the median weight of the preceding 100000 blocks. - - _major_version_ - unsigned int; The major version of the monero protocol at this block height. - - _miner_tx_hash_ - string; The hash of this block's coinbase transaction. - - _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. - - _pow_hash_ - string; The hash, as a hexadecimal string, calculated from the block as proof-of-work. - - _prev_hash_ - string; The hash of the block immediately preceding this block in the chain. - - _reward_ - unsigned int; The amount of new [atomic-units](https://www.getmonero.org/resources/moneropedia/atomic-units.html "Atomic Units refer to the smallest fraction of 1 XMR.") generated in this block and rewarded to the miner. Note: 1 XMR = 1e12 [atomic-units](https://www.getmonero.org/resources/moneropedia/atomic-units.html "Atomic Units refer to the smallest fraction of 1 XMR."). - - _timestamp_ - unsigned int; The unix time at which the block was recorded into the blockchain. - - _wide_cumulative_difficulty_ - Cumulative difficulty of all blocks in the blockchain as a hexadecimal string representing a 128-bit number. + - _height_ - unsigned int; the block height of the first diverging block of this alternative chain. + - _length_ - unsigned int; the length in blocks of this alternative chain, after divergence. + - _main_chain_parent_block_ - string; The hash of the greatest height block that is shared between the alternative chain and the main chain. - _wide_difficulty_ - string; Network difficulty (analogous to the strength of the network) as a hexadecimal string representing a 128-bit number. -- _credits_ - unsigned int; If payment for RPC is enabled, the number of credits available to the requesting client. Otherwise, 0. - _status_ - string; General RPC error code. "OK" means everything looks good. -- _top_hash_ - string; If payment for RPC is enabled, the hash of the highest block in the chain. Otherwise, empty. - _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 and thus handles the RPC locally (`false`) -In this example, the most recent block (1562023 at the time) is returned: +Example: ```Bash -$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_last_block_header"}' -H 'Content-Type: application/json' +$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_alternate_chains"}' -H 'Content-Type: application/json' { "id": "0", "jsonrpc": "2.0", "result": { - "block_header": { - "block_size": 5500, - "block_weight": 5500, - "cumulative_difficulty": 86164894009456483, - "cumulative_difficulty_top64": 0, - "depth": 0, - "difficulty": 227026389695, + "chains": [{ + "block_hash": "dd4998cfe92a959a5a0e4ed72432cf23d7dfc4179cbea871ee2a705d71fb5e25", + "block_hashes": ["dd4998cfe92a959a5a0e4ed72432cf23d7dfc4179cbea871ee2a705d71fb5e25"], + "difficulty": 86227995333492079, "difficulty_top64": 0, - "hash": "a6ad87cf357a1aac1ee1d7cb0afa4c2e653b0b1ab7d5bf6af310333e43c59dd0", - "height": 2286454, - "long_term_weight": 5500, - "major_version": 14, - "miner_tx_hash": "a474f87de1645ff14c5e90c477b07f9bc86a22fb42909caa0705239298da96d0", - "minor_version": 14, - "nonce": 249602367, - "num_txes": 3, - "orphan_status": false, - "pow_hash": "", - "prev_hash": "fa17fefe1d05da775a61a3dc33d9e199d12af167ef0ab37e52b51e8487b50f25", - "reward": 1181337498013, - "timestamp": 1612088597, - "wide_cumulative_difficulty": "0x1321e83bb8af763", - "wide_difficulty": "0x34dbd3cabf" - }, - "credits": 0, - "status": "OK", - "top_hash": "", - "untrusted": false - } -} -``` - - -### **get_block_header_by_hash** - -Block header information can be retrieved using either a block's hash or height. This method includes a block's hash as an input parameter to retrieve basic information about the block. - -Alias: _getblockheaderbyhash_ . - -Inputs: - -- _hash_ - string; The block's sha256 hash. -- _fill_pow_hash_ - boolean; (Optional; defaults to `false`) Add PoW hash to block_header response. - -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 and thus handles the RPC locally (`false`) - -In this example, block 912345 is looked up by its hash: - -```Bash -$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block_header_by_hash","params":{"hash":"e22cf75f39ae720e8b71b3d120a5ac03f0db50bba6379e2850975b4859190bc6"}}' -H 'Content-Type: application/json' - -{ - "id": "0", - "jsonrpc": "2.0", - "result": { - "block_header": { - "block_size": 210, - "block_weight": 210, - "cumulative_difficulty": 754734824984346, - "cumulative_difficulty_top64": 0, - "depth": 1374113, - "difficulty": 815625611, - "difficulty_top64": 0, - "hash": "e22cf75f39ae720e8b71b3d120a5ac03f0db50bba6379e2850975b4859190bc6", - "height": 912345, - "long_term_weight": 210, - "major_version": 1, - "miner_tx_hash": "c7da3965f25c19b8eb7dd8db48dcd4e7c885e2491db77e289f0609bf8e08ec30", - "minor_version": 2, - "nonce": 1646, - "num_txes": 0, - "orphan_status": false, - "pow_hash": "", - "prev_hash": "b61c58b2e0be53fad5ef9d9731a55e8a81d972b8d90ed07c04fd37ca6403ff78", - "reward": 7388968946286, - "timestamp": 1452793716, - "wide_cumulative_difficulty": "0x2ae6d65248f1a", - "wide_difficulty": "0x309d758b" - }, - "credits": 0, - "status": "OK", - "top_hash": "", - "untrusted": false - } -} -``` - - -### **get_block_header_by_height** - -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. -- _fill_pow_hash_ - boolean; (Optional; defaults to `false`) Add PoW hash to block_header response. - -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 and thus handles the RPC locally (`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): - -```Bash -$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block_header_by_height","params":{"height":912345}}' -H 'Content-Type: application/json' - -{ - "id": "0", - "jsonrpc": "2.0", - "result": { - "block_header": { - "block_size": 210, - "block_weight": 210, - "cumulative_difficulty": 754734824984346, - "cumulative_difficulty_top64": 0, - "depth": 1374118, - "difficulty": 815625611, - "difficulty_top64": 0, - "hash": "e22cf75f39ae720e8b71b3d120a5ac03f0db50bba6379e2850975b4859190bc6", - "height": 912345, - "long_term_weight": 210, - "major_version": 1, - "miner_tx_hash": "c7da3965f25c19b8eb7dd8db48dcd4e7c885e2491db77e289f0609bf8e08ec30", - "minor_version": 2, - "nonce": 1646, - "num_txes": 0, - "orphan_status": false, - "pow_hash": "", - "prev_hash": "b61c58b2e0be53fad5ef9d9731a55e8a81d972b8d90ed07c04fd37ca6403ff78", - "reward": 7388968946286, - "timestamp": 1452793716, - "wide_cumulative_difficulty": "0x2ae6d65248f1a", - "wide_difficulty": "0x309d758b" - }, - "credits": 0, - "status": "OK", - "top_hash": "", - "untrusted": false - } -} -``` - -### **get_block_headers_range** - -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. -- _fill_pow_hash_ - boolean; (Optional; defaults to `false`) Add PoW hash to block_header response. - -Outputs: - -- _credits_ - unsigned int; If payment for RPC is enabled, the number of credits available to the requesting client. Otherwise, 0. -- _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. -- _top_hash_ - string; If payment for RPC is enabled, the hash of the highest block in the chain. Otherwise, empty. -- _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 and thus handles the RPC locally (`false`) - -In this example, blocks range from height 1545999 to 1546000 is looked up (notice that the returned information are ascending order and that it is at the April 2018 network upgrade time): - -```Bash -$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block_headers_range","params":{"start_height":1545999,"end_height":1546000}}' -H 'Content-Type: application/json' - -{ - "id": "0", - "jsonrpc": "2.0", - "result": { - "credits": 0, - "headers": [{ - "block_size": 301413, - "block_weight": 301413, - "cumulative_difficulty": 13185267971483472, - "cumulative_difficulty_top64": 0, - "depth": 740464, - "difficulty": 134636057921, - "difficulty_top64": 0, - "hash": "86d1d20a40cefcf3dd410ff6967e0491613b77bf73ea8f1bf2e335cf9cf7d57a", - "height": 1545999, - "long_term_weight": 301413, - "major_version": 6, - "miner_tx_hash": "9909c6f8a5267f043c3b2b079fb4eacc49ef9c1dee1c028eeb1a259b95e6e1d9", - "minor_version": 6, - "nonce": 3246403956, - "num_txes": 20, - "orphan_status": false, - "pow_hash": "", - "prev_hash": "0ef6e948f77b8f8806621003f5de24b1bcbea150bc0e376835aea099674a5db5", - "reward": 5025593029981, - "timestamp": 1523002893, - "wide_cumulative_difficulty": "0x2ed7ee6db56750", - "wide_difficulty": "0x1f58ef3541" - },{ - "block_size": 13322, - "block_weight": 13322, - "cumulative_difficulty": 13185402687569710, - "cumulative_difficulty_top64": 0, - "depth": 740463, - "difficulty": 134716086238, - "difficulty_top64": 0, - "hash": "b408bf4cfcd7de13e7e370c84b8314c85b24f0ba4093ca1d6eeb30b35e34e91a", - "height": 1546000, - "long_term_weight": 13322, - "major_version": 7, - "miner_tx_hash": "7f749c7c64acb35ef427c7454c45e6688781fbead9bbf222cb12ad1a96a4e8f6", - "minor_version": 7, - "nonce": 3737164176, - "num_txes": 1, - "orphan_status": false, - "pow_hash": "", - "prev_hash": "86d1d20a40cefcf3dd410ff6967e0491613b77bf73ea8f1bf2e335cf9cf7d57a", - "reward": 4851952181070, - "timestamp": 1523002931, - "wide_cumulative_difficulty": "0x2ed80dcb69bf2e", - "wide_difficulty": "0x1f5db457de" + "height": 2286736, + "length": 1, + "main_chain_parent_block": "6da3d2dc86ccc9353d19fc6b05083125f4ca7d22540d938010462f197a3fe590", + "wide_difficulty": "0x13257e7a78bfd6f" }], "status": "OK", - "top_hash": "", "untrusted": false } } ``` + +### **get_bans** + +Get list of banned IPs. + +Alias: _None_ . + +Inputs: _None_ . + +Outputs: + +- _bans_ - List of banned nodes: + - _host_ - string; Banned host (IP in A.B.C.D form). + - _ip_ - unsigned int; Banned IP address, in Int format. + - _seconds_ - unsigned int; Local Unix time that IP is banned until. +- _status_ - string; General RPC error code. "OK" means everything looks good. +- _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 and thus handles the RPC locally (`false`) + +Example: + +```Bash +$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_bans"}' -H 'Content-Type: application/json' + +{ + "id": "0", + "jsonrpc": "2.0", + "result": { + "bans": [{ + "host": "102.168.1.51", + "ip": 855746662, + "seconds": 22 + },{ + "host": "192.168.1.50", + "ip": 838969536, + "seconds": 28 + }], + "status": "OK" + "untrusted": false + } +} +``` + + + ### **get_block** Full block information can be retrieved by either block height or hash, like with the above block header calls. For full block information, both lookups use the same method, but with different input parameters. @@ -704,6 +545,349 @@ $ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"g ``` + +### **get_block_count** + +Look up how many blocks are in the longest chain known to the node. + +Alias: _getblockcount_ . + +Inputs: _None_ . + +Outputs: + +- _count_ - unsigned int; Number of blocks in longest chain seen by the node. +- _status_ - string; General RPC error code. "OK" means everything looks good. +- _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 and thus handles the RPC locally (`false`) + +Example: + +```Bash +$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block_count"}' -H 'Content-Type: application/json' + +{ + "id": "0", + "jsonrpc": "2.0", + "result": { + "count": 993163, + "status": "OK" + "untrusted": "false" + } +} +``` + + + +### **get_block_header_by_hash** + +Block header information can be retrieved using either a block's hash or height. This method includes a block's hash as an input parameter to retrieve basic information about the block. + +Alias: _getblockheaderbyhash_ . + +Inputs: + +- _hash_ - string; The block's sha256 hash. +- _fill_pow_hash_ - boolean; (Optional; defaults to `false`) Add PoW hash to block_header response. + +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 and thus handles the RPC locally (`false`) + +In this example, block 912345 is looked up by its hash: + +```Bash +$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block_header_by_hash","params":{"hash":"e22cf75f39ae720e8b71b3d120a5ac03f0db50bba6379e2850975b4859190bc6"}}' -H 'Content-Type: application/json' + +{ + "id": "0", + "jsonrpc": "2.0", + "result": { + "block_header": { + "block_size": 210, + "block_weight": 210, + "cumulative_difficulty": 754734824984346, + "cumulative_difficulty_top64": 0, + "depth": 1374113, + "difficulty": 815625611, + "difficulty_top64": 0, + "hash": "e22cf75f39ae720e8b71b3d120a5ac03f0db50bba6379e2850975b4859190bc6", + "height": 912345, + "long_term_weight": 210, + "major_version": 1, + "miner_tx_hash": "c7da3965f25c19b8eb7dd8db48dcd4e7c885e2491db77e289f0609bf8e08ec30", + "minor_version": 2, + "nonce": 1646, + "num_txes": 0, + "orphan_status": false, + "pow_hash": "", + "prev_hash": "b61c58b2e0be53fad5ef9d9731a55e8a81d972b8d90ed07c04fd37ca6403ff78", + "reward": 7388968946286, + "timestamp": 1452793716, + "wide_cumulative_difficulty": "0x2ae6d65248f1a", + "wide_difficulty": "0x309d758b" + }, + "credits": 0, + "status": "OK", + "top_hash": "", + "untrusted": false + } +} +``` + + + +### **get_block_header_by_height** + +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. +- _fill_pow_hash_ - boolean; (Optional; defaults to `false`) Add PoW hash to block_header response. + +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 and thus handles the RPC locally (`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): + +```Bash +$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block_header_by_height","params":{"height":912345}}' -H 'Content-Type: application/json' + +{ + "id": "0", + "jsonrpc": "2.0", + "result": { + "block_header": { + "block_size": 210, + "block_weight": 210, + "cumulative_difficulty": 754734824984346, + "cumulative_difficulty_top64": 0, + "depth": 1374118, + "difficulty": 815625611, + "difficulty_top64": 0, + "hash": "e22cf75f39ae720e8b71b3d120a5ac03f0db50bba6379e2850975b4859190bc6", + "height": 912345, + "long_term_weight": 210, + "major_version": 1, + "miner_tx_hash": "c7da3965f25c19b8eb7dd8db48dcd4e7c885e2491db77e289f0609bf8e08ec30", + "minor_version": 2, + "nonce": 1646, + "num_txes": 0, + "orphan_status": false, + "pow_hash": "", + "prev_hash": "b61c58b2e0be53fad5ef9d9731a55e8a81d972b8d90ed07c04fd37ca6403ff78", + "reward": 7388968946286, + "timestamp": 1452793716, + "wide_cumulative_difficulty": "0x2ae6d65248f1a", + "wide_difficulty": "0x309d758b" + }, + "credits": 0, + "status": "OK", + "top_hash": "", + "untrusted": false + } +} +``` + + +### **get_block_headers_range** + +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. +- _fill_pow_hash_ - boolean; (Optional; defaults to `false`) Add PoW hash to block_header response. + +Outputs: + +- _credits_ - unsigned int; If payment for RPC is enabled, the number of credits available to the requesting client. Otherwise, 0. +- _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. +- _top_hash_ - string; If payment for RPC is enabled, the hash of the highest block in the chain. Otherwise, empty. +- _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 and thus handles the RPC locally (`false`) + +In this example, blocks range from height 1545999 to 1546000 is looked up (notice that the returned information are ascending order and that it is at the April 2018 network upgrade time): + +```Bash +$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block_headers_range","params":{"start_height":1545999,"end_height":1546000}}' -H 'Content-Type: application/json' + +{ + "id": "0", + "jsonrpc": "2.0", + "result": { + "credits": 0, + "headers": [{ + "block_size": 301413, + "block_weight": 301413, + "cumulative_difficulty": 13185267971483472, + "cumulative_difficulty_top64": 0, + "depth": 740464, + "difficulty": 134636057921, + "difficulty_top64": 0, + "hash": "86d1d20a40cefcf3dd410ff6967e0491613b77bf73ea8f1bf2e335cf9cf7d57a", + "height": 1545999, + "long_term_weight": 301413, + "major_version": 6, + "miner_tx_hash": "9909c6f8a5267f043c3b2b079fb4eacc49ef9c1dee1c028eeb1a259b95e6e1d9", + "minor_version": 6, + "nonce": 3246403956, + "num_txes": 20, + "orphan_status": false, + "pow_hash": "", + "prev_hash": "0ef6e948f77b8f8806621003f5de24b1bcbea150bc0e376835aea099674a5db5", + "reward": 5025593029981, + "timestamp": 1523002893, + "wide_cumulative_difficulty": "0x2ed7ee6db56750", + "wide_difficulty": "0x1f58ef3541" + },{ + "block_size": 13322, + "block_weight": 13322, + "cumulative_difficulty": 13185402687569710, + "cumulative_difficulty_top64": 0, + "depth": 740463, + "difficulty": 134716086238, + "difficulty_top64": 0, + "hash": "b408bf4cfcd7de13e7e370c84b8314c85b24f0ba4093ca1d6eeb30b35e34e91a", + "height": 1546000, + "long_term_weight": 13322, + "major_version": 7, + "miner_tx_hash": "7f749c7c64acb35ef427c7454c45e6688781fbead9bbf222cb12ad1a96a4e8f6", + "minor_version": 7, + "nonce": 3737164176, + "num_txes": 1, + "orphan_status": false, + "pow_hash": "", + "prev_hash": "86d1d20a40cefcf3dd410ff6967e0491613b77bf73ea8f1bf2e335cf9cf7d57a", + "reward": 4851952181070, + "timestamp": 1523002931, + "wide_cumulative_difficulty": "0x2ed80dcb69bf2e", + "wide_difficulty": "0x1f5db457de" + }], + "status": "OK", + "top_hash": "", + "untrusted": false + } +} +``` + + + +### **get_block_template** + +Get a block template on which mining a new block. + +Alias: _getblocktemplate_ . + +Inputs: + +- _wallet_address_ - string; Address of wallet to receive coinbase transactions if block is successfully mined. +- _reserve_size_ - unsigned int; Reserve size. + +Outputs: + +- _blocktemplate_blob_ - string; Blob on which to try to mine a new block. +- _blockhashing_blob_ - string; Blob on which to try to find a valid nonce. +- _difficulty_ - unsigned int; Least-significant 64 bits of the 128-bit network difficulty. +- _difficulty_top64_ - unsigned int; Most-significant 64 bits of the 128-bit network difficulty. +- _expected_reward_ - unsigned int; Coinbase reward expected to be received if block is successfully mined. +- _height_ - unsigned int; Height on which to mine. +- _next_seed_hash_ - string; Hash of the next block to use as seed for Random-X proof-of-work. +- _prev_hash_ - string; Hash of the most recent block on which to mine the next block. +- _reserved_offset_ - unsigned int; Reserved offset. +- _seed_hash_ - string; Hash of block to use as seed for Random-X proof-of-work. +- _seed_height_ - unsigned int; Height of block to use as seed for Random-X proof-of-work. +- _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 and thus handles the RPC locally (`false`) +- _wide_difficulty_ - string; Network difficulty (analogous to the strength of the network) as a hexadecimal string representing a 128-bit number. + +Example: + +```Bash +$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block_template","params":{"wallet_address":"44GBHzv6ZyQdJkjqZje6KLZ3xSyN1hBSFAnLP6EAqJtCRVzMzZmeXTC2AHKDS9aEDTRKmo6a6o9r9j86pYfhCWDkKjbtcns","reserve_size":60}}' -H 'Content-Type: application/json' + +{ + "id": "0", + "jsonrpc": "2.0", + "result": { + "blockhashing_blob": "0e0ed286da8006ecdc1aab3033cf1716c52f13f9d8ae0051615a2453643de94643b550d543becd00000000d130d22cf308b308498bbc16e2e955e7dbd691e6a8fab805f98ad82e6faa8bcc06", + "blocktemplate_blob": "0e0ed286da8006ecdc1aab3033cf1716c52f13f9d8ae0051615a2453643de94643b550d543becd0000000002abc78b0101ffefc68b0101fcfcf0d4b422025014bb4a1eade6622fd781cb1063381cad396efa69719b41aa28b4fce8c7ad4b5f019ce1dc670456b24a5e03c2d9058a2df10fec779e2579753b1847b74ee644f16b023c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000051399a1bc46a846474f5b33db24eae173a26393b976054ee14f9feefe99925233802867097564c9db7a36af5bb5ed33ab46e63092bd8d32cef121608c3258edd55562812e21cc7e3ac73045745a72f7d74581d9a0849d6f30e8b2923171253e864f4e9ddea3acb5bc755f1c4a878130a70c26297540bc0b7a57affb6b35c1f03d8dbd54ece8457531f8cba15bb74516779c01193e212050423020e45aa2c15dcb", + "difficulty": 226807339040, + "difficulty_top64": 0, + "expected_reward": 1182367759996, + "height": 2286447, + "next_seed_hash": "", + "prev_hash": "ecdc1aab3033cf1716c52f13f9d8ae0051615a2453643de94643b550d543becd", + "reserved_offset": 130, + "seed_hash": "d432f499205150873b2572b5f033c9c6e4b7c6f3394bd2dd93822cd7085e7307", + "seed_height": 2285568, + "status": "OK", + "untrusted": false, + "wide_difficulty": "0x34cec55820" + } +``` + + + +### **get_coinbase_tx_sum** + +Get the coinbase amount and the fees amount for n last blocks starting at particular height + +Alias: _None_ . + +Inputs: + +- _height_ - unsigned int; Block height from which getting the amounts +- _count_ - unsigned int; number of blocks to include in the sum + +Outputs: + +- _credits_ - unsigned int; If payment for RPC is enabled, the number of credits available to the requesting client. Otherwise, 0. +- _emission_amount_ - unsigned int; Least significant 64 bits for 128 bit integer representing the sum of coinbase rewards in [atomic-units](https://www.getmonero.org/resources/moneropedia/atomic-units.html "Atomic Units refer to the smallest fraction of 1 XMR."). (See src/rpc/core_rpc_server.cpp store_128) +- _emission_amount_top64_ - unsigned it; Most significant 64 bits for 128 bit integer representing the sum of coinbase rewards in [atomic-units](https://www.getmonero.org/resources/moneropedia/atomic-units.html "Atomic Units refer to the smallest fraction of 1 XMR.") +- _fee_amount_ - unsigned int; Most significant 64 bits for 128 bit integer representing the sum of fees in [atomic-units](https://www.getmonero.org/resources/moneropedia/atomic-units.html "Atomic Units refer to the smallest fraction of 1 XMR."). +- _fee_amount_top64_ - unsigned int; Most significant 64 bits for 128 bit integer representing the sum of fees in [atomic-units](https://www.getmonero.org/resources/moneropedia/atomic-units.html "Atomic Units refer to the smallest fraction of 1 XMR."). +- _status_ - string; General RPC error code. "OK" means everything looks good. +- _top_hash_ - string; If payment for RPC is enabled, the hash of the highest block in the chain. Otherwise, empty. +- _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 and thus handles the RPC locally (`false`) +- _wide_emission_amount_ - string (128 bit hex encoded integer); Sum of coinbase rewards in [atomic-units](https://www.getmonero.org/resources/moneropedia/atomic-units.html "Atomic Units refer to the smallest fraction of 1 XMR."). +- _wide_fee_amount_ - string (128 bit hex encoded integer); Sum of fees in [atomic-units](https://www.getmonero.org/resources/moneropedia/atomic-units.html "Atomic Units refer to the smallest fraction of 1 XMR."). + +Example: + +```Bash +$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_coinbase_tx_sum","params":{"height":1563078,"count":2}}' -H 'Content-Type: application/json' + +{ + "id": "0", + "jsonrpc": "2.0", + "result": { + "credits": 0, + "emission_amount": 9471836197320, + "emission_amount_top64": 0, + "fee_amount": 0, + "fee_amount_top64": 0, + "status": "OK", + "top_hash": "", + "untrusted": false, + "wide_emission_amount": "0x89d556e91c8", + "wide_fee_amount": "0x0" + } +} +``` + + + ### **get_connections** Retrieve information about incoming and outgoing connections to your node. @@ -785,6 +969,49 @@ $ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"g ``` + +### **get_fee_estimate** + +Gives an estimation on fees per byte. + +Alias: _None_ . + +Inputs: + +- _grace_blocks_ - unsigned int; Optional + +Outputs: + +- _credits_ - unsigned int; If payment for RPC is enabled, the number of credits available to the requesting client. Otherwise, 0. +- _fee_ - unsigned int; Amount of fees estimated per byte in [atomic-units](https://www.getmonero.org/resources/moneropedia/atomic-units.html "Atomic Units refer to the smallest fraction of 1 XMR.") +- _fees_ - array of unsigned int; Represents the base fees at different priorities [slow, normal, fast, fastest]. +- _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. +- _top_hash_ - string; If payment for RPC is enabled, the hash of the highest block in the chain. Otherwise, empty. +- _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 and thus handles the RPC locally (`false`) + +Example: + +```Bash +$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_fee_estimate"}' -H 'Content-Type: application/json' + +{ + "id": "0", + "jsonrpc": "2.0", + "result": { + "credits": 0, + "fee": 7874, + "fees": [20000,80000,320000,4000000], + "quantization_mask": 10000, + "status": "OK", + "top_hash": "", + "untrusted": false + } +} +``` + + + ### **get_info** Retrieve general information about the state of your node and the network. @@ -899,6 +1126,307 @@ $ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"g ``` + +### **get_last_block_header** + +Block header information for the most recent block is easily retrieved with this method. No inputs are needed. + +Alias: _getlastblockheader_ . + +Inputs: + +- _fill_pow_hash_ - boolean; (Optional; defaults to `false`) Add PoW hash to block_header response. + +Outputs: + +- _block_header_ - A structure containing block header information. + - _block_size_ - unsigned int; Backward compatibility, same as _block_weight_ , use that instead + - _block_weight_ - unsigned int; The adjusted block size, in bytes. This is the raw size, plus a positive adjustment for any Bulletproof transactions with more than 2 outputs. + - _cumulative_difficulty_ - unsigned int; Least-significant 64 bits of the cumulative difficulty of all blocks up to the block in the reply. + - _cumulative_difficulty_top64_ - unsigned int; Most-significant 64 bits of the 128-bit cumulative difficulty. + - _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. + - _difficulty_top64_ - unsigned int; Most-significant 64 bits of the 128-bit network difficulty. + - _hash_ - string; The hash of this block. + - _height_ - unsigned int; The number of blocks preceding this block on the blockchain. + - _long_term_weight_ - unsigned int; The long term block weight, based on the median weight of the preceding 100000 blocks. + - _major_version_ - unsigned int; The major version of the monero protocol at this block height. + - _miner_tx_hash_ - string; The hash of this block's coinbase transaction. + - _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. + - _pow_hash_ - string; The hash, as a hexadecimal string, calculated from the block as proof-of-work. + - _prev_hash_ - string; The hash of the block immediately preceding this block in the chain. + - _reward_ - unsigned int; The amount of new [atomic-units](https://www.getmonero.org/resources/moneropedia/atomic-units.html "Atomic Units refer to the smallest fraction of 1 XMR.") generated in this block and rewarded to the miner. Note: 1 XMR = 1e12 [atomic-units](https://www.getmonero.org/resources/moneropedia/atomic-units.html "Atomic Units refer to the smallest fraction of 1 XMR."). + - _timestamp_ - unsigned int; The unix time at which the block was recorded into the blockchain. + - _wide_cumulative_difficulty_ - Cumulative difficulty of all blocks in the blockchain as a hexadecimal string representing a 128-bit number. + - _wide_difficulty_ - string; Network difficulty (analogous to the strength of the network) as a hexadecimal string representing a 128-bit number. +- _credits_ - unsigned int; If payment for RPC is enabled, the number of credits available to the requesting client. Otherwise, 0. +- _status_ - string; General RPC error code. "OK" means everything looks good. +- _top_hash_ - string; If payment for RPC is enabled, the hash of the highest block in the chain. Otherwise, empty. +- _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 and thus handles the RPC locally (`false`) + +In this example, the most recent block (1562023 at the time) is returned: + +```Bash +$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_last_block_header"}' -H 'Content-Type: application/json' + +{ + "id": "0", + "jsonrpc": "2.0", + "result": { + "block_header": { + "block_size": 5500, + "block_weight": 5500, + "cumulative_difficulty": 86164894009456483, + "cumulative_difficulty_top64": 0, + "depth": 0, + "difficulty": 227026389695, + "difficulty_top64": 0, + "hash": "a6ad87cf357a1aac1ee1d7cb0afa4c2e653b0b1ab7d5bf6af310333e43c59dd0", + "height": 2286454, + "long_term_weight": 5500, + "major_version": 14, + "miner_tx_hash": "a474f87de1645ff14c5e90c477b07f9bc86a22fb42909caa0705239298da96d0", + "minor_version": 14, + "nonce": 249602367, + "num_txes": 3, + "orphan_status": false, + "pow_hash": "", + "prev_hash": "fa17fefe1d05da775a61a3dc33d9e199d12af167ef0ab37e52b51e8487b50f25", + "reward": 1181337498013, + "timestamp": 1612088597, + "wide_cumulative_difficulty": "0x1321e83bb8af763", + "wide_difficulty": "0x34dbd3cabf" + }, + "credits": 0, + "status": "OK", + "top_hash": "", + "untrusted": false + } +} +``` + + + +### **get_miner_data** + +Provide the necessary data to create a custom block template. They are used by p2pool. + +Inputs: _None_ . + +Outputs: + +- _major_version_ - unsigned int; major fork version. +- _height_ - unsigned int; current blockheight. +- _prev_id_ - string; previous block id. +- _seed_hash_ - string; RandomX seed hash. +- _difficulty_ - unsigned int; network. difficulty. +- _median_weight_ - unsigned int; median block weight. +- _already_generated_coins_ - unsigned int; coins mined by the network so far. +- _status_ - string; General RPC error code. "OK" means everything looks good. +- _tx_backlog_ - array of mineable mempool transactions. + - _id_ - string; + - _weight_ - unsigned int; + - _fee_ - unsigned int; +- _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 and thus handles the RPC locally (`false`) + +Example: + +```Bash +$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_miner_data"}' -H 'Content-Type: application/json' + +{ + "id": "0", + "jsonrpc": "2.0", + "result": { + "already_generated_coins": 18186022843595960691, + "difficulty": "0x48afae42de", + "height": 2731375, + "major_version": 16, + "median_weight": 300000, + "prev_id": "78d50c5894d187c4946d54410990ca59a75017628174a9e8c7055fa4ca5c7c6d", + "seed_hash": "a6b869d50eca3a43ec26fe4c369859cf36ae37ce6ecb76457d31ffeb8a6ca8a6", + "status": "OK", + "tx_backlog": [{ + "fee": 30700000, + "id": "9868490d6bb9207fdd9cf17ca1f6c791b92ca97de0365855ea5c089f67c22208", + "weight": 1535 + },{ + "fee": 44280000, + "id": "b6000b02bbec71e18ad704bcae09fb6e5ae86d897ced14a718753e76e86c0a0a", + "weight": 2214 + }], + "untrusted": false + } +} +``` + + + +### **get_output_distribution** + + + +Alias: _None_ . + +Inputs: + +- _amounts_ - array of unsigned int; amounts to look for +- _cumulative_ - boolean; (optional, default is `false`) States if the result should be cumulative (`true`) or not (`false`) +- _from_height_ - unsigned int; (optional, default is 0) starting height to check from +- _to_height_ - unsigned int; (optional, default is 0) ending height to check up to + +Outputs: + +- _distributions_ - array of structure distribution as follows: + - _amount_ - unsigned int + - _base_ - unsigned int + - _distribution_ - array of unsigned int + - _start_height_ - unsigned int +- _status_ - string; General RPC error code. "OK" means everything looks good. + +Example: + +```Bash +$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_output_distribution","params":{"amounts":[628780000],"from_height":1462078}}' -H 'Content-Type: application/json' + +{ + "id": "0", + "jsonrpc": "2.0", + "result": { + "distributions": [{ + "amount": 2628780000, + "base": 0, + "distribution": "", + "start_height": 1462078 + }], + "status": "OK" + } +} +``` + + + +### **get_output_histogram** + +Get a histogram of output amounts. For all amounts (possibly filtered by parameters), gives the number of outputs on the chain for that amount. +RingCT outputs counts as 0 amount. + +Inputs: + +- _amounts_ - list of unsigned int +- _min_count_ - unsigned int +- _max_count_ - unsigned int +- _unlocked_ - boolean +- _recent_cutoff_ - unsigned int + +Outputs: + +- _credits_ - unsigned int; If payment for RPC is enabled, the number of credits available to the requesting client. Otherwise, 0. +- _histogram_ - list of histogram entries, in the following structure: + - _amount_ - unsigned int; Output amount in [atomic-units](https://www.getmonero.org/resources/moneropedia/atomic-units.html "Atomic Units refer to the smallest fraction of 1 XMR.") + - _total_instances_ - unsigned int; + - _unlocked_instances_ - unsigned int; + - _recent_instances_ - unsigned int; +- _status_ - string; General RPC error code. "OK" means everything looks good. +- _top_hash_ - string; If payment for RPC is enabled, the hash of the highest block in the chain. Otherwise, empty. +- _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 and thus handles the RPC locally (`false`) + +Example: + +```Bash +$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_output_histogram","params":{"amounts":[20000000000]}}' -H 'Content-Type: application/json' + +{ + "id": "0", + "jsonrpc": "2.0", + "result": { + "credits": 0, + "histogram": [{ + "amount": 20000000000, + "recent_instances": 0, + "total_instances": 381477, + "unlocked_instances": 0 + }], + "status": "OK", + "top_hash": "", + "untrusted": false + } +} +``` + + + +### **get_txpool_backlog** + +Get all transaction pool backlog + +Alias: _None_ . + +Inputs: _None_ . + +Outputs: + +- _backlog_ : array of structures _tx_backlog_entry_ (in binary form): + - _blob_size_ - unsigned int (in binary form) + - _fee_ - unsigned int (in binary form) + - _time_in_pool_ - unsigned int (in binary form) +- _status_ - string; General RPC error code. "OK" means everything looks good. +- _untrusted_ - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (`true`), or when the daemon is fully synced and thus handles the RPC locally (`false`) + +Example: + +```Bash +$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_txpool_backlog"}' -H 'Content-Type: application/json' + +{ + "id": "0", + "jsonrpc": "2.0", + "result": { + "backlog": "...Binary...", + "status": "OK", + "untrusted": false + } +} +``` + + + +### **get_version** + +Give the node current version + +Alias: _None_ . + +Inputs: _None_ . + +Outputs: + +- _release_ - boolean; States if the daemon software version corresponds to an official tagged release (`true`), or not (`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 and thus handles the RPC locally (`false`) +- _version_ - unsigned int; + +Example: + +```Bash +$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_version"}' -H 'Content-Type: application/json' + +{ + "id": "0", + "jsonrpc": "2.0", + "result": { + "release": true, + "status": "OK", + "untrusted": false, + "version": 196613 + } +``` + + + ### **hard_fork_info** Look up information regarding hard fork voting and readiness. @@ -948,6 +1476,99 @@ $ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"h ``` + +### **on_get_block_hash** + +Look up a block's hash by its height. + +Alias: _on_getblockhash_ . + +Inputs: + +* block height (int array of length 1) + +Outputs: + +* block hash (string) + +Example: + +```Bash +$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"on_get_block_hash","params":[912345]}' -H 'Content-Type: application/json' + +{ + "id": "0", + "jsonrpc": "2.0", + "result": "e22cf75f39ae720e8b71b3d120a5ac03f0db50bba6379e2850975b4859190bc6" +} +``` + + + +### **prune_blockchain** + +Alias: _None_ . + +Inputs: + +- _check_ - boolean; Optional (`false` by default) - If set to `true` then pruning status is checked instead of initiating pruning. + +Outputs: + +- _pruned_ - boolean; +- _pruning_seed_ - unsigned int; Blockheight at which pruning began. +- _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 and thus handles the RPC locally (`false`) + +Example: + +```Bash +$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"prune_blockchain","params":{"check":true}}' -H 'Content-Type: application/json' + +{ + "id": "0", + "jsonrpc": "2.0", + "result": { + "pruned": true, + "pruning_seed": 387, + "status": "OK", + "untrusted": false + } +} +``` + + + +### **relay_tx** + +Relay a list of transaction IDs. + +Alias: _None_ . + +Inputs: + +- _txids_ - array of string; list of transaction IDs to relay + +Outputs: + +- _status_ - string; General RPC error code. "OK" means everything looks good. + +Example: + +```Bash +$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"relay_tx","params":{"txids":["9fd75c429cbe52da9a52f2ffc5fbd107fe7fd2099c0d8de274dc8a67e0c98613"]}}' -H 'Content-Type: application/json' + +{ + "id": "0", + "jsonrpc": "2.0", + "result": { + "status": "OK" + } +} +``` + + + ### **set_bans** Ban another node by IP. @@ -1002,351 +1623,33 @@ $ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"s ``` -### **get_bans** -Get list of banned IPs. +### **submit_block** -Alias: _None_ . +Submit a mined block to the network. -Inputs: _None_ . - -Outputs: - -- _bans_ - List of banned nodes: - - _host_ - string; Banned host (IP in A.B.C.D form). - - _ip_ - unsigned int; Banned IP address, in Int format. - - _seconds_ - unsigned int; Local Unix time that IP is banned until. -- _status_ - string; General RPC error code. "OK" means everything looks good. -- _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 and thus handles the RPC locally (`false`) - -Example: - -```Bash -$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_bans"}' -H 'Content-Type: application/json' - -{ - "id": "0", - "jsonrpc": "2.0", - "result": { - "bans": [{ - "host": "102.168.1.51", - "ip": 855746662, - "seconds": 22 - },{ - "host": "192.168.1.50", - "ip": 838969536, - "seconds": 28 - }], - "status": "OK" - "untrusted": false - } -} -``` - - -### **banned** - -Check if an IP address is banned and for how long. - -Alias: _None_ +Alias: _submitblock_ . Inputs: -- _address_ - string; +* 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; General RPC error code. "OK" means everything looks good. -- _banned_ - boolean; -- _seconds_ - unsigned int; +- _status_ - string; Block submit status. -Example: +In this example, a block blob which has not been mined is submitted: ```Bash -$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"banned","params":{"address":"95.216.203.255"}}' -H 'Content-Type: application/json' +$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"submit_block","params":["0707e6bdfedc053771512f1bc27c62731ae9e8f2443db64ce742f4e57f5cf8d393de28551e441a0000000002fb830a01ffbf830a018cfe88bee283060274c0aae2ef5730e680308d9c00b6da59187ad0352efe3c71d36eeeb28782f29f2501bd56b952c3ddc3e350c2631d3a5086cac172c56893831228b17de296ff4669de020200000000"]}' -H 'Content-Type: application/json' { + "error": { + "code": -7, + "message": "Block not accepted" + }, "id": "0", - "jsonrpc": "2.0", - "result": { - "banned": true, - "seconds": 690413, - "status": "OK" - } -} -``` - -### **flush_txpool** - -Flush tx ids from transaction pool - -Alias: _None_ . - -Inputs: - -- _txids_ - array of strings; Optional, list of transactions IDs to flush from pool (all tx ids flushed if empty). - -Outputs: - -- _status_ - string; General RPC error code. "OK" means everything looks good. - -Example: - -```Bash -$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"flush_txpool","params":{"txids":["dc16fa8eaffe1484ca9014ea050e13131d3acf23b419f33bb4cc0b32b6c49308",""]}}' -H 'Content-Type: application/json' - -{ - "id": "0", - "jsonrpc": "2.0", - "result": { - "status": "OK" - } -} -``` - -### **get_output_histogram** - -Get a histogram of output amounts. For all amounts (possibly filtered by parameters), gives the number of outputs on the chain for that amount. -RingCT outputs counts as 0 amount. - -Inputs: - -- _amounts_ - list of unsigned int -- _min_count_ - unsigned int -- _max_count_ - unsigned int -- _unlocked_ - boolean -- _recent_cutoff_ - unsigned int - -Outputs: - -- _credits_ - unsigned int; If payment for RPC is enabled, the number of credits available to the requesting client. Otherwise, 0. -- _histogram_ - list of histogram entries, in the following structure: - - _amount_ - unsigned int; Output amount in [atomic-units](https://www.getmonero.org/resources/moneropedia/atomic-units.html "Atomic Units refer to the smallest fraction of 1 XMR.") - - _total_instances_ - unsigned int; - - _unlocked_instances_ - unsigned int; - - _recent_instances_ - unsigned int; -- _status_ - string; General RPC error code. "OK" means everything looks good. -- _top_hash_ - string; If payment for RPC is enabled, the hash of the highest block in the chain. Otherwise, empty. -- _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 and thus handles the RPC locally (`false`) - -Example: - -```Bash -$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_output_histogram","params":{"amounts":[20000000000]}}' -H 'Content-Type: application/json' - -{ - "id": "0", - "jsonrpc": "2.0", - "result": { - "credits": 0, - "histogram": [{ - "amount": 20000000000, - "recent_instances": 0, - "total_instances": 381477, - "unlocked_instances": 0 - }], - "status": "OK", - "top_hash": "", - "untrusted": false - } -} -``` - - -### **get_coinbase_tx_sum** - -Get the coinbase amount and the fees amount for n last blocks starting at particular height - -Alias: _None_ . - -Inputs: - -- _height_ - unsigned int; Block height from which getting the amounts -- _count_ - unsigned int; number of blocks to include in the sum - -Outputs: - -- _credits_ - unsigned int; If payment for RPC is enabled, the number of credits available to the requesting client. Otherwise, 0. -- _emission_amount_ - unsigned int; Least significant 64 bits for 128 bit integer representing the sum of coinbase rewards in [atomic-units](https://www.getmonero.org/resources/moneropedia/atomic-units.html "Atomic Units refer to the smallest fraction of 1 XMR."). (See src/rpc/core_rpc_server.cpp store_128) -- _emission_amount_top64_ - unsigned it; Most significant 64 bits for 128 bit integer representing the sum of coinbase rewards in [atomic-units](https://www.getmonero.org/resources/moneropedia/atomic-units.html "Atomic Units refer to the smallest fraction of 1 XMR.") -- _fee_amount_ - unsigned int; Most significant 64 bits for 128 bit integer representing the sum of fees in [atomic-units](https://www.getmonero.org/resources/moneropedia/atomic-units.html "Atomic Units refer to the smallest fraction of 1 XMR."). -- _fee_amount_top64_ - unsigned int; Most significant 64 bits for 128 bit integer representing the sum of fees in [atomic-units](https://www.getmonero.org/resources/moneropedia/atomic-units.html "Atomic Units refer to the smallest fraction of 1 XMR."). -- _status_ - string; General RPC error code. "OK" means everything looks good. -- _top_hash_ - string; If payment for RPC is enabled, the hash of the highest block in the chain. Otherwise, empty. -- _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 and thus handles the RPC locally (`false`) -- _wide_emission_amount_ - string (128 bit hex encoded integer); Sum of coinbase rewards in [atomic-units](https://www.getmonero.org/resources/moneropedia/atomic-units.html "Atomic Units refer to the smallest fraction of 1 XMR."). -- _wide_fee_amount_ - string (128 bit hex encoded integer); Sum of fees in [atomic-units](https://www.getmonero.org/resources/moneropedia/atomic-units.html "Atomic Units refer to the smallest fraction of 1 XMR."). - -Example: - -```Bash -$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_coinbase_tx_sum","params":{"height":1563078,"count":2}}' -H 'Content-Type: application/json' - -{ - "id": "0", - "jsonrpc": "2.0", - "result": { - "credits": 0, - "emission_amount": 9471836197320, - "emission_amount_top64": 0, - "fee_amount": 0, - "fee_amount_top64": 0, - "status": "OK", - "top_hash": "", - "untrusted": false, - "wide_emission_amount": "0x89d556e91c8", - "wide_fee_amount": "0x0" - } -} -``` - - -### **get_version** - -Give the node current version - -Alias: _None_ . - -Inputs: _None_ . - -Outputs: - -- _release_ - boolean; States if the daemon software version corresponds to an official tagged release (`true`), or not (`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 and thus handles the RPC locally (`false`) -- _version_ - unsigned int; - -Example: - -```Bash -$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_version"}' -H 'Content-Type: application/json' - -{ - "id": "0", - "jsonrpc": "2.0", - "result": { - "release": true, - "status": "OK", - "untrusted": false, - "version": 196613 - } -``` - - -### **get_fee_estimate** - -Gives an estimation on fees per byte. - -Alias: _None_ . - -Inputs: - -- _grace_blocks_ - unsigned int; Optional - -Outputs: - -- _credits_ - unsigned int; If payment for RPC is enabled, the number of credits available to the requesting client. Otherwise, 0. -- _fee_ - unsigned int; Amount of fees estimated per byte in [atomic-units](https://www.getmonero.org/resources/moneropedia/atomic-units.html "Atomic Units refer to the smallest fraction of 1 XMR.") -- _fees_ - array of unsigned int; Represents the base fees at different priorities [slow, normal, fast, fastest]. -- _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. -- _top_hash_ - string; If payment for RPC is enabled, the hash of the highest block in the chain. Otherwise, empty. -- _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 and thus handles the RPC locally (`false`) - -Example: - -```Bash -$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_fee_estimate"}' -H 'Content-Type: application/json' - -{ - "id": "0", - "jsonrpc": "2.0", - "result": { - "credits": 0, - "fee": 7874, - "fees": [20000,80000,320000,4000000], - "quantization_mask": 10000, - "status": "OK", - "top_hash": "", - "untrusted": false - } -} -``` - - -### **get_alternate_chains** - -Display alternative chains seen by the node. - -Alias: _None_ . - -Inputs: _None_ . - -Outputs: - -- _chains_ - array of chains, the following structure: - - _block_hash_ - string; the block hash of the first diverging block of this alternative chain. - - _block_hashes_ - array of strings; An array of all block hashes in the alternative chain that are not in the main chain. - - _difficulty_ - unsigned int; Least-significant 64 bits of 128-bit integer for the cumulative difficulty of all blocks in the alternative chain. - - _difficulty_top64_ - unsigned int; Most-significant 64 bits of the 128-bit network difficulty. - - _height_ - unsigned int; the block height of the first diverging block of this alternative chain. - - _length_ - unsigned int; the length in blocks of this alternative chain, after divergence. - - _main_chain_parent_block_ - string; The hash of the greatest height block that is shared between the alternative chain and the main chain. - - _wide_difficulty_ - string; Network difficulty (analogous to the strength of the network) as a hexadecimal string representing a 128-bit number. -- _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 and thus handles the RPC locally (`false`) - -Example: - -```Bash -$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_alternate_chains"}' -H 'Content-Type: application/json' - -{ - "id": "0", - "jsonrpc": "2.0", - "result": { - "chains": [{ - "block_hash": "dd4998cfe92a959a5a0e4ed72432cf23d7dfc4179cbea871ee2a705d71fb5e25", - "block_hashes": ["dd4998cfe92a959a5a0e4ed72432cf23d7dfc4179cbea871ee2a705d71fb5e25"], - "difficulty": 86227995333492079, - "difficulty_top64": 0, - "height": 2286736, - "length": 1, - "main_chain_parent_block": "6da3d2dc86ccc9353d19fc6b05083125f4ca7d22540d938010462f197a3fe590", - "wide_difficulty": "0x13257e7a78bfd6f" - }], - "status": "OK", - "untrusted": false - } -} -``` - - -### **relay_tx** - -Relay a list of transaction IDs. - -Alias: _None_ . - -Inputs: - -- _txids_ - array of string; list of transaction IDs to relay - -Outputs: - -- _status_ - string; General RPC error code. "OK" means everything looks good. - -Example: - -```Bash -$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"relay_tx","params":{"txids":["9fd75c429cbe52da9a52f2ffc5fbd107fe7fd2099c0d8de274dc8a67e0c98613"]}}' -H 'Content-Type: application/json' - -{ - "id": "0", - "jsonrpc": "2.0", - "result": { - "status": "OK" - } + "jsonrpc": "2.0" } ``` @@ -1439,280 +1742,6 @@ $ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"s } ``` - -### **get_txpool_backlog** - -Get all transaction pool backlog - -Alias: _None_ . - -Inputs: _None_ . - -Outputs: - -- _backlog_ : array of structures _tx_backlog_entry_ (in binary form): - - _blob_size_ - unsigned int (in binary form) - - _fee_ - unsigned int (in binary form) - - _time_in_pool_ - unsigned int (in binary form) -- _status_ - string; General RPC error code. "OK" means everything looks good. -- _untrusted_ - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (`true`), or when the daemon is fully synced and thus handles the RPC locally (`false`) - -Example: - -```Bash -$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_txpool_backlog"}' -H 'Content-Type: application/json' - -{ - "id": "0", - "jsonrpc": "2.0", - "result": { - "backlog": "...Binary...", - "status": "OK", - "untrusted": false - } -} -``` - - -### **get_output_distribution** - - - -Alias: _None_ . - -Inputs: - -- _amounts_ - array of unsigned int; amounts to look for -- _cumulative_ - boolean; (optional, default is `false`) States if the result should be cumulative (`true`) or not (`false`) -- _from_height_ - unsigned int; (optional, default is 0) starting height to check from -- _to_height_ - unsigned int; (optional, default is 0) ending height to check up to - -Outputs: - -- _distributions_ - array of structure distribution as follows: - - _amount_ - unsigned int - - _base_ - unsigned int - - _distribution_ - array of unsigned int - - _start_height_ - unsigned int -- _status_ - string; General RPC error code. "OK" means everything looks good. - -Example: - -```Bash -$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_output_distribution","params":{"amounts":[628780000],"from_height":1462078}}' -H 'Content-Type: application/json' - -{ - "id": "0", - "jsonrpc": "2.0", - "result": { - "distributions": [{ - "amount": 2628780000, - "base": 0, - "distribution": "", - "start_height": 1462078 - }], - "status": "OK" - } -} -``` - - -### **get_miner_data** - -Provide the necessary data to create a custom block template. They are used by p2pool. - -Inputs: _None_ . - -Outputs: - -- _major_version_ - unsigned int; major fork version. -- _height_ - unsigned int; current blockheight. -- _prev_id_ - string; previous block id. -- _seed_hash_ - string; RandomX seed hash. -- _difficulty_ - unsigned int; network. difficulty. -- _median_weight_ - unsigned int; median block weight. -- _already_generated_coins_ - unsigned int; coins mined by the network so far. -- _status_ - string; General RPC error code. "OK" means everything looks good. -- _tx_backlog_ - array of mineable mempool transactions. - - _id_ - string; - - _weight_ - unsigned int; - - _fee_ - unsigned int; -- _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 and thus handles the RPC locally (`false`) - -Example: - -```Bash -$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_miner_data"}' -H 'Content-Type: application/json' - -{ - "id": "0", - "jsonrpc": "2.0", - "result": { - "already_generated_coins": 18186022843595960691, - "difficulty": "0x48afae42de", - "height": 2731375, - "major_version": 16, - "median_weight": 300000, - "prev_id": "78d50c5894d187c4946d54410990ca59a75017628174a9e8c7055fa4ca5c7c6d", - "seed_hash": "a6b869d50eca3a43ec26fe4c369859cf36ae37ce6ecb76457d31ffeb8a6ca8a6", - "status": "OK", - "tx_backlog": [{ - "fee": 30700000, - "id": "9868490d6bb9207fdd9cf17ca1f6c791b92ca97de0365855ea5c089f67c22208", - "weight": 1535 - },{ - "fee": 44280000, - "id": "b6000b02bbec71e18ad704bcae09fb6e5ae86d897ced14a718753e76e86c0a0a", - "weight": 2214 - }], - "untrusted": false - } -} -``` - - -### **prune_blockchain** - -Alias: _None_ . - -Inputs: - -- _check_ - boolean; Optional (`false` by default) - If set to `true` then pruning status is checked instead of initiating pruning. - -Outputs: - -- _pruned_ - boolean; -- _pruning_seed_ - unsigned int; Blockheight at which pruning began. -- _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 and thus handles the RPC locally (`false`) - -Example: - -```Bash -$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"prune_blockchain","params":{"check":true}}' -H 'Content-Type: application/json' - -{ - "id": "0", - "jsonrpc": "2.0", - "result": { - "pruned": true, - "pruning_seed": 387, - "status": "OK", - "untrusted": false - } -} -``` - - -### **calc_pow** - -Calculate PoW hash for a block candidate. - -Alias: _None_ . - -Inputs: - -- _major_version_ - unsigned int; The major version of the monero protocol at this block height. -- _height_ - unsigned int; -- _block_blob_ - blobdata; -- _seed_hash_ - string; - -Outputs: - -- _result_ - string; PoW hash. - -Example: - -```Bash -$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"calc_pow","params":{"major_version":14,"height":2286447,"block_blob":"0e0ed286da8006ecdc1aab3033cf1716c52f13f9d8ae0051615a2453643de94643b550d543becd0000000002abc78b0101ffefc68b0101fcfcf0d4b422025014bb4a1eade6622fd781cb1063381cad396efa69719b41aa28b4fce8c7ad4b5f019ce1dc670456b24a5e03c2d9058a2df10fec779e2579753b1847b74ee644f16b023c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000051399a1bc46a846474f5b33db24eae173a26393b976054ee14f9feefe99925233802867097564c9db7a36af5bb5ed33ab46e63092bd8d32cef121608c3258edd55562812e21cc7e3ac73045745a72f7d74581d9a0849d6f30e8b2923171253e864f4e9ddea3acb5bc755f1c4a878130a70c26297540bc0b7a57affb6b35c1f03d8dbd54ece8457531f8cba15bb74516779c01193e212050423020e45aa2c15dcb","seed_hash":"d432f499205150873b2572b5f033c9c6e4b7c6f3394bd2dd93822cd7085e7307"}}' -H 'Content-Type: application/json' - -{ - "id": "0", - "jsonrpc": "2.0", - "result": "d0402d6834e26fb94a9ce38c6424d27d2069896a9b8b1ce685d79936bca6e0a8" -} -``` - - -### **flush_cache** - -Flush bad transactions / blocks from the cache. - -Alias: _None_ . - -Inputs: - -- _bad_txs_ - boolean; Optional (`false` by default). -- _bad_blocks_ - boolean; Optional (`false` by default). - -Outputs: - -- _status_ - string; General RPC error code. "OK" means everything looks good. -- _untrusted_ - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (`true`), or when the daemon is fully synced and thus handles the RPC locally (`false`) - -Example: - -```Bash -$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"flush_cache","params":{"bad_txs":true,"bad_blocks":true}}' -H 'Content-Type: application/json' - -{ - "id": "0", - "jsonrpc": "2.0", - "result": { - "status": "OK", - "untrusted": false - } -} -``` - - -### **add_aux_pow** - -Easily enable merge mining with Monero without requiring software that manually alters the extra field in the coinbase tx to include the merkle root of the aux blocks. - -Alias: _None_ . - -Inputs: - -- _blocktemplate_blob_ - string; -- _aux_pow_ - array; - - _id_ - string; - - _hash_ - string; - -Outputs: - -- _blocktemplate_blob_ - string; -- _blockhashing_blob_ - string; -- _merkle_root_ - string; -- _merkle_tree_depth_ - unsigned int; -- _aux_pow_ - array; - - _id_ - string; - - _hash_ - string; - -Example: - -```Bash -$ curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"add_aux_pow","params":{"blocktemplate_blob":" ... ","aux_pow":[{"id":"3200b4ea97c3b2081cd4190b58e49572b2319fed00d030ad51809dff06b5d8c8","hash":"7b35762de164b20885e15dbe656b1138db06bb402fa1796f5765a23933d8859a"}]}}' -H 'Content-Type: application/json'' - -{ - "id": "0", - "jsonrpc": "2.0", - "result": { - "aux_pow": [{ - "hash": "7b35762de164b20885e15dbe656b1138db06bb402fa1796f5765a23933d8859a", - "id": "3200b4ea97c3b2081cd4190b58e49572b2319fed00d030ad51809dff06b5d8c8" - }], - "blockhashing_blob": "1010ee97e2a106e9f8ebe8887e5b609949ac8ea6143e560ed13552b110cb009b21f0cfca1eaccf00000000b2685c1283a646bc9020c758daa443be145b7370ce5a6efacb3e614117032e2c22", - "blocktemplate_blob": " ... ", - "merkle_root": "7b35762de164b20885e15dbe656b1138db06bb402fa1796f5765a23933d8859a", - "merkle_tree_depth": 0, - "status": "OK", - "untrusted": false - } -} -``` - - --- ## Other Daemon RPC Calls @@ -1725,11 +1754,11 @@ The data structure for these calls is different than the JSON RPC calls. Whereas IP=127.0.0.1 PORT=18081 METHOD='gettransactions' - PARAMS='{"txs_hashes":["d6e48158472848e6687173a91ae6eebfa3e1d778e65252ee99d7515d63090408"]}' - curl \ - http://$IP:$PORT/$METHOD \ - -d $PARAMS \ - -H 'Content-Type: application/json' + PARAMS='{"txs_hashes":["d6e48158472848e6687173a91ae6eebfa3e1d778e65252ee99d7515d63090408"]}' + curl \ + http://$IP:$PORT/$METHOD \ + -d $PARAMS \ + -H 'Content-Type: application/json' ``` Note: It is recommended to use JSON RPC where such alternatives exist, rather than the following methods. For example, the recommended way to get a node's height is via the JSON RPC methods [get_info](#get_info) or [get_last_block_header](#get_last_block_header), rather than [get_height](#get_height) below. @@ -1737,29 +1766,37 @@ Note: It is recommended to use JSON RPC where such alternatives exist, rather th 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_alt_blocks_hashes** -Get the node's current height. +Get the known blocks hashes which are not on the main chain. -Alias: _/getheight_ . +Alias: _None_ . -Inputs: _None_ . +Inputs: _None_ Outputs: -- _hash_ - string; The block's hash. -- _height_ - unsigned int; Current length of longest chain known to daemon. +- _blks_hashes_ - array of strings; list of alternative blocks hashes to main chain +- _credits_ - unsigned int; If payment for RPC is enabled, the number of credits available to the requesting client. Otherwise, 0. - _status_ - string; General RPC error code. "OK" means everything looks good. +- _top_hash_ - string; If payment for RPC is enabled, the hash of the highest block in the chain. Otherwise, empty. - _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 and thus handles the RPC locally (`false`) +Example: + ```Bash -$ curl http://127.0.0.1:18081/get_height -H 'Content-Type: application/json' +$ curl http://127.0.0.1:18081/get_alt_blocks_hashes -H 'Content-Type: application/json' { - "hash": "7e23a28cfa6df925d5b63940baf60b83c0cbb65da95f49b19e7cf0ce7dd709ce", - "height": 2287217, + "blks_hashes": ["dd4998cfe92a959a5a0e4ed72432cf23d7dfc4179cbea871ee2a705d71fb5e25","f36c3856ffde6a7d06fc832c80ede4ad5b6c8f702c9736dae1e2140d86504db9","8d0c1f806817259d213c8829ea3356334e0d8fdd3b118e1243756e12dce767bb"], + "credits": 0, "status": "OK", + "top_hash": "", + "untrusted": false + "untrusted": false + } "untrusted": false + } } ``` @@ -1797,6 +1834,7 @@ $ curl http://127.0.0.1:18081/get_blocks.bin -d '{"block_ids":["d109a406528a7b44 ``` ---> + ### **/get_blocks_by_height.bin** Get blocks by height. Binary request. @@ -1825,6 +1863,7 @@ curl http://127.0.0.1:18081/get_blocks_by_height.bin --data-binary '{"heights":[ ---> + ### **/get_hashes.bin** Get hashes. Binary request. @@ -1854,6 +1893,111 @@ $ curl http://127.0.0.1:18081/get_hashes.bin -d '{"block_ids":["d109a406528a7b44 ---> + +### **/get_height** + +Get the node's current height. + +Alias: _/getheight_ . + +Inputs: _None_ . + +Outputs: + +- _hash_ - string; The block's hash. +- _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 and thus handles the RPC locally (`false`) + +```Bash +$ curl http://127.0.0.1:18081/get_height -H 'Content-Type: application/json' + +{ + "hash": "7e23a28cfa6df925d5b63940baf60b83c0cbb65da95f49b19e7cf0ce7dd709ce", + "height": 2287217, + "status": "OK", + "untrusted": false +} +``` + + + + +### **/get_info (not JSON)** + +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 and thus handles the RPC locally (`false`) + +Example: + +```Bash +$ curl http://127.0.0.1:18081/get_limit -H 'Content-Type: application/json' + +{ + "limit_down": 8192, + "limit_up": 128, + "status": "OK", + "untrusted": false +} +``` + + + +### **/get_net_stats** + +Alias: _None_ . + +Inputs: _None_ . + +Outputs: + +- _start_time_ - unsigned int; Unix start time. +- _total_packets_in_ - unsigned int; +- _total_bytes_in_ - unsigned int; +- _total_packets_out_ - unsigned int; +- _total_bytes_out_ - 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 and thus handles the RPC locally (`false`). + +Example: + +```Bash +$ curl http://127.0.0.1:18081/get_net_stats -H 'Content-Type: application/json' + +{ + "start_time": 1665147355, + "status": "OK", + "total_bytes_in": 3743474809, + "total_bytes_out": 5932012405, + "total_packets_in": 2130592, + "total_packets_out": 1010674, + "untrusted": false +} +``` + + + ### **/get_o_indexes.bin** Get global outputs of transactions. Binary request. @@ -1880,6 +2024,67 @@ $ curl http://127.0.0.1:18081/get_o_indexes.bin --data-binary '{"txid":"d6e48158 ---> + +### **/get_output_distribution.bin** + +Get outputs. Binary request version of [get_output_distribution](#get_output_distribution). + +Alias: _None_ . + +Inputs: + +- _credits_ - unsigned int; If payment for RPC is enabled, the number of credits available to the requesting client. Otherwise, 0. +- _top_hash_ - string; If payment for RPC is enabled, the hash of the highest block in the chain. Otherwise, empty. +- _amounts_ - array of unsigned int; amounts to look for +- _cumulative_ - boolean; (optional, default is `false`) States if the result should be cumulative (`true`) or not (`false`) +- _from_height_ - unsigned int; (optional, default is 0) starting height to check from +- _to_height_ - unsigned int; (optional, default is 0) ending height to check up to +- _binary_ - boolean; (optional, default is `true`); Must be `true`. +- _compress_ - unsigned int; (optional, default is `false`) Respond with compressed data. + +Outputs: + +- _credits_ - unsigned int; If payment for RPC is enabled, the number of credits available to the requesting client. Otherwise, 0. +- _distributions_ - array of structure distribution as follows: + - _amount_ - unsigned int + - _base_ - unsigned int + - _binary_ - boolean; Always `true`. + - _compress_ - unsigned int; `true` if compressed data, `false` otherwise. + - _distribution_ - array of unsigned int; This field exists instead of _compressed_data_ if the _compress_ option was not used. + - _compressed_data_ - array of unsigned int; This field exists instead of _distribution_ if the _compress_ option was used. + - _start_height_ - unsigned int +- _status_ - string; General RPC error code. "OK" means everything looks good. +- _top_hash_ - string; If payment for RPC is enabled, the hash of the highest block in the chain. Otherwise, empty. +- _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 and thus handles the RPC locally (`false`) + + + +### **/get_outs** + +Get outputs. + +Alias: _None_ . + +Inputs: + +- _outputs_ array of _get_outputs_out_ structure as follows: + - _amount_ - unsigned int; + - _index_ - unsigned int; +- _get_txid_ - boolean; If `true`, a _txid_ will included for each output in the response. + +Outputs: + +- _outs_ - array of structure _outkey_ as follows: + - _height_ - unsigned int; block height of the output + - _key_ - String; the public key of the output + - _mask_ - String + - _txid_ - String; transaction id + - _unlocked_ - boolean; States if output is locked (`false`) or not (`true`) +- _status_ - string; General RPC error code. "OK" means everything looks good. +- _untrusted_ - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (`true`), or when the daemon is fully synced and thus handles the RPC locally (`false`) + + + ### **/get_outs.bin** Get outputs. Binary request. @@ -1914,38 +2119,357 @@ $ curl http://127.0.0.1:18081/get_o_indexes.bin --data-binary '{"txid":"d6e48158 ---> -### **/get_output_distribution.bin** -Get outputs. Binary request version of [get_output_distribution](#get_output_distribution). +### **/get_peer_list** + +Get the known peers list. + +Alias: _None_ . + +Inputs: _None_ . + +Outputs: + +- _gray_list_ - array of offline _peer_ structure as follows: + - _host_ - unsigned int; IP address in integer format + - _id_ - string; Peer id + - _ip_ - unsigned int; IP address in integer format + - _last_seen_ - unsigned int; unix time at which the peer has been seen for the last time + - _port_ - unsigned int; TCP port the peer is using to connect to monero network. +- _status_ - string; General RPC error code. "OK" means everything looks good. Any other value means that something went wrong. +- _white_list_ - array of online _peer_ structure, as above. + +Example (truncated lists): + +```Bash +$ curl http://127.0.0.1:18081/get_peer_list -H 'Content-Type: application/json' + +{ + "gray_list": [{ + "host": "640304833", + "id": 5345237316225602120, + "ip": 640304833, + "last_seen": 1525540510, + "port": 18080 + },{ + "host": "2183731038", + "id": 14955030573998424430, + "ip": 2183731038, + "last_seen": 1525540499, + "port": 28080 + }, ... + ], + "status": "OK", + "white_list": [{ + "host": "1221637955", + "id": 10354694710033118926, + "ip": 1221637955, + "last_seen": 1525540511, + "port": 18080 + },{ + "host": "1780407354", + "id": 17193661050352240890, + "ip": 1780407354, + "last_seen": 1525540510, + "port": 18080 + }, ... + ] +} +``` + + + +### **/get_public_nodes** + +Get public peer information. Alias: _None_ . Inputs: -- _credits_ - unsigned int; If payment for RPC is enabled, the number of credits available to the requesting client. Otherwise, 0. -- _top_hash_ - string; If payment for RPC is enabled, the hash of the highest block in the chain. Otherwise, empty. -- _amounts_ - array of unsigned int; amounts to look for -- _cumulative_ - boolean; (optional, default is `false`) States if the result should be cumulative (`true`) or not (`false`) -- _from_height_ - unsigned int; (optional, default is 0) starting height to check from -- _to_height_ - unsigned int; (optional, default is 0) ending height to check up to -- _binary_ - boolean; (optional, default is `true`); Must be `true`. -- _compress_ - unsigned int; (optional, default is `false`) Respond with compressed data. +- _gray_ - boolean; (Optional; defaults to `false`) Include gray peers. +- _white_ - boolean; (Optional; defaults to `true`) Include white peers. +- _include_blocked_ - boolean; (Optional; defaults to `false`) Include blocked peers. + +Outputs: + +- _status_ - string; General RPC error code. "OK" means everything looks good. +- _whites_ - array of `public_node` structures defined as follows: + - _host_ - string; The node's IP address. This includes IPv4, IPv6, Onion, and i2p addresses. + - _last_seen_ - unsigned int; UNIX timestamp of the last time the node was seen. + - _rpc_credits_per_hash_ - unsigned int; If payment for RPC is enabled, the number of credits the node is requesting per hash. Otherwise, 0. + - _rpc_port_ - unsigned int; RPC port number of the node. +- _gray_ - array of `public_node` structures; This is an array structures containing node information on gray peers. See _white_ above. +- _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 and thus handles the RPC locally (`false`) + +Example: + +```Bash +$ curl http://127.0.0.1:18081/get_public_nodes -d '{"gray":true}' -H 'Content-Type: application/json' + +{ + "gray": [{ + "host": "142.93.132.1", + "last_seen": 0, + "rpc_credits_per_hash": 0, + "rpc_port": 18089 + },{ + "host": "193.142.4.2", + "last_seen": 0, + "rpc_credits_per_hash": 0, + "rpc_port": 19084 + }], + "status": "OK", + "untrusted": false, + "white": [{ + "host": "70.52.75.3", + "last_seen": 1722812577, + "rpc_credits_per_hash": 0, + "rpc_port": 18081 + },{ + "host": "::ffff:207.180.221.220", + "last_seen": 1722872337, + "rpc_credits_per_hash": 0, + "rpc_port": 18089 + },{ + "host": "zbjkbsxc5munw3qusl7j2hpcmikhqocdf4pqhnhtpzw5nt5jrmofptid.onion:18083", + "last_seen": 1720186288, + "rpc_credits_per_hash": 0, + "rpc_port": 18089 + }] +} +``` +### **/get_transaction_pool** + +Show information about valid transactions seen by the node but not yet mined into a block, as well as spent key image information for the txpool in the node's memory. + +Alias: _None_ . + +Inputs: _None_ . Outputs: - _credits_ - unsigned int; If payment for RPC is enabled, the number of credits available to the requesting client. Otherwise, 0. -- _distributions_ - array of structure distribution as follows: - - _amount_ - unsigned int - - _base_ - unsigned int - - _binary_ - boolean; Always `true`. - - _compress_ - unsigned int; `true` if compressed data, `false` otherwise. - - _distribution_ - array of unsigned int; This field exists instead of _compressed_data_ if the _compress_ option was not used. - - _compressed_data_ - array of unsigned int; This field exists instead of _distribution_ if the _compress_ option was used. - - _start_height_ - unsigned int +- _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. + - _do_not_relay_ ; boolean; States if this transaction should not be relayed + - _double_spend_seen_ - boolean; States if this transaction has been seen as double spend. + - _fee_ - unsigned int; The amount of the mining fee included in the transaction, in [atomic-units](https://www.getmonero.org/resources/moneropedia/atomic-units.html "Atomic Units refer to the smallest fraction of 1 XMR."). + - _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 occurred. + - _last_failed_id_hash_ - string; Like the previous, this tells the previous transaction ID hash. + - _last_relayed_time_ - unsigned int; Last unix time at which the transaction has been relayed. + - _max_used_block_height_ - unsigned int; Tells the height of the most recent block with an output used in this transaction. + - _max_used_block_id_hash_ - string; Tells the hash of the most recent block with an output used in this transaction. + - _receive_time_ - unsigned int; The Unix time that the transaction was first seen on the network by the node. + - _relayed_ - boolean; States if this transaction has been relayed + - _tx_blob_ - unsigned int; Hexadecimal blob representing 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](https://www.getmonero.org/resources/moneropedia/atomic-units.html "Atomic Units refer to the smallest fraction of 1 XMR."). + - _key_offsets_ - A list of integer offsets to the input. + - _k_image_ - The key image for the given input + - _vout_ - List of outputs from transaction: + - _amount_ - Amount of transaction output (if coinbase output, otherwise 0), in [atomic-units](https://www.getmonero.org/resources/moneropedia/atomic-units.html "Atomic Units refer to the smallest fraction of 1 XMR."). + - _target_ - Output destination information: + - _tagged_key_ + - _key_ - The stealth public key of the receiver. Whoever owns the private key associated with this key controls this transaction output. + - _view_tag_ - The 1st byte of a shared secret (used for reducing synchronization time). + - _extra_ - Usually called the "transaction ID" but can be used to include any random 32 bytes. + - _rct_signatures_ - List of signatures used in ring signature to hide the true origin of the transaction. + - _ecdhInfo_ - array of Diffie Helman Elipctic curves structures as follows: + - _mask_ - String; + - _amount_ - String; + - _outPk_ - List + - _txnFee_ - + - _type_ - + - _rctsig_prunable_ - + - _CLSAGs_ - List + - _D_ - + - _c1_ - + - _s_ - List + - _bpp_ - List + - _A_ - + - _A1_ - + - _B_ - + - _L_ - List + - _R_ - List + - _d1_ - + - _r1_ - + - _s1_ - + - _npb_ - + - _pseudoOuts_ - + - _weight_ - + +Example (Note: Some lists in the returned information have been truncated for display reasons): + +```Bash +$ curl http://127.0.0.1:18081/get_transaction_pool -H 'Content-Type: application/json' + +{ + "spent_key_images": [{ + "id_hash": "5b5d68e7eb5ddfc7dd30d9a91f1db6835563b0214b66dc0b791909fb46c9cbb4", + "txs_hashes": ["0b1839626bd7a609d5b16966396a51eb5fda9c55b9b2fc314a916459a7532e02"] + },{ + "id_hash": "b583a134ccd6fd48697f02f530e82604f746b97ce26de103fa756d91274ac60e", + "txs_hashes": ["0b1839626bd7a609d5b16966396a51eb5fda9c55b9b2fc314a916459a7532e02"] + }, + ...], + "status": "OK", + "transactions": [{ + "blob_size": 2217, + "do_not_relay": false, + "double_spend_seen": false, + "fee": 44340000, + "id_hash": "0b1839626bd7a609d5b16966396a51eb5fda9c55b9b2fc314a916459a7532e02", + "kept_by_block": false, + "last_failed_height": 0, + "last_failed_id_hash": "0000000000000000000000000000000000000000000000000000000000000000", + "last_relayed_time": 1667929927, + "max_used_block_height": 2751399, + "max_used_block_id_hash": "52d2ac5230146c4d8003c8fb1d8e54aea91d2536c72884bd6e126b7def4ed9c6", + "receive_time": 1667929927, + "relayed": true, + "tx_blob": " ... ", + "tx_json": "{\n \"version\": 2, \n \"unlock_time\": 0, \n \"vin\": [ {\n \"key\": {\n \"amount\": 0, \n \"key_offsets\": [ 54937085, 875767, 6217742, 360564, 431709, 807289, 138472, 6221, 111408, 42881, 145, 12396, 20911, 899, 3546, 112\n ], \n \"k_image\": \"b583a134ccd6fd48697f02f530e82604f746b97ce26de103fa756d91274ac60e\"\n }\n }, {\n \"key\": {\n \"amount\": 0, \n \"key_offsets\": [ 28132301, 33525919, 17414, 2042026, 73478, 73012, 54330, 8150, 5725, 10740, 4581, 7687, 9290, 592, 994, 725\n ], \n \"k_image\": \"5b5d68e7eb5ddfc7dd30d9a91f1db6835563b0214b66dc0b791909fb46c9cbb4\"\n }\n }\n ], \n \"vout\": [ {\n \"amount\": 0, \n \"target\": {\n \"tagged_key\": {\n \"key\": \"2849325ea3410c1378ab631c4e008028a99843a767c1d11019631cad8e083b53\", \n \"view_tag\": \"1f\"\n }\n }\n }, {\n \"amount\": 0, \n \"target\": {\n \"tagged_key\": {\n \"key\": \"9677c3568218bab3dc1a6eee5b486eeb372c9b2c7d552d8f9c6c84bd4051bab8\", \n \"view_tag\": \"ee\"\n }\n }\n }\n ], \n \"extra\": [ 1, 110, 21, 19, 40, 178, 62, 51, 216, 134, 71, 171, 159, 249, 160, 206, 100, 247, 190, 162, 177, 0, 35, 237, 165, 157, 42, 84, 52, 25, 151, 202, 231, 2, 9, 1, 195, 62, 127, 79, 4, 67, 161, 64\n ], \n ... }\n}", + "weight": 2217 + }, + ...] +} +``` + + + +### **/get_transaction_pool_hashes** + +Get hashes from transaction pool. + +Alias: _None_ . + +Inputs: _None_ . + +Outputs: + +- _credits_ - unsigned int; If payment for RPC is enabled, the number of credits available to the requesting client. Otherwise, 0. +- _status_ - string; General RPC error code. "OK" means everything looks good. +- _top_hash_ - string; If payment for RPC is enabled, the hash of the highest block in the chain. Otherwise, empty. +- _tx_hashes_ - array of strings; This is an array of transaction hashes in hexadecimal string form. +- _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 and thus handles the RPC locally (`false`) + +Example: + +```Bash +$ curl http://127.0.0.1:18081/get_transaction_pool_hashes -H 'Content-Type: application/json' + +{ + "credits": 0, + "status": "OK", + "top_hash": "", + "tx_hashes": ["e27bb84f1cf1f47a79578d3bb1f47a81745a4c5a5551622b4e924eb0b83f960d","b9f76e686f389e126ada5caf47034c57adeef671d8b899cba1ead606c868f819"], + "untrusted": false +} +``` + + + +### **/get_transaction_pool_hashes.bin** + +Get hashes from transaction pool. Binary request. + +Alias: _None_ . + +Inputs: _None_ . + +Outputs: + +- _status_ - string; General RPC error code. "OK" means everything looks good. +- _tx_hashes_ - binary array of transaction hashes. +- _untrusted_ - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (`true`), or when the daemon is fully synced and thus handles the RPC locally (`false`) + +Example: + +```Bash +$ curl http://127.0.0.1:18081/get_transaction_pool_hashes.bin -H 'Content-Type: application/json' + +{ + "status": "OK", + "tx_hashes": " ... ", + "untrusted": false +} +``` + + + +### **/get_transaction_pool_stats** + +Get the transaction pool statistics. + +Alias: _None_ . + +Inputs: _None_ . + +Outputs: + +- _credits_ - unsigned int; If payment for RPC is enabled, the number of credits available to the requesting client. Otherwise, 0. +- _pool_stats_ - Structure as follows: + - _bytes_max_ - unsigned int; Max transaction size in pool + - _bytes_med_ - unsigned int; Median transaction size in pool + - _bytes_min_ - unsigned int; Min transaction size in pool + - _bytes_total_ - unsigned int; total size of all transactions in pool + - _fee_total_ - unsigned int; The sum of the fees for all transactions currently in the transaction pool [atomic-units](https://www.getmonero.org/resources/moneropedia/atomic-units.html "Atomic Units refer to the smallest fraction of 1 XMR."). + - _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. - _top_hash_ - string; If payment for RPC is enabled, the hash of the highest block in the chain. Otherwise, empty. - _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 and thus handles the RPC locally (`false`) +Example: + +```Bash +$ curl http://127.0.0.1:18081/get_transaction_pool_stats -H 'Content-Type: application/json' + +{ + "credits": 0, + "pool_stats": { + "bytes_max": 14325, + "bytes_med": 1460, + "bytes_min": 1450, + "bytes_total": 410674, + "fee_total": 18198895000, + "histo": [{ ... + }], + "histo_98pc": 297, + "num_10m": 1, + "num_double_spends": 1, + "num_failing": 0, + "num_not_relayed": 0, + "oldest": 1612232218, + "txs_total": 124 + }, + "status": "OK", + "top_hash": "", + "untrusted": false + +} +``` + + ### **/get_transactions** @@ -2089,37 +2613,37 @@ $ curl http://127.0.0.1:18081/get_transactions -d '{"txs_hashes":["d6e4815847284 ``` -### **/get_alt_blocks_hashes** -Get the known blocks hashes which are not on the main chain. +### **/in_peers** + +Limit number of Incoming peers. Alias: _None_ . -Inputs: _None_ +Inputs: + +- _in_peers_ - unsigned int; Max number of incoming peers Outputs: -- _blks_hashes_ - array of strings; list of alternative blocks hashes to main chain -- _credits_ - unsigned int; If payment for RPC is enabled, the number of credits available to the requesting client. Otherwise, 0. +- _in_peers_ - unsigned int; Max number of incoming peers - _status_ - string; General RPC error code. "OK" means everything looks good. -- _top_hash_ - string; If payment for RPC is enabled, the hash of the highest block in the chain. Otherwise, empty. - _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 and thus handles the RPC locally (`false`) Example: ```Bash -$ curl http://127.0.0.1:18081/get_alt_blocks_hashes -H 'Content-Type: application/json' +$ curl http://127.0.0.1:18081/in_peers -d '{"in_peers": 3232235535}' -H 'Content-Type: application/json' { - "blks_hashes": ["dd4998cfe92a959a5a0e4ed72432cf23d7dfc4179cbea871ee2a705d71fb5e25","f36c3856ffde6a7d06fc832c80ede4ad5b6c8f702c9736dae1e2140d86504db9","8d0c1f806817259d213c8829ea3356334e0d8fdd3b118e1243756e12dce767bb"], - "credits": 0, + "in_peers": 3232235535, "status": "OK", - "top_hash": "", "untrusted": false } ``` + ### **/is_key_image_spent** Check if outputs have been spent using the key image associated with the output. @@ -2153,95 +2677,6 @@ $ curl http://127.0.0.1:18081/is_key_image_spent -d '{"key_images":["8d1bd8181bf ``` -### **/send_raw_transaction** - -Broadcast a raw transaction to the network. - -Alias: _/sendrawtransaction_ . - -Inputs: - -- _tx_as_hex_ - string; Full transaction information as hexadecimal 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 and thus handles the RPC locally (`false`) - - -Example (No return information included here.): - - -```Bash -$ curl http://127.0.0.1:18081/send_raw_transaction -d '{"tx_as_hex":"de6a3...", "do_not_relay":false}' -H 'Content-Type: application/json' -``` - - -### **/start_mining** - -Start mining on the daemon. - -Alias: _None_ . - -Inputs: - -- _do_background_mining_ - boolean; States if the mining should run in background (`true`) or foreground (`false`). -- _ignore_battery_ - boolean; States if battery state (on laptop) should be ignored (`true`) or not (`false`). -- _miner_address_ - string; Account address to mine to. -- _threads_count_ - unsigned int; Number of mining thread to run. - -Outputs: - -- _status_ - string; General RPC error code. "OK" means everything looks good. Any other value means that something went wrong. -- _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 and thus handles the RPC locally (`false`) - -Example: - -```Bash -$ curl http://127.0.0.1:18081/start_mining -d '{"do_background_mining":false,"ignore_battery":true,"miner_address":"47xu3gQpF569au9C2ajo5SSMrWji6xnoE5vhr94EzFRaKAGw6hEGFXYAwVADKuRpzsjiU1PtmaVgcjUJF89ghGPhUXkndHc","threads_count":1}' -H 'Content-Type: application/json' - -{ - "status": "OK", - "untrusted": false -} -``` - - -### **/stop_mining** - -Stop mining on the daemon. - -Alias: _None_ . - -Inputs: _None_ . - -Outputs: - -- _status_ - string; General RPC error code. "OK" means everything looks good. Any other value means that something went wrong. -- _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 and thus handles the RPC locally (`false`) - -Example: - -```Bash -$ curl http://127.0.0.1:18081/stop_mining -H 'Content-Type: application/json' - -{ - "status": "OK", - "untrusted": false -} -``` - ### **/mining_status** @@ -2324,6 +2759,65 @@ $ curl http://127.0.0.1:18081/mining_status -H 'Content-Type: application/json' ``` + +### **/out_peers** + +Limit number of Outgoing peers. + +Alias: _None_ . + +Inputs: + +- _out_peers_ - unsigned int; Max number of outgoing peers + +Outputs: + +- _out_peers_ - unsigned int; Max number of outgoing peers +- _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 and thus handles the RPC locally (`false`) + +Example: + +```Bash +$ curl http://127.0.0.1:18081/out_peers -d '{"out_peers": 3232235535}' -H 'Content-Type: application/json' + +{ + "out_peers": 3232235535, + "status": "OK", + "untrusted": false +} +``` + + + +### **/pop_blocks** + +Alias: _None_ . + +Inputs: + +- _nblocks_ - unsigned int; + +Outputs: + +- _height_ - unsigned int; New blockheight after popping blocks +- _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 and thus handles the RPC locally (`false`) + +Example: + +```Bash +$ curl http://127.0.0.1:18081/pop_blocks -d '{"nblocks":6}' -H 'Content-Type: application/json'' + +{ + "height": 76482, + "status": "OK", + "untrusted": false +} +``` + + + ### **/save_bc** Save the blockchain. The blockchain does not need saving and is always saved when modified, however it does a sync to flush the filesystem cache onto the disk for safety purposes against Operating System or Hardware crashes. @@ -2349,129 +2843,107 @@ $ curl http://127.0.0.1:18081/save_bc -H 'Content-Type: application/json' ``` -### **/get_peer_list** -Get the known peers list. +### **/send_raw_transaction** -Alias: _None_ . +Broadcast a raw transaction to the network. -Inputs: _None_ . +Alias: _/sendrawtransaction_ . + +Inputs: + +- _tx_as_hex_ - string; Full transaction information as hexadecimal string. +- _do_not_relay_ - boolean; Stop relaying transaction to other nodes (default is `false`). Outputs: -- _gray_list_ - array of offline _peer_ structure as follows: - - _host_ - unsigned int; IP address in integer format - - _id_ - string; Peer id - - _ip_ - unsigned int; IP address in integer format - - _last_seen_ - unsigned int; unix time at which the peer has been seen for the last time - - _port_ - unsigned int; TCP port the peer is using to connect to monero network. +- _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. -- _white_list_ - array of online _peer_ structure, as above. +- _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 and thus handles the RPC locally (`false`) + + +Example (No return information included here.): -Example (truncated lists): ```Bash -$ curl http://127.0.0.1:18081/get_peer_list -H 'Content-Type: application/json' - -{ - "gray_list": [{ - "host": "640304833", - "id": 5345237316225602120, - "ip": 640304833, - "last_seen": 1525540510, - "port": 18080 - },{ - "host": "2183731038", - "id": 14955030573998424430, - "ip": 2183731038, - "last_seen": 1525540499, - "port": 28080 - }, ... - ], - "status": "OK", - "white_list": [{ - "host": "1221637955", - "id": 10354694710033118926, - "ip": 1221637955, - "last_seen": 1525540511, - "port": 18080 - },{ - "host": "1780407354", - "id": 17193661050352240890, - "ip": 1780407354, - "last_seen": 1525540510, - "port": 18080 - }, ... - ] -} +$ curl http://127.0.0.1:18081/send_raw_transaction -d '{"tx_as_hex":"de6a3...", "do_not_relay":false}' -H 'Content-Type: application/json' ``` -### **/set_log_hash_rate** -Set the log hash rate display mode. +### **/set_bootstrap_daemon** + +Give immediate usability to wallets while syncing by proxying RPC requests. Alias: _None_ . Inputs: -- _visible_ - boolean; States if hash rate logs should be visible (`true`) or hidden (`false`) +- _address_ - string; host:port +- _username_ - string; +- _password_ - string; +- _proxy_ - string; Outputs: -- _status_ - string; General RPC error code. "OK" means everything looks good. Any other value means that something went wrong. -- _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 and thus handles the RPC locally (`false`) +- _status_ - string; General RPC error code. "OK" means everything looks good. -Example while mining: +Example: + +Once set, the address will appear in `get_info` as `bootstrap_daemon_address` ```Bash -$ curl http://127.0.0.1:18081/set_log_hash_rate -d '{"visible":true}' -H 'Content-Type: application/json' +$ curl http://127.0.0.1:18081/set_bootstrap_daemon -d '{"address": "http://getmonero.org:18081"}' -H 'Content-Type: application/json' { "status": "OK" - "untrusted": false -} -``` - -Error while not mining: - -```Bash -$ curl http://127.0.0.1:18081/set_log_hash_rate -d '{"visible":true}' -H 'Content-Type: application/json' - -{ - "status": "NOT MINING", - "untrusted": false } ``` -### **/set_log_level** -Set the daemon log level. -By default, log level is set to `0`. +### **/set_limit** + +Set daemon bandwidth limits. Alias: _None_ . Inputs: -- _level_ - integer; daemon log level to set from `0` (less verbose) to `4` (most verbose) +- _limit_down_ - signed int; Download limit in kBytes per second (-1 reset to default, 0 don't change the current limit) +- _limit_up_ - signed int; Upload limit in kBytes per second (-1 reset to default, 0 don't change the current limit) Outputs: -- _status_ - string; General RPC error code. "OK" means everything looks good. Any other value means that something went wrong. +- _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 and thus handles the RPC locally (`false`) Example: ```Bash -$ curl http://127.0.0.1:18081/set_log_level -d '{"level":1}' -H 'Content-Type: application/json' +$ curl http://127.0.0.1:18081/set_limit -d '{"limit_down": 1024}' -H 'Content-Type: application/json' { + "limit_down": 1024, + "limit_up": 128, "status": "OK" "untrusted": false } ``` + + ### **/set_log_categories** Set the daemon log categories. @@ -2566,417 +3038,104 @@ $ curl http://127.0.0.1:18081/set_log_categories -H 'Content-Type: application/j ``` -### **/set_bootstrap_daemon** -Give immediate usability to wallets while syncing by proxying RPC requests. +### **/set_log_hash_rate** + +Set the log hash rate display mode. Alias: _None_ . Inputs: -- _address_ - string; host:port -- _username_ - string; -- _password_ - string; -- _proxy_ - string; +- _visible_ - boolean; States if hash rate logs should be visible (`true`) or hidden (`false`) Outputs: -- _status_ - string; General RPC error code. "OK" means everything looks good. +- _status_ - string; General RPC error code. "OK" means everything looks good. Any other value means that something went wrong. +- _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 and thus handles the RPC locally (`false`) -Example: - -Once set, the address will appear in `get_info` as `bootstrap_daemon_address` +Example while mining: ```Bash -$ curl http://127.0.0.1:18081/set_bootstrap_daemon -d '{"address": "http://getmonero.org:18081"}' -H 'Content-Type: application/json' +$ curl http://127.0.0.1:18081/set_log_hash_rate -d '{"visible":true}' -H 'Content-Type: application/json' { "status": "OK" + "untrusted": false } ``` - -### **/get_transaction_pool** - -Show information about valid transactions seen by the node but not yet mined into a block, as well as spent key image information for the txpool in the node's memory. - -Alias: _None_ . - -Inputs: _None_ . - -Outputs: - -- _credits_ - unsigned int; If payment for RPC is enabled, the number of credits available to the requesting client. Otherwise, 0. -- _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. - - _do_not_relay_ ; boolean; States if this transaction should not be relayed - - _double_spend_seen_ - boolean; States if this transaction has been seen as double spend. - - _fee_ - unsigned int; The amount of the mining fee included in the transaction, in [atomic-units](https://www.getmonero.org/resources/moneropedia/atomic-units.html "Atomic Units refer to the smallest fraction of 1 XMR."). - - _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 occurred. - - _last_failed_id_hash_ - string; Like the previous, this tells the previous transaction ID hash. - - _last_relayed_time_ - unsigned int; Last unix time at which the transaction has been relayed. - - _max_used_block_height_ - unsigned int; Tells the height of the most recent block with an output used in this transaction. - - _max_used_block_id_hash_ - string; Tells the hash of the most recent block with an output used in this transaction. - - _receive_time_ - unsigned int; The Unix time that the transaction was first seen on the network by the node. - - _relayed_ - boolean; States if this transaction has been relayed - - _tx_blob_ - unsigned int; Hexadecimal blob representing 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](https://www.getmonero.org/resources/moneropedia/atomic-units.html "Atomic Units refer to the smallest fraction of 1 XMR."). - - _key_offsets_ - A list of integer offsets to the input. - - _k_image_ - The key image for the given input - - _vout_ - List of outputs from transaction: - - _amount_ - Amount of transaction output (if coinbase output, otherwise 0), in [atomic-units](https://www.getmonero.org/resources/moneropedia/atomic-units.html "Atomic Units refer to the smallest fraction of 1 XMR."). - - _target_ - Output destination information: - - _tagged_key_ - - _key_ - The stealth public key of the receiver. Whoever owns the private key associated with this key controls this transaction output. - - _view_tag_ - The 1st byte of a shared secret (used for reducing synchronization time). - - _extra_ - Usually called the "transaction ID" but can be used to include any random 32 bytes. - - _rct_signatures_ - List of signatures used in ring signature to hide the true origin of the transaction. - - _ecdhInfo_ - array of Diffie Helman Elipctic curves structures as follows: - - _mask_ - String; - - _amount_ - String; - - _outPk_ - List - - _txnFee_ - - - _type_ - - - _rctsig_prunable_ - - - _CLSAGs_ - List - - _D_ - - - _c1_ - - - _s_ - List - - _bpp_ - List - - _A_ - - - _A1_ - - - _B_ - - - _L_ - List - - _R_ - List - - _d1_ - - - _r1_ - - - _s1_ - - - _npb_ - - - _pseudoOuts_ - - - _weight_ - - -Example (Note: Some lists in the returned information have been truncated for display reasons): +Error while not mining: ```Bash -$ curl http://127.0.0.1:18081/get_transaction_pool -H 'Content-Type: application/json' +$ curl http://127.0.0.1:18081/set_log_hash_rate -d '{"visible":true}' -H 'Content-Type: application/json' { - "spent_key_images": [{ - "id_hash": "5b5d68e7eb5ddfc7dd30d9a91f1db6835563b0214b66dc0b791909fb46c9cbb4", - "txs_hashes": ["0b1839626bd7a609d5b16966396a51eb5fda9c55b9b2fc314a916459a7532e02"] - },{ - "id_hash": "b583a134ccd6fd48697f02f530e82604f746b97ce26de103fa756d91274ac60e", - "txs_hashes": ["0b1839626bd7a609d5b16966396a51eb5fda9c55b9b2fc314a916459a7532e02"] - }, - ...], - "status": "OK", - "transactions": [{ - "blob_size": 2217, - "do_not_relay": false, - "double_spend_seen": false, - "fee": 44340000, - "id_hash": "0b1839626bd7a609d5b16966396a51eb5fda9c55b9b2fc314a916459a7532e02", - "kept_by_block": false, - "last_failed_height": 0, - "last_failed_id_hash": "0000000000000000000000000000000000000000000000000000000000000000", - "last_relayed_time": 1667929927, - "max_used_block_height": 2751399, - "max_used_block_id_hash": "52d2ac5230146c4d8003c8fb1d8e54aea91d2536c72884bd6e126b7def4ed9c6", - "receive_time": 1667929927, - "relayed": true, - "tx_blob": " ... ", - "tx_json": "{\n \"version\": 2, \n \"unlock_time\": 0, \n \"vin\": [ {\n \"key\": {\n \"amount\": 0, \n \"key_offsets\": [ 54937085, 875767, 6217742, 360564, 431709, 807289, 138472, 6221, 111408, 42881, 145, 12396, 20911, 899, 3546, 112\n ], \n \"k_image\": \"b583a134ccd6fd48697f02f530e82604f746b97ce26de103fa756d91274ac60e\"\n }\n }, {\n \"key\": {\n \"amount\": 0, \n \"key_offsets\": [ 28132301, 33525919, 17414, 2042026, 73478, 73012, 54330, 8150, 5725, 10740, 4581, 7687, 9290, 592, 994, 725\n ], \n \"k_image\": \"5b5d68e7eb5ddfc7dd30d9a91f1db6835563b0214b66dc0b791909fb46c9cbb4\"\n }\n }\n ], \n \"vout\": [ {\n \"amount\": 0, \n \"target\": {\n \"tagged_key\": {\n \"key\": \"2849325ea3410c1378ab631c4e008028a99843a767c1d11019631cad8e083b53\", \n \"view_tag\": \"1f\"\n }\n }\n }, {\n \"amount\": 0, \n \"target\": {\n \"tagged_key\": {\n \"key\": \"9677c3568218bab3dc1a6eee5b486eeb372c9b2c7d552d8f9c6c84bd4051bab8\", \n \"view_tag\": \"ee\"\n }\n }\n }\n ], \n \"extra\": [ 1, 110, 21, 19, 40, 178, 62, 51, 216, 134, 71, 171, 159, 249, 160, 206, 100, 247, 190, 162, 177, 0, 35, 237, 165, 157, 42, 84, 52, 25, 151, 202, 231, 2, 9, 1, 195, 62, 127, 79, 4, 67, 161, 64\n ], \n ... }\n}", - "weight": 2217 - }, - ...] -} -``` - - -### **/get_transaction_pool_hashes.bin** - -Get hashes from transaction pool. Binary request. - -Alias: _None_ . - -Inputs: _None_ . - -Outputs: - -- _status_ - string; General RPC error code. "OK" means everything looks good. -- _tx_hashes_ - binary array of transaction hashes. -- _untrusted_ - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (`true`), or when the daemon is fully synced and thus handles the RPC locally (`false`) - -Example: - -```Bash -$ curl http://127.0.0.1:18081/get_transaction_pool_hashes.bin -H 'Content-Type: application/json' - -{ - "status": "OK", - "tx_hashes": " ... ", + "status": "NOT MINING", "untrusted": false } ``` -### **/get_transaction_pool_stats** -Get the transaction pool statistics. +### **/set_log_level** -Alias: _None_ . - -Inputs: _None_ . - -Outputs: - -- _credits_ - unsigned int; If payment for RPC is enabled, the number of credits available to the requesting client. Otherwise, 0. -- _pool_stats_ - Structure as follows: - - _bytes_max_ - unsigned int; Max transaction size in pool - - _bytes_med_ - unsigned int; Median transaction size in pool - - _bytes_min_ - unsigned int; Min transaction size in pool - - _bytes_total_ - unsigned int; total size of all transactions in pool - - _fee_total_ - unsigned int; The sum of the fees for all transactions currently in the transaction pool [atomic-units](https://www.getmonero.org/resources/moneropedia/atomic-units.html "Atomic Units refer to the smallest fraction of 1 XMR."). - - _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. -- _top_hash_ - string; If payment for RPC is enabled, the hash of the highest block in the chain. Otherwise, empty. -- _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 and thus handles the RPC locally (`false`) - -Example: - -```Bash -$ curl http://127.0.0.1:18081/get_transaction_pool_stats -H 'Content-Type: application/json' - -{ - "credits": 0, - "pool_stats": { - "bytes_max": 14325, - "bytes_med": 1460, - "bytes_min": 1450, - "bytes_total": 410674, - "fee_total": 18198895000, - "histo": [{ ... - }], - "histo_98pc": 297, - "num_10m": 1, - "num_double_spends": 1, - "num_failing": 0, - "num_not_relayed": 0, - "oldest": 1612232218, - "txs_total": 124 - }, - "status": "OK", - "top_hash": "", - "untrusted": false - -} -``` - - -### **/stop_daemon** - -Send a command to the daemon to safely disconnect and shut down. - -Alias: _None_ . - -Inputs: _None_ . - -Outputs: - -- _status_ - string; General RPC error code. "OK" means everything looks good. - -Example: - -```Bash -$ curl http://127.0.0.1:18081/stop_daemon -H 'Content-Type: application/json' - -{ - "status": "OK" -} -``` - - -### **/get_info (not JSON)** - -This method is a convenient backward support and should not be used anymore. See [get_info](#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 and thus handles the RPC locally (`false`) - -Example: - -```Bash -$ curl http://127.0.0.1:18081/get_limit -H 'Content-Type: application/json' - -{ - "limit_down": 8192, - "limit_up": 128, - "status": "OK", - "untrusted": false -} -``` - - -### **/set_limit** - -Set daemon bandwidth limits. +Set the daemon log level. +By default, log level is set to `0`. Alias: _None_ . Inputs: -- _limit_down_ - signed int; Download limit in kBytes per second (-1 reset to default, 0 don't change the current limit) -- _limit_up_ - signed int; Upload limit in kBytes per second (-1 reset to default, 0 don't change the current limit) +- _level_ - integer; daemon log level to set from `0` (less verbose) to `4` (most verbose) 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. +- _status_ - string; General RPC error code. "OK" means everything looks good. Any other value means that something went wrong. - _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 and thus handles the RPC locally (`false`) Example: ```Bash -$ curl http://127.0.0.1:18081/set_limit -d '{"limit_down": 1024}' -H 'Content-Type: application/json' +$ curl http://127.0.0.1:18081/set_log_level -d '{"level":1}' -H 'Content-Type: application/json' { - "limit_down": 1024, - "limit_up": 128, "status": "OK" "untrusted": false } ``` -### **/out_peers** +### **/start_mining** -Limit number of Outgoing peers. +Start mining on the daemon. Alias: _None_ . Inputs: -- _out_peers_ - unsigned int; Max number of outgoing peers +- _do_background_mining_ - boolean; States if the mining should run in background (`true`) or foreground (`false`). +- _ignore_battery_ - boolean; States if battery state (on laptop) should be ignored (`true`) or not (`false`). +- _miner_address_ - string; Account address to mine to. +- _threads_count_ - unsigned int; Number of mining thread to run. Outputs: -- _out_peers_ - unsigned int; Max number of outgoing peers -- _status_ - string; General RPC error code. "OK" means everything looks good. +- _status_ - string; General RPC error code. "OK" means everything looks good. Any other value means that something went wrong. - _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 and thus handles the RPC locally (`false`) Example: ```Bash -$ curl http://127.0.0.1:18081/out_peers -d '{"out_peers": 3232235535}' -H 'Content-Type: application/json' +$ curl http://127.0.0.1:18081/start_mining -d '{"do_background_mining":false,"ignore_battery":true,"miner_address":"47xu3gQpF569au9C2ajo5SSMrWji6xnoE5vhr94EzFRaKAGw6hEGFXYAwVADKuRpzsjiU1PtmaVgcjUJF89ghGPhUXkndHc","threads_count":1}' -H 'Content-Type: application/json' { - "out_peers": 3232235535, "status": "OK", "untrusted": false } ``` -### **/in_peers** - -Limit number of Incoming peers. - -Alias: _None_ . - -Inputs: - -- _in_peers_ - unsigned int; Max number of incoming peers - -Outputs: - -- _in_peers_ - unsigned int; Max number of incoming peers -- _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 and thus handles the RPC locally (`false`) - -Example: - -```Bash -$ curl http://127.0.0.1:18081/in_peers -d '{"in_peers": 3232235535}' -H 'Content-Type: application/json' - -{ - "in_peers": 3232235535, - "status": "OK", - "untrusted": false -} -``` - - -### **/get_net_stats** - -Alias: _None_ . - -Inputs: _None_ . - -Outputs: - -- _start_time_ - unsigned int; Unix start time. -- _total_packets_in_ - unsigned int; -- _total_bytes_in_ - unsigned int; -- _total_packets_out_ - unsigned int; -- _total_bytes_out_ - 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 and thus handles the RPC locally (`false`). - -Example: - -```Bash -$ curl http://127.0.0.1:18081/get_net_stats -H 'Content-Type: application/json' - -{ - "start_time": 1665147355, - "status": "OK", - "total_bytes_in": 3743474809, - "total_bytes_out": 5932012405, - "total_packets_in": 2130592, - "total_packets_out": 1010674, - "untrusted": false -} -``` - ### **/start_save_graph** @@ -3001,6 +3160,57 @@ $ curl http://127.0.0.1:18081/start_save_graph -H 'Content-Type: application/jso ``` + +### **/stop_daemon** + +Send a command to the daemon to safely disconnect and shut down. + +Alias: _None_ . + +Inputs: _None_ . + +Outputs: + +- _status_ - string; General RPC error code. "OK" means everything looks good. + +Example: + +```Bash +$ curl http://127.0.0.1:18081/stop_daemon -H 'Content-Type: application/json' + +{ + "status": "OK" +} +``` + + + +### **/stop_mining** + +Stop mining on the daemon. + +Alias: _None_ . + +Inputs: _None_ . + +Outputs: + +- _status_ - string; General RPC error code. "OK" means everything looks good. Any other value means that something went wrong. +- _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 and thus handles the RPC locally (`false`) + +Example: + +```Bash +$ curl http://127.0.0.1:18081/stop_mining -H 'Content-Type: application/json' + +{ + "status": "OK", + "untrusted": false +} +``` + + + ### **/stop_save_graph** Obsolete. Conserved here for reference. @@ -3024,30 +3234,6 @@ $ curl http://127.0.0.1:18081/stop_save_graph -H 'Content-Type: application/json ``` -### **/get_outs** - -Get outputs. - -Alias: _None_ . - -Inputs: - -- _outputs_ array of _get_outputs_out_ structure as follows: - - _amount_ - unsigned int; - - _index_ - unsigned int; -- _get_txid_ - boolean; If `true`, a _txid_ will included for each output in the response. - -Outputs: - -- _outs_ - array of structure _outkey_ as follows: - - _height_ - unsigned int; block height of the output - - _key_ - String; the public key of the output - - _mask_ - String - - _txid_ - String; transaction id - - _unlocked_ - boolean; States if output is locked (`false`) or not (`true`) -- _status_ - string; General RPC error code. "OK" means everything looks good. -- _untrusted_ - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (`true`), or when the daemon is fully synced and thus handles the RPC locally (`false`) - ### **/update** @@ -3088,126 +3274,6 @@ $ curl http://127.0.0.1:18081/update -d '{"command":"check"}' -H 'Content-Type: } ``` - -### **/pop_blocks** - -Alias: _None_ . - -Inputs: - -- _nblocks_ - unsigned int; - -Outputs: - -- _height_ - unsigned int; New blockheight after popping blocks -- _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 and thus handles the RPC locally (`false`) - -Example: - -```Bash -$ curl http://127.0.0.1:18081/pop_blocks -d '{"nblocks":6}' -H 'Content-Type: application/json'' - -{ - "height": 76482, - "status": "OK", - "untrusted": false -} -``` - - -### **/get_transaction_pool_hashes** - -Get hashes from transaction pool. - -Alias: _None_ . - -Inputs: _None_ . - -Outputs: - -- _credits_ - unsigned int; If payment for RPC is enabled, the number of credits available to the requesting client. Otherwise, 0. -- _status_ - string; General RPC error code. "OK" means everything looks good. -- _top_hash_ - string; If payment for RPC is enabled, the hash of the highest block in the chain. Otherwise, empty. -- _tx_hashes_ - array of strings; This is an array of transaction hashes in hexadecimal string form. -- _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 and thus handles the RPC locally (`false`) - -Example: - -```Bash -$ curl http://127.0.0.1:18081/get_transaction_pool_hashes -H 'Content-Type: application/json' - -{ - "credits": 0, - "status": "OK", - "top_hash": "", - "tx_hashes": ["e27bb84f1cf1f47a79578d3bb1f47a81745a4c5a5551622b4e924eb0b83f960d","b9f76e686f389e126ada5caf47034c57adeef671d8b899cba1ead606c868f819"], - "untrusted": false -} -``` - - -### **/get_public_nodes** - -Get public peer information. - -Alias: _None_ . - -Inputs: - -- _gray_ - boolean; (Optional; defaults to `false`) Include gray peers. -- _white_ - boolean; (Optional; defaults to `true`) Include white peers. -- _include_blocked_ - boolean; (Optional; defaults to `false`) Include blocked peers. - -Outputs: - -- _status_ - string; General RPC error code. "OK" means everything looks good. -- _whites_ - array of `public_node` structures defined as follows: - - _host_ - string; The node's IP address. This includes IPv4, IPv6, Onion, and i2p addresses. - - _last_seen_ - unsigned int; UNIX timestamp of the last time the node was seen. - - _rpc_credits_per_hash_ - unsigned int; If payment for RPC is enabled, the number of credits the node is requesting per hash. Otherwise, 0. - - _rpc_port_ - unsigned int; RPC port number of the node. -- _gray_ - array of `public_node` structures; This is an array structures containing node information on gray peers. See _white_ above. -- _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 and thus handles the RPC locally (`false`) - -Example: - -```Bash -$ curl http://127.0.0.1:18081/get_public_nodes -d '{"gray":true}' -H 'Content-Type: application/json' - -{ - "gray": [{ - "host": "142.93.132.1", - "last_seen": 0, - "rpc_credits_per_hash": 0, - "rpc_port": 18089 - },{ - "host": "193.142.4.2", - "last_seen": 0, - "rpc_credits_per_hash": 0, - "rpc_port": 19084 - }], - "status": "OK", - "untrusted": false, - "white": [{ - "host": "70.52.75.3", - "last_seen": 1722812577, - "rpc_credits_per_hash": 0, - "rpc_port": 18081 - },{ - "host": "::ffff:207.180.221.220", - "last_seen": 1722872337, - "rpc_credits_per_hash": 0, - "rpc_port": 18089 - },{ - "host": "zbjkbsxc5munw3qusl7j2hpcmikhqocdf4pqhnhtpzw5nt5jrmofptid.onion:18083", - "last_seen": 1720186288, - "rpc_credits_per_hash": 0, - "rpc_port": 18089 - }] -} -``` - ## Sources: Reworked from [monero-site](https://github.com/monero-project/monero-site/commit/297e34008744e5af1bd1f0cd2ca1edda802fe895)