Introduction
This is a list of the dynastycoind daemon RPC calls, their inputs and outputs, and examples of each.
Many RPC calls use the daemon's JSON RPC interface while others use their own interfaces, as demonstrated below.
Note: “atomic units” refer to the smallest fraction of 1 DCY according to the dynastycoind implementation. 1DCY = 1e12 atomic units.
Other Daemon RPC Calls
JSON RPC Methods
The majority of dynastycoind RPC calls use the daemon's json_rpc
interface to request various bits of information. These methods all follow a similar structure, for example:
IP=127.0.0.1 PORT=18081 METHOD='get_block_header_by_height' ALIAS='getblockheaderbyheight' PARAMS='{"height":912345}' curl \ -X POST http://$IP:$PORT/json_rpc \ -d '{"jsonrpc ":"2.0","id":"0","method":"'$METHOD'","params":'$PARAMS'}' \ -H 'Content-Type: application/json'
Some methods include parameters, while others do not. Examples of each JSON RPC method follow.
flush_txpool
Flush tx ids from transaction pool
Alias: It is not.
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:
get_block_count
Look up how many blocks are in the longest chain known to the node.
Alias: getblockcount.
Inputs: It is not.
Outputs:
- count – unsigned int; Number of blocks in longest chain seen by the node.
- status –string; General RPC error code. OK means everything looks good.
Example:
get_block_headers_range
Similar to get_block_header_by_height above, but for a range of blocks. This method includes a starting block height and an ending block height as parameters to retrieve basic information about the range of blocks.
Alias: getblockheadersrange.
Inputs:
- start_height – unsigned int; The starting block's height.
- end_height – unsigned int; The ending block's height.
Outputs:
- headers – array of
block_header
(a structure containing block header information. See get_last_block_header). - status –string; General RPC error code. OK means everything looks good.
- untrusted – boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (
true
), or when the daemon is fully synced (false
).
In this example, blocks range from height 1545999 to 1546000 is looked up (notice that the returned informations are ascending order ):
$ curl -X POST 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": { "headers": [{ "block_size": 301413, "": 16085, "difficulty": 134636057921, "hash": "86d1d20a40cefcf3dd410ff6967e0491613b77bf73ea8f1bf2e335cf9cf7d57a", "height": 1545999, "version_minor": "depth_version": 6, minor": 3246403956, "num_txes": 20, "orphan_status": false, "prev_hash": "0ef6e948f77b8f8806621003f5de24b1bcbea150bc0e376835aea099674a5db5", "reward": 5025593029981, "timestamp": 1523002893 },{ "block_size": 13322, "depth": 16084, "difficulty ": 134716086238, "hash": "b408bf4cfcd7de13e7e370c84b8314c85b24f0ba4093ca1d6eeb30b35e34e91a", "height": 1546000, "major_version": 7, "minor_version": 7, "nonce": 3737164176, "num_txes": 1, "orphan_status": false, "prev_hash ": "86d1d20a40cefcf3dd410ff6967e0491613b77bf73ea8f1bf2e335cf9cf7d57a", "reward": 4851952181070, "timestamp": 1523002931 }], "status": "OK", "untrusted": false } }
get_info
Retrieve general information about the state of your node and the network.
Alias:
- /get_info
- /getinfo
See other RPC Methods /get_info (not JSON)
Inputs: It is not.
Outputs:
- alt_blocks_count – unsigned int; Number of alternative blocks to main chain.
- block_size_limit – unsigned int; Maximum allowed block size
- block_size_median – unsigned int; Median block size of latest 100 blocks
- bootstrap_daemon_address –string; bootstrap node to give immediate usability to wallets while syncing by proxying RPC to it. (Note: the replies may be untrustworthy).
- cumulative_difficulty – unsigned int; Cumulative difficulty of all blocks in the blockchain.
- difficulty – unsigned int; Network difficulty (analogous to the strength of the network)
- free_space – unsigned int; Available disk space on the node.
- grey_peerlist_size – unsigned int; Gray Peerlist Size
- height – unsigned int; Current length of longest chain known to daemon.
- height_without_bootstrap – unsigned int; Current length of the local chain of the daemon.
- incoming_connections_count – unsigned int; Number of peers connected to and pulling from your node.
- mainnet – boolean; States if the node is on the mainnet (
true
) or not (false
). - offline – boolean; States if the node is offline (
true
) or online (false
). - outgoing_connections_count – unsigned int; Number of peers that you are connected to and getting information from.
- rpc_connections_count – unsigned int; Number of RPC clients connected to the daemon (Including this RPC request).
- stagenet – boolean; States if the node is on the stagenet (
true
) or not (false
). - start_time – unsigned int; Start time of the daemon, as UNIX time.
- status –string; General RPC error code. OK means everything looks good.
- target – unsigned int; Current target for next proof of work.
- target_height – unsigned int; The height of the next block in the chain.
- testnet – boolean; States if the node is on the testnet (
true
) or not (false
). - top_block_hash –string; Hash of the highest block in the chain.
- tx_count – unsigned int; Total number of non-coinbase transactions in the chain.
- tx_pool_size – unsigned int; Number of transactions that have been broadcast but not included in a block.
- untrusted – boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (
true
), or when the daemon is fully synced (false
). - was_bootstrap_ever_used – boolean; States if a bootstrap node has ever been used since the daemon started.
- white_peerlist_size – unsigned int; White Peerlist Size
Following is an example get_info
call and its return:
$ curl -X POST http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_info"}' -H 'Content- Type: application/json' { "id": "0", "jsonrpc": "2.0", "result": { "alt_blocks_count": 6, "block_size_limit": 600000, "block_size_median": 129017, "bootstrap_daemon_address": "", "cumulative_difficulty": 14121125493385685, "difficulty": 60580751777, "free_space": 138758750208, "grey_peerlist_size": 4998, "height": 1562168, "height_without_bootstrap": 1562168, "incoming_connections "_maincount": true2 , "offline": false, "outgoing_connections_count": 8, "rpc_connections_count": 2, "stagenet": false, "start_time": 1524751757, "status": "OK", "target": 120, "target_height": 1562063 , "testnet": false, "top_block_hash": "7a7ba647080844073fdd8e3a069e00554c773d6e6863354dba1dec45a43f5592", "tx_count": 2759894, "tx_pool_size": 755, "untrusted": false, "was_bootstrap_eversize_used}0": false}, "was_bootstrap_eversize_0}: false}
get_txpool_backlog
Get all transaction pool backlog
Alias: It is not.
Inputs: It is not.
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 (false
).
Example:
relay_tx
Relay a list of transaction IDs.
Alias: It is not.
Inputs:
- txids – array of strings; list of transaction IDs to relay
Outputs:
- status –string; General RPC error code. OK means everything looks good.
Example:
get_alternate_chains
Display alternative chains seen by the node.
Alias: It is not.
Inputs: It is not.
Outputs:
- chains – array of chains, the following structure:
- block_hash –string; the block hash of the first diverging block of this alternative chain.
- difficulty – unsigned int; the cumulative difficulty of all blocks in the alternative chain.
- height – unsigned int; the block height of the first diverging block of this alternative chain.
- length – unsigned int; the length in blocks of this alternative chain, after divergence.
- status –string; General RPC error code. OK means everything looks good.
Example:
$ curl -X POST http://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": "697cf03c89a9b118f7bdf11b1b3a6a028d7b3617d2d0ed91322c5709acf75625", "difficulty": 1411472962838300 "height] ": 1562062, "length": 2 }], "status": "OK" } }
get_block_template
Get a block template on which mining a new block.
Alias: getblocktemplate.
Inputs:
- wallet_address –string; Address of wallet to receive coinbase transactions if block is successfully mined.
- reserve_size – unsigned int; Reserve size.
Outputs:
- blocktemplate_blob –string; Blob on which to try to mine a new block.
- blockhashing_blob –string; Blob on which to try to find a valid nonce.
- difficulty – unsigned int; Difficulty of next block.
- expected_reward – unsigned int; Coinbase reward expected to be received if block is successfully mined.
- height – unsigned int; Height on which to mine.
- prev_hash –string; Hash of the most recent block on which to mine the next block.
- reserved_offset – unsigned int; Reserved offset.
- status –string; General RPC error code. OK means everything looks good.
- untrusted – boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (
true
), or when the daemon is fully synced (false
).
Example:
$ curl -X POST http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block_template","params":{" wallet_address":"NY4GBHzv6ZyQdJkjqZje6KLZ3xSyN1hBSFAnLP6EAqJtCRVzMzZmeXTC2AHKDS9aEDTRKmo6a6o9r9j86pYfhCWDkKjbtcns","reserve_size":60}' -H 'Content-Type: application/json' { "id": "0", "jsonrpc": "2.0", "blockhashing_0", "blockhashing_ : "070786a498d705f8dc58791266179087907a2ff4cd883615216749b97d2f12173171c725a6f84a00000000fc751ea4a94c2f840751eaa36138eee66dda15ef554e7d6594395827994e31da10", "blocktemplate_blob": "", "difficulty": 61044293, "expected_reward": 4771057248, "height": 561970, "prev_hash": "f8dc58791266179087907a2ff4cd883615216749b97d2f12173171c725a6f84a", "reserved_offset": 129, "status": "OK ", "untrusted": false } }
get_coinbase_tx_sum
Get the coinbase amount and the fees amount for n last blocks starting at particular height
Alias: It is not.
Inputs:
- height – unsigned int; Block height from which getting the amounts
- count – unsigned int; number of blocks to include in the sum
Outputs:
- emission_amount – unsigned int; amount of coinbase reward in atomic units
- fee_amount – unsigned int; amount of fees in atomic units
- status –string; General RPC error code. OK means everything looks good.
Example:
$ curl -X POST http://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": { "emission_amount": 9387854817320, "fee_amount": 83981380000, "status": "OK" } }
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: It is not.
Outputs:
- block_header – A structure containing block header information.
- block_size – unsigned int; The block size in bytes.
- depth – unsigned int; The number of blocks succeeding this block on the blockchain. A larger number means an older block.
- difficulty – unsigned int; The strength of the dynastycoin network based on mining power.
- hashes –string; The hash of this block.
- height – unsigned int; The number of blocks preceding this block on the blockchain.
- major_version – unsigned int; The major version of the dynastycoin protocol at this block height.
- minor_version – unsigned int; The minor version of the dynastycoin protocol at this block height.
- there is not – unsigned int; a cryptographic random one-time number used in mining a dynastycoin block.
- num_txes – unsigned int; Number of transactions in the block, not counting the coinbase tx.
- orphan_status – boolean; Usually
false
. Iftrue
, this block is not part of the longest chain. - prev_hash –string; The hash of the block immediately preceding this block in the chain.
- reward – unsigned int; The amount of new atomic units generated in this block and rewarded to the miner. Notes: 1DCY = 1e12 atomic units.
- timestamp – unsigned int; The unix time at which the block was recorded into the blockchain.
- status –string; General RPC error code. OK means everything looks good.
- untrusted – boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (
true
), or when the daemon is fully synced (false
).
In this example, the most recent block (562023 at the time) is returned:
$ curl -X POST 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": 62774, "depth": 0, "difficulty": 60097840 , "hash": "3a289b8fa88b10e2163826c230b45d79f2be37d14fa3153ee58ff8a427782d14", "height": 562023, "major_version": 7, "minor_version": 7, "nonce": 3789681204, "num_hash "txes": 5, "orphan_false": "orphan_": 743e5d0a26849efe27b96086f2c4ecc39a0bc744bf21473dad6710221aff6ac3", "reward": 4724029703, "timestamp": 1525029411 }, "status": "OK", "untrusted": false } }
get_version
Give the node current version
Alias: It is not.
Inputs: It is not.
Outputs:
- status –string; General RPC error code. OK means everything looks good.
- untrusted – boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (
true
), or when the daemon is fully synced (false
). - version – unsigned int;
Example:
set_bans
Ban another node by IP.
Alias: It is not.
Inputs:
- bans – A list of nodes to ban:
- hosts –string; Host to ban (IP in ABCD form – will support I2P address in the future).
- ip – unsigned int; IP address to ban, in Int format.
- ban – boolean; Set
true
to ban. - seconds – unsigned int; Number of seconds to ban node.
Outputs:
- status –string; General RPC error code. OK means everything looks good.
Examples:
banning by host
In the following example, host is banned with its IP address string-formatted as ABCD:
$ curl -X POST http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"set_bans","params":{" bans":[{"host":"192.168.1.51","ban":true,"seconds":30}]}}' -H 'Content-Type: application/json' { "id": "0" , "jsonrpc": "2.0", "result": { "status": "OK" } }
banning by ip
In the following example, integer-formatted IP is banned:
get_bans
Get list of banned IPs.
Alias: It is not.
Inputs: It is not.
Outputs:
- bans – List of banned nodes:
- hosts –string; Banned host (IP in ABCD form).
- ip – unsigned int; Banned IP address, in Int format.
- seconds – unsigned int; Local Unix time that IP is banned until.
- status –string; General RPC error code. OK means everything looks good.
Example:
$ curl -X POST http://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" } }
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:
- hashes –string; The block's sha256 hash.
Outputs:
- block_header – A structure containing block header information. If it's get_last_block_header.
- status –string; General RPC error code. OK means everything looks good.
- untrusted – boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (
true
), or when the daemon is fully synced (false
).
In this example, block 912345 is looked up by its hash:
$ curl -X POST 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, "depth": 649717, "difficulty": 815625611, "hash": "e22cf75f39ae720e8b71b3d120a5ac03f0db50bba6379e2850975b4859190bc6", "height": 912345, "major_version": 1, "minor_version": 1, "minor_6x"": 2,6"xversion": : 0, "orphan_status": false, "prev_hash": "b61c58b2e0be53fad5ef9d9731a55e8a81d972b8d90ed07c04fd37ca6403ff78", "reward": 7388968946286, "timestamp": 1452793716 }, "statused}": "OK", }, false
get_connections
Retrieve information about incoming and outgoing connections to your node.
Alias: It is not.
Inputs: It is not.
Outputs:
- connections – List of all connections and their info:
- address –string; The peer's address, actually IPv4 & port
- avg_download – unsigned int; Average bytes of data downloaded by node.
- avg_upload – unsigned int; Average bytes of data uploaded by node.
- connection_id –string; The connection ID
- current_download – unsigned int; Current bytes downloaded by node.
- current_upload – unsigned int; Current bytes uploaded by node.
- height– unsigned int; The peer height
- hosts –string; The peer host
- incoming – boolean; Is the node getting information from your node?
- ip –string; The node's IP address.
- live_time – unsigned int
- local_ip – boolean
- localhost – boolean
- peer_id –string; The node's ID on the network.
- port –string; The port that the node is using to connect to the network.
- recv_count – unsigned int
- recv_idle_time – unsigned int
- send_count – unsigned int
- send_idle_time – unsigned int
- stay – string
- support_flags – unsigned int
Following is an example of get_connections
and it's return:
$ curl -X POST http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_connections"}' -H 'Content- Type: application/json' { "id": "0", "jsonrpc": "2.0", "result": { "connections": [{ "address": "173.90.69.136:62950", "avg_download": 0, "avg_upload": 2, "connection_id": "083c301a3030329a487adb12ad981d2c", "current_download": 0, "current_upload": 2, "height": 1562127, "host": "173.90.69.136", "incoming": true, "ip": "173.90.69.136", "live_time": 8, "local_ip": false, "localhost": false, "peer_id": "c959fbfbed9e44fb", "port": "62950", "recv_count": 259, "recv_idle_time": 8, "send_count": 24342, "send_idle_time": 8, "state": "state_normal", "support_flags": 0 },{ ... }], "status": "OK" } }
get_output_distribution
Alias: It is not.
Inputs:
- amounts – array of unsigned ints; 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
- basis – unsigned int
- distribution – array of unsigned int
- start_height – unsigned int
- status –string; General RPC error code. OK means everything looks good.
Example:
$ curl -X POST 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" } }
hard_fork_info
Look up information regarding hard fork voting and readiness.
Alias: It is not.
Inputs: It is not.
Outputs:
- earliest_height – unsigned int; Block height at which hard fork would be enabled if voted in.
- enabled – boolean; Tells if hard fork is enforced.
- stay – unsigned int; Current hard fork state: 0 (There is likely a hard fork), 1 (An update is needed to fork properly), or 2 (Everything looks good).
- status –string; General RPC error code. OK means everything looks good.
- threshold – unsigned int; Minimum percent of votes to trigger hard fork. Default is 80.
- version – unsigned int; The major block version for the fork.
- votes – unsigned int; Number of votes towards hard forks.
- voting – unsigned int; Hard fork voting status.
- window – unsigned int; Number of blocks over which current votes are cast. Default is 10080 blocks.
Example:
$ curl -X POST http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"hard_fork_info"}' -H 'Content- Type: application/json' { "id": "0", "jsonrpc": "2.0", "result": { "earliest_height": 1009827, "enabled": false, "state": 2, "status": "OK", "threshold": 0, "version": 1, "votes": 7277, "voting": 2, "window": 10080 } }
submit_block
Submit a mined block to the network.
Alias: submitblock.
Inputs:
- Block blob data – array of strings; list of block blobs which have been mined. If it's get_block_template to get a blob on which to mine.
Outputs:
- status –string; Block submit status.
In this example, a block blob which has not been mined is submitted:
$ curl -X POST http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"submit_block","params":[" 0707e6bdfedc053771512f1bc27c62731ae9e8f2443db64ce742f4e57f5cf8d393de28551e441a0000000002fb830a01ffbf830a018cfe88bee283060274c0aae2ef5730e680308d9c00b6da59187ad0352efe3c71d36eeeb28782f29f2501bd56b952c3ddc3e350c2631d3a5086cac172c56893831228b17de296ff4669de020200000000"]' -H 'Content-Type: application/json' { "id": "0", "jsonrpc": "2.0", "error": { "code": -7, "message": "Block not accepted" } }
get_block
Full block information can be retrieved by either block height or hash, like with the above block header calls. For full block information, both lookups use the same method, but with different input parameters.
Alias: getblock.
Inputs (pick one of the following):
- height – unsigned int; The block's height.
- hashes –string; The block's hash.
Outputs:
- blobs –string; Hexadecimal blob of block information.
- block_header – A structure containing block header information. If it's get_last_block_header.
- json – jsonstring; JSON formatted block details:
- major_version – Same as in block header.
- minor_version – Same as in block header.
- timestamp – Same as in block header.
- prev_id – Same as
prev_hash
in block headers. - there is not – Same as in block header.
- miner_tx – Miner transaction information
- version – Transaction version number.
- unlock_time – The block height when the coinbase transaction becomes spendable.
- wine – List of transaction inputs:
- gen – Miner txs are coinbase txs, or “gen”.
- height – This block height, aka when the coinbase is generated.
- gen – Miner txs are coinbase txs, or “gen”.
- vout – List of transaction outputs. Each output contains:
- amount – The amount of the output, in atomic units.
- target –
- key –
- extra – Usually called the “transaction ID” but can be used to include any random 32 byte/64 character hex string.
- signatures – Contains signatures of tx signers. Coin-based txs do not have signatures.
- tx_hashes – List of hashes of non-coinbase transactions in the block. If there are no other transactions, this will be an empty list.
- status –string; General RPC error code. OK means everything looks good.
- untrusted – boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (
true
), or when the daemon is fully synced (false
).
Look up by height:
In the following example, block 912345 is looked up by its height. Note that block 912345 does not have any non-coinbase transactions. (See the next example for a block with extra transactions):
$ curl -X POST http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block","params":{" height":912345}}' -H 'Content-Type: application/json' { "id": "0", "jsonrpc": "2.0", "result": { "blob": "0102f4bedfb405b61c58b2e0be53fad5ef9d9731a55e8a81d972b8d90ed07c04fd37ca6403ff786e0600000195d83701ffd9d73704ee84ddb42102378b043c1724c92c69d923d266fe86477d3a5ddd21145062e148c64c5767700880c0fc82aa020273733cbd6e6218bda671596462a4b062f95cfe5e1dbb5b990dacb30e827d02f280f092cbdd080247a5dab669770da69a860acde21616a119818e1a489bb3c4b1b6b3c50547bc0c80e08d84ddcb01021f7e4762b8b755e3e3c72b8610cc87b9bc25d1f0a87c0c816ebb952e4f8aff3d2b01fd0a778957f4f3103a838afda488c3cdadf2697b3d34ad71234282b2fad9100e02080000000bdfc2c16c00", "block_header ": { "block_size": 210, "depth": 649772, "difficulty": 815625611, "hash": "e22cf75f39ae720e8b71b3d120a5ac03f0db50bba6379e2850975b4859190bc6", "height": 912345, "noversionmajor_version": 1, minor_version": 1, : 1646, "num_txes": 0, "orphan_status": false, "prev_hash": "b61c58b2e0be53fad5ef9d9731a55e8a81d972b8d90ed07c04fd37ca6403ff78", "reward": 7388968946286, "timestamp": 145"26 },_9371 "jversion": \version: 1, \n \"minor_version\": 2, \n \"timestamp\": 1452793716, \n \"prev_id\": \"b61c58b2e0be53fad5ef9d9731a55e8a81d972b8d90ed07c04fd37ca6403ff78\", \n \"nonce\": 1646, \n \" miner_tx\": {\n \"version\": 1, \n \"unlock_time\": 912405, \n \"vin\": [ {\n \"gen\": {\n \"height\ ": 912345\n }\n }\n ], \n \"vout\": [ {\n \"amount\": 8968946286, \n \"target\": {\n \"key\": \"378b043c1724c92c69d923d266fe86477d3a5ddd21145062e148c64c57677008\"\n }\n }, {\n \"amount\": 80000000000, \n \"target\": {\n \"key\": \"73733cbd6e6218bda671596462a4b062f95cfe5e1dbb5b990dacb30e827d02f2\"\n }\n }, {\n \"amount\": 300000000000, \n \"target\": {\n \"key\": \"47a5dab669770da69a860acde21616a119818e1a489bb3c4b1b6b3c50547bc0c\"\n }\n }, {\n \"amount\" : 7000000000000, \n \"target\": {\n \"key\": \"1f7e4762b8b755e3e3c72b8610cc87b9bc25d1f0a87c0c816ebb952e4f8aff3d\"\n }\n }\n ], \n \"extra\": [ 1, 253, 10, 10, 10 119, 137, 87, 244, 243, 16, 58, 131, 138, 253, 164, 136, 195, 205, 173, 242, 105, 123, 61, 52, 173, 113, 35, 66, 130, 178, 250, 217, 16, 14, 2, 8, 0, 0, 0, 11, 223, 194, 193, 108\n ], \n \"signatures\": [ ]\n }, \n \ "tx_hashes\": [ ]\n}", "miner_tx_hash": "c7da3965f25c19b8eb7dd8db48dcd4e7c885e2491db77e289f0609bf8e08ec30", "status": "OK", "untrusted": false } }
Look up by hash:
In the following example, block 993056 is looked up by its hash. Note that block 993056 has 3 non-coinbase transactions:
$ curl -X POST http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block","params":{" hash":"510ee3c4e14330a7b96e883c323a60ebd1b5556ac1262d0bc03c24a3b785516f"}}' -H 'Content-Type: application/json' { "id": "0", "jsonrpc": "2.0", "result": { "blob": "", " block_header": { "block_size": 3981, "": 569068, "difficulty": 964985344, "hash": "510ee3c4e14330a7b96e883c323a60ebd1b5556ac1262d0bc03c24a3b785516f", "height": 993056 "": 1b5556ac1262d0bc03c24a3b785516f", "height": 993056, "_depth, no version, 2": "major_version ": 2036, "num_txes": 3, "orphan_status": false, "prev_hash": "0ea4af6547c05c965afc8df6d31509ff3105dc7ae6b10172521d77e09711fd6d", "reward": 6932043647005, "timestamp": 1457720227 }, "json": "{\n \"major_version\" : 1, \n \"minor_version\": 2, \n \"timestamp\": 1457720227, \n \"prev_id\": \"0ea4af6547c05c965afc8df6d31509ff3105dc7ae6b10172521d77e09711fd6d\", \n \"nonce\": 2036, \n "miner_tx\": {\n \"version\": 1, \n \"unlock_time\": 993116, \n \"vin\": [ {\n \"gen\": {\n \"height \: 993056\n }\n }\n ], \n \"vout\": [ {\n \"amount\": 2043647005, \n \"target\": {\n \"key\" : \"59e9d685b3484886bc7b47c133e6099ecdf212d5eaa16ce19cd58e8c3c1e590a\"\n }\n }, {\n \"amount\": 30000000000, \n \"target\": {\n \"key\": \"4c5e2f542d25513c46b9e3b7d40140a22d0ae5314bfcae492ad9f56fff8185f0\"\n }\ n }, {\n \"amount\": 900000000000, \n \"target\": {\n \"key\": \"13dd8ffdac9e6a2f71e327dad65328198dc879a492d145eae72677c0703a3515\"\n }\n }, {\n \"amount\ ": 6000000000000, \n \"target\": {\n \"key\": \"62bda00341681dccbc066757862da593734395745bdfe1fdc89b5948c86a5d4c\"\n }\n }\n ], \n \"extra\": [ 1, 182, 142, 14 , 133, 28, 240, 87, 185, 195, 2, 163, 219, 202, 135, 158, 28, 186, 76, 196, 80, 97, 202, 85, 170, 166, 224, 60, 220 , 103, 171, 158, 69, 80, 2, 8, 0, 0, 0, 12, 97, 127, 223, 22\n ], \n \"signatures\": [ ]\n }, \n \"tx_hashes\": [ \"79c6b9f00db027bde151705aafe85c495883aae2597d5cb8e1adb2e0f3ae1d07\", \"d715db73331abc3ec588ef07c7bb195786a4724b08dff431b51ffa32a4ce899b\", \"b197066426c0ed89f0b431fe171f7fd62bc95dd29943daa7cf3585cf1fdfc99d\"\n ]\n}", "miner_tx_hash": "372395aeac5e5ad2c40b4c546b0bad00c4242fb2bd88e2e25f4e43231876f81e", "status": "OK", "tx_hashes ": ["79c6b9f00db027bde151705aafe85c495883aae2597d5cb8e1adb2e0f3ae1d07","d715db73331abc3ec588ef07c7bb195786a4724b08dff431b51ffa32a4ce899b","b197066426c0ed89f0b431fe171f7fd62bc95dd29943daa7cf3585cf1fdfc99d"], "untrusted": false } }
get_block_header_by_height
Similar to get_block_header_by_hash above, this method includes a block's height as an input parameter to retrieve basic information about the block.
Alias: getblockheaderbyheight.
Inputs:
- height – unsigned int; The block's height.
Outputs:
- block_header – A structure containing block header information. If it's get_last_block_header.
- status –string; General RPC error code. OK means everything looks good.
- untrusted – boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (
true
), or when the daemon is fully synced (false
).
In this example, block 10000 is looked up by its height :
$ curl -X POST http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block_header_by_height","params":{" height":10000}}' -H 'Content-Type: application/json' { "id": "0", "jsonrpc": "2.0", "result": { "block_header": { "block_size": 210 , "depth": 649721, "difficulty": 815625611, "hash": "e22cf75f39ae720e8b71b3d120a5ac03f0db50bba6379e2850975b4859190bc6", "height": 10000, "major_version": 1, "minor_version", "num_version": 2,_ "noncet": 2, , "orphan_status": false, "prev_hash": "b61c58b2e0be53fad5ef9d9731a55e8a81d972b8d90ed07c04fd37ca6403ff78", "reward": 7388968946286, "timestamp": 1452793716 }, "status": "OK", "}untrusted
get_fee_estimate
Gives an estimation on fees per byte.
Alias: It is not.
Inputs:
- grace_blocks – unsigned int; Options
Outputs:
- fee – unsigned int; Estimated amount of fees per byte in atomic units
- quantization_mask – unsigned int; Final fee should be rounded up to an even multiple of this value
- status –string; General RPC error code. OK means everything looks good.
- untrusted – boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (
true
), or when the daemon is fully synced (false
).
Example:
get_output_histogram
Get a histogram of output amounts. For all amounts (possibly filtered by parameters), gives the number of outputs on the chain for that amount. RingCT outputs counts as 0 amount.
Inputs:
- amounts – list of unsigned int
- min_count – unsigned int
- max_count – unsigned int
- unlocked – boolean
- recent_cutoff – unsigned int
Outputs:
- histogram – list of histogram entries, in the following structure:
- amount – unsigned int; Output amount in atomic units
- total_instances – unsigned int;
- unlocked_instances – unsigned int;
- recent_instances – unsigned int;
- status –string; General RPC error code. OK means everything looks good.
- untrusted – boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (
true
), or when the daemon is fully synced (false
).
Example:
$ curl -X POST http://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": { "histogram": [{ "amount ": 20000000000, "recent_instances": 0, "total_instances": 381458, "unlocked_instances": 0 }], "status": "OK", "untrusted": false } }
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:
sync_info
Get synchronization information
Alias: It is not.
Inputs: It is not.
Outputs:
- height – unsigned int;
- peers – array of peer structures, defined as follows:
- info – structure of connection info, as defined in get_connections
- spans – array of span structure, defined as follows (optional, absent if node is fully synced):
- connection_id –string; Id of connection
- nblocks – unsigned int; number of blocks in that span
- installments – unsigned int; connection rate
- remote_address –string; peer address the node is downloading (or has downloaded) than span from
- size – unsigned int; total number of bytes in that span's blocks (including txes)
- speed – unsigned int; connection speed
- start_block_height – unsigned int; block height of the first block in that span
- status –string; General RPC error code. OK means everything looks good.
- target_height – unsigned int; target height the node is syncing from (optional, absent if node is fully synced)
Example:
$ curl -X POST http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"sync_info"}' -H 'Content- Type: application/json' { "id": "0", "jsonrpc": "2.0", "result": { "height": 1563543, "peers": [{ "info": { "address": " 70.109.53.128:60064", "avg_download": 0, "avg_upload": 5, "connection_id": "204067223b9b3415c265dd25ad29ee48", "current_download": 0, "current_upload": 1, "height": 1559975, "host": " 70.109.53.128", "incoming": true, "ip": "70.109.53.128", "live_time": 38, "local_ip": false, "localhost": false, "peer_id": "96b8545dbc7a8866", "port" : "60064", "recv_count": 1580, "recv_idle_time": 28, "send_count": 203603, "send_idle_time": 8, "state": "state_normal", "support_flags": 1 } },{ "info": { ... } },{ ... },{ ... },{ ... }], "status": "OK", "target_height": 1564067 } }
/get_alt_blocks_hashes
Get the known blocks hashes which are not on the main chain.
Alias: It is not.
Inputs: It is not
Outputs:
- blks_hashes – array of strings; list of alternative blocks hashes to main chain
- status –string; General RPC error code. OK means everything looks good.
- untrusted – boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (
true
), or when the daemon is fully synced (false
).
Example:
$ curl -X POST http://127.0.0.1:18081/get_alt_blocks_hashes -H 'Content-Type: application/json' { "blks_hashes": ["9c2277c5470234be8b32382cdf8094a103aba4fcd5e875a6fc159dc2ec00e011","637c0e0f0558e284493f38a5fcca3615db59458d90d3a5eff0a18ff59b83f46f","6f3adc174a2e8082819ebb965c96a095e3e8b63929ad9be2d705ad9c086a6b1c","697cf03c89a9b118f7bdf11b1b3a6a028d7b3617d2d0ed91322c5709acf75625"," d99b3cf3ac6f17157ac7526782a3c3b9537f89d07e069f9ce7821d74bd9cad0e","e97b62109a6303233dcd697fa8545c9fcbc0bf8ed2268fede57ddfc36d8c939c","70ff822066a53ad64b04885c89bbe5ce3e537cdc1f7fa0dc55317986f01d1788","b0d36b209bd0d4442b55ea2f66b5c633f522401f921f5a85ea6f113fd2988866"], "status": "OK", "untrusted": false }
/get_height
Get the node's current height.
Alias: /getheight.
Inputs: It is not.
Outputs:
- height – unsigned int; Current length of longest chain known to daemon.
- status –string; General RPC error code. OK means everything looks good.
- untrusted – boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (
true
), or when the daemon is fully synced (false
).
/get_outs
Get outputs.
Alias: It is not.
Inputs:
- outputs array of get_outputs_out structure as follows:
- amount – unsigned int;
- index – unsigned int;
Outputs:
- outs – array of structures outkey as follows:
- height – unsigned int; block height of the output
- key –String; the public key of the output
- mask – String
- txid –String; transaction id
- unlocked – boolean; States if output is locked (
false
) or not (true
)
- status –string; General RPC error code. OK means everything looks good.
- untrusted – boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (
true
), or when the daemon is fully synced (false
).
/get_transaction_pool_hashes.bin
Get hashes from transaction pool. Binary request.
Alias: It is not.
Inputs: It is not.
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 (false
).
Example:
/is_key_image_spent
Check if outputs have been spent using the key image associated with the output.
Alias: It is not.
Inputs:
- key_images – string list; List of key image hex strings to check.
Outputs:
- spent_status – unsigned int list; List of statuses for each image checked. Statuses are follows: 0 = unspent, 1 = spent in blockchain, 2 = spent in transaction pool
- status –string; General RPC error code. OK means everything looks good.
- untrusted – boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (
true
), or when the daemon is fully synced (false
).
Example:
$ curl -X POST http://127.0.0.1:18081/is_key_image_spent -d '{"key_images":["8d1bd8181bf7d857bdb281e0153d84cd55a3fcaa57c3e570f4a49f935850b5e3","7319134bfc50668251f5b899c66b005805ee255c136f0e1cecbb0f3a912e09d4"]}' -H 'Content-Type: application/json' { "spent_status" : [1,2], "status": "OK" "untrusted": false }
/send_raw_transaction
Broadcast a raw transaction to the network.
Alias: /sendrawtransaction.
Inputs:
- tx_as_hex –string; Full transaction information as hexidecimal string.
- do_not_relay – boolean; Stop relaying transactions to other nodes (default is
false
).
Outputs:
- double_spend – boolean; Transaction is a double spend (
true
) or not (false
). - fee_too_low – boolean; Fee is too low (
true
) or OK (false
). - invalid_input – boolean; Input is invalid (
true
) or valid (false
). - invalid_output – boolean; Output is invalid (
true
) or valid (false
). - low_mixin – boolean; Mixin count is too low (
true
) or OK (false
). - not_rct – boolean; Transaction is a standard ring transaction (
true
) or a ring confidential transaction (false
). - not_relayed – boolean; Transaction was not relayed (
true
) or relayed (false
). - overspend – boolean; Transaction uses more money than available (
true
) or not (false
). - reason –string; Additional information. Currently empty or "Not relayed" if transaction was accepted but not relayed.
- status –string; General RPC error code. OK means everything looks good. Any other value means that something went wrong.
- too_big – boolean; Transaction size is too big (
true
) or OK (false
). - untrusted – boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (
true
), or when the daemon is fully synced (false
).
Example (No return information included here.):
/set_log_level
Set the daemon log level. By default, log level is set to 0
.
Alias: It is not.
Inputs:
- level – integer; daemon log level to set from
0
(less verbose) to4
(most verbose)
Outputs:
- status –string; General RPC error code. OK means everything looks good. Any other value means that something went wrong.
Example:
/get_blocks.bin
Get all blocks info. Binary request.
Alias: /getblocks.bin.
Inputs:
- block_ids – binary array of hashes; first 10 blocks id goes sequential, next goes in pow(2,n) offset, like 2, 4, 8, 16, 32, 64 and so on, and the last one is always genesis block
- start_height – unsigned int
- plum – boolean
Outputs:
- blocks – array of block complete entries
- current_height – unsigned int
- output_indices – structure as follows:
- indices – array of tx output indices, structure as follows:
- indices – array of unsigned int
- indices – array of tx output indices, structure as follows:
- start_height – unsigned int
- status –string; General RPC error code. OK means everything looks good.
- untrusted – boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (
true
), or when the daemon is fully synced (false
).
/get_outs.bin
Get outputs. Binary request.
Alias: It is not.
Inputs:
- outputs – array of structures get_outputs_out as follows:
- amount – unsigned int;
- index – unsigned int;
Outputs:
- outs – array of structures outkey as follows:
- amount – unsigned int;
- height – unsigned int; block height of the output
- key – the public key of the output
- mask
- txid – transaction id
- unlocked – boolean; States if output is locked (
false
) or not (true
)
- status –string; General RPC error code. OK means everything looks good.
- untrusted – boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (
true
), or when the daemon is fully synced (false
).
/get_transaction_pool_stats
Get the transaction pool statistics.
Alias: It is not.
Inputs: It is not.
Outputs:
- pool_stats – Structure as follows:
- bytes_max – unsigned int; Max transaction size in pool
- bytes_med – unsigned int; Median transaction size in the pool
- bytes_min – unsigned int; Min transaction size in pool
- bytes_total – unsigned int; total size of all transactions in pool
- histo – structure txpool_histo as follows:
- txs – unsigned int; number of transactions
- bytes – unsigned int; size in bytes.
- histo_98pc unsigned int; the time 98% of txes are “younger” than
- number_10m unsigned int; number of transactions pooled for more than 10 minutes
- num_double_spends unsigned int; number of double-spend transactions
- num_failing unsigned int; number of failing transactions
- num_not_relayed unsigned int; number of non-relayed transactions
- oldest unsigned int; unix time of the oldest transaction in the pool
- txs_total unsigned int; total number of transactions.
- status –string; General RPC error code. OK means everything looks good.
- untrusted – boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (
true
), or when the daemon is fully synced (false
).
Example:
$ curl -X POST http://127.0.0.1:18081/get_transaction_pool_stats -H 'Content-Type: application/json' { "pool_stats": { "bytes_max": 47222, "bytes_med": 13290, "bytes_min": 13092 , "bytes_total": 449511, "fee_total": 289715320000, "histo": "\t▒'▒5▒4▒\/▒▒▒$3", "histo_98pc": 0, "num_10m": 18, "num_double_spends" : 1, "num_failing": 17, "num_not_relayed": 0, "oldest": 1525457001, "txs_total": 26 }, "status": "OK", "untrusted": false }
/mining_status
Get the mining status of the daemon.
Alias: It is not.
Inputs: It is not.
Outputs:
- active – boolean; States if mining is enabled (
true
) or disabled (false
). - address –string; Account address daemon is mining to. Empty if not mining.
- is_background_mining_enabled – boolean; States if the mining is running in the background (
true
) or foreground (false
). - speed – unsigned int; Mining power in hashes per seconds.
- status –string; General RPC error code. OK means everything looks good. Any other value means that something went wrong.
- threads_count – unsigned int; Number of running mining threads.
Example while mining:
$ curl -X POST http://127.0.0.1:18081/mining_status -H 'Content-Type: application/json' { "active": true, "address": "47xu3gQpF569au9C2ajo5SSMrWji6xnoE5vhr94EzFRaKAGw6hEGFXYAwVADKuRpzsjiU1PtmaVgcjUJF89ghGPhUXkndHc", "is_background_mining_enabled": false, "speed ": 20, "status": "OK", "threads_count": 1 }
Example while not mining:
/set_limit
Set daemon bandwidth limits.
Alias: It is not.
Inputs:
- limit_down –signed int; Download limit in kBytes per second (-1 reset to default, 0 don't change the current limit)
- limit_up –signed int; Upload limit in kBytes per second (-1 reset to default, 0 don't change the current limit)
Outputs:
- limit_down – unsigned int; Download limit in kBytes per second
- limit_up – unsigned int; Upload limit in kBytes per second
- status –string; General RPC error code. OK means everything looks good.
Example:
/start_mining
Start mining on the daemon.
Alias: It is not.
Inputs:
- do_background_mining – boolean; States if the mining should run in the 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 threads to run.
Outputs:
- status –string; General RPC error code. OK means everything looks good. Any other value means that something went wrong.
Example:
/get_blocks_by_height.bin
Get blocks by height. Binary request.
Alias: /getblocks_by_height.bin.
Inputs:
- heights – array of unsigned ints; list of block heights
Outputs:
- blocks – array of block complete entries
- status –string; General RPC error code. OK means everything looks good.
- untrusted – boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (
true
), or when the daemon is fully synced (false
).
/get_limit
Get daemon bandwidth limits.
Alias: It is not.
Inputs: It is not.
Outputs:
- limit_down – unsigned int; Download limit in kBytes per second
- limit_up – unsigned int; Upload limit in kBytes per second
- status –string; General RPC error code. OK means everything looks good.
- untrusted – boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (
true
), or when the daemon is fully synced (false
).
Example:
/get_peer_list
Get the known peers list.
Alias: It is not.
Inputs: It is not.
Outputs:
- gray_list – array of offline peers structure as follows:
- hosts – 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 dynastycoin 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 peers structure, as above.
Example (truncated lists):
$ curl -X POST 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_transactions
Look up one or more transactions by hash.
Alias: /gettransactions.
Inputs:
- txs_hashes – string lists; List of transaction hashes to look up.
- decode_as_json – boolean; Options (
false
by default). If settrue
, the returned transaction information will be decoded rather than binary. - plum – boolean; Options (
false
by default).
Outputs:
- missed_tx – array of strings. (Optional – returned if not empty) Transaction hashes that could not be found.
- status – General RPC error code. OK means everything looks good.
- txs – array of structures entry as follows:
- as_hex –string; Full transaction information as a hex string.
- as_json – jsonstring; List of transaction info:
- version – Transaction version
- unlock_time – If not 0, this tells when a transaction output is spendable.
- wine – List of inputs into transactions:
- key – The public key of the previous output spent in this transaction.
- amount – The amount of the input, in atomic units.
- key_offsets – A list of integer offsets to the input.
- k_image – The key image for the given input
- key – The public key of the previous output spent in this transaction.
- vout – List of outputs from transactions:
- amount – Amount of transaction output, in atomic units.
- target – Output destination information:
- key – The stealth public key of the receiver. Whoever owns the private key associated with this key controls this transaction output.
- extra – Usually called the “payment ID” but can be used to include any random 32 bytes.
- signatures – List of signatures used in ring signature to hide the true origin of the transaction.
- block_height – unsigned int; block height including the transaction
- block_timestamp – unsigned int; Unix time at chich the block has been added to the blockchain
- double_spend_seen – boolean; States if the transaction is a double-spend (
true
) or not (false
) - in_pool – boolean; States if the transaction is pooled (
true
) or included in a block (false
) - output_indices – array of unsigned ints; transaction indexes
- tx_hash –string; transaction hash
- txs_as_hex –string; Full transaction information as a hex string (old compatibility parameter)
- txs_as_json – jsonstring; (Optional – returned if set in inputs. Old compatibility parameter) List of transaction as in as_json above:
Example 1: Return transaction information in binary format.
$ curl -X POST http://127.0.0.1:18081/get_transactions -d '{"txs_hashes":["d6e48158472848e6687173a91ae6eebfa3e1d778e65252ee99d7515d63090408"]}' -H 'Content-Type: " application/json'":OK , "txs": [{ "as_hex": "...", "as_json": "", "block_height": 993442, "block_timestamp": 1457749396, "double_spend_seen": false, "in_pool": false, "output_indices ": [198769,418598,176616,50345,509], "tx_hash": "d6e48158472848e6687173a91ae6eebfa3e1d778e65252ee99d7515d63090408" }], "txs_as_hex": ["..."], "}untrusted
Example 2: Decode returned transaction information in JSON format. Note: the “vin”, “vout” and “signatures” list have been truncated in the displayed return for space considerations.
$ curl -X POST http://127.0.0.1:18081/get_transactions -d '{"txs_hashes":["d6e48158472848e6687173a91ae6eebfa3e1d778e65252ee99d7515d63090408"],"decode_as_json ":true}' -H application status": "OK", "txs": [{ "as_hex": "...", "as_json": "{\n \"version\": 1, \n \"unlock_time\": 0, \ n \"vin\": [ {\n \"key\": {\n \"amount\": 9999999999, \n \"key_offsets\": [ 691\n ], \n \"k_image\": \"6ebee1b651a8da723462b4891d471b990ddc226049a0866d3029b8e2f75b7012\"\n }\n }, {\n \"key\": {\n \"amount\": 9000000000000, \n \"key_offsets\": \ 175760\n" k_image\": \"200bd02b70ee707441a8863c5279b4e4d9f376dc97a140b1e5bc7d72bc508069\"\n }\n }, ... \n ], \n \"vout\": [ {\n \"amount\": 60000000000, \n \"target\" : {\n \"key\": \"8c792dea94dab48160e067fb681edd6247ba375281fbcfedc03cb970f3b98e2d\"\n }\n }, {\n \"amount\": 700000000000, \n \"target\": {\n \"key\": \"1ab33e69737e157d23e33274c42793be06a8711670e73fa10ecebc604f87cc71\"\n }\n }, ... \n ], \n \"extra\": [ 1, 3, 140, 109, 156, 205, 47, 148, 9,153, 1 93, 83, 33, 162, 110, 152, 1, 139, 70, 121, 19, 138, 10, 44, 6, 55, 140, 242, 124, 143, 219, 172\n ], \n \ "signatures\": [ \"fd82214a59c99d9251fa00126d353f9cf502a80d8993a6c223e3c802a40ab405555637f495903d3ba558312881e586d452e6e95826d8e128345f6c0a8f9f350e\", \"8c04ef50cf34afa3a9ec19c457143496f8cf7045ed869b581f9efa2f1d65e30f1cec5272b00e9c61a34bdd3c78cf82ae8ef4df3132f70861391069b9c255cd08\", ... ]\n}", "block_height": 993442, "block_timestamp": 1457749396, "double_spend_seen": false, "in_pool": false , "output_indices": [198769,418598,176616,50345,509], "tx_hash": "d6e48158472848e6687173a91ae6eebfa3e1d778e65252ee99d7515d63090408" }], "txs_as_as_hex", "txs_as_hex": ["_..." version\": 1, \n \"unlock_time\": 0, \n \"vin\": [ {\n \"key\": {\n \"amount\": 9999999999, \n \"key_offsets \: [ 691\n ], \n \"k_image\": \"6ebee1b651a8da723462b4891d471b990ddc226049a0866d3029b8e2f75b7012\"\n }\n }, {\n \"key\": {\n \"amount\": 9000000000000, \ n \"key_offsets\": [ 175760\n ], \n \"k_image\": \"200bd02b70ee707441a8863c5279b4e4d9f376dc97a140b1e5bc7d72bc508069\"\n }\n }, ... \n ], \n \"vout\": [ { \n \"amount\": 60000000000, \n \"target\": {\n \"key\": \"8c792dea94dab48160e067fb681edd6247ba375281fbcfedc03cb970f3b98e2d\"\n }\n }, {\n \"amount\": 7000000000. \n \"target\": {\n \"key\": \"1ab33e69737e157d23e33274c42793be06a8711670e73fa10ecebc604f87cc71\"\n }\n }, ... \n ], \n \"extra\": [ 1, 3, 140 , 109, 156, 205, 47, 148, 153, 9, 17, 93, 83, 33, 162, 110, 152, 1, 139, 70, 121, 19, 138, 10, 44, 6, 55, 140 , 242, 124, 143, 219, 172\n ], \n \"signatures\": [ \"fd82214a59c99d9251fa00126d353f9cf502a80d8993a6c223e3c802a40ab405555637f495903d3ba558312881e586d452e6e95826d8e128345f6c0a8f9f350e\", \"8c04ef50cf34afa3a9ec19c457143496f8cf7045ed869b581f9efa2f1d65e30f1cec5272b00e9c61a34bdd3c78cf82ae8ef4df3132f70861391069b9c255cd08\", ... ]\n}"], "untrusted": false }
Example 3: Returned a missed (unexisting) transaction.
curl -X POST http://127.0.0.1:18081/get_transactions -d '{"txs_hashes":["d6e48158472848e6687173a91ae6eebfa3e1d778e65252ee99d7515d63090409"]}' -H 'Content-Type: application/json' { "missed_tx": ["d6e48158472848e6687173a91ae6eebfa3e1d778e65252ee99d7515d63090409" ], "status": "OK", "untrusted": false }
/set_log_categories
Set the daemon log categories. Categories are represented as a comma separated list of :
(similar to standard syslog :
), where:
- category is one of the following:
- * – All facilities
- default
- net
- net.http
- net.p2p
- logging
- net.throttle
- blockchain.db
- blockchain.db.lmdb
- bcutil
- checkpoints
- net. dns
- net.dl
- i18n
- perfect
- stacktrace
- updates
- account
- cn
- difficulty
- hardforks
- miners
- blockchain
- txpool
- cn.block_queue
- net.cn
- daemon
- debugtools.deserialize
- debugtools.objectsizes
- device. ledger
- wallet.gen_multisig
- multisign
- bullet proofs
- ringct
- daemon.rpc
- wallet.simplewallet
- Wallet API
- wallet.ringdb
- wallet.wallet2
- wallet.rpc
- tests. core
- Level is one of the following:
- FATAL – higher level
- ERROR
- WARNING
- INFO
- DEBUG
- TRACE – lower level A level automatically includes higher level. By default, categories are set to
*:WARNING,net:FATAL,net.p2p:FATAL,net.cn:FATAL,global:INFO,verify:FATAL,stacktrace:INFO,logging:INFO,msgwriter:INFO
. Setting the categories to "" prevent any logs to be outputed.
Alias: It is not.
Inputs:
- categories –string; Optional, daemon log categories to enable
Outputs:
- categories –string; daemon log enabled categories
- status –string; General RPC error code. OK means everything looks good. Any other value means that something went wrong.
Example to set all facilities to Security Level info
:
$ curl -X POST http://127.0.0.1:18081/set_log_categories -d '{"categories": "*:INFO"}' -H 'Content-Type: application/json' { "categories": "*: INFO", "status": "OK" }
Example without input to set the default categories:
/update
Update daemons.
Alias: It is not.
Inputs:
- command –String; command to use, either
check
ordownloads
- path –String; Optional, path where to download the update.
Outputs:
- auto_uri –string;
- hashes –string;
- path –String; path to download the update
- status –string; General RPC error code. OK means everything looks good.
- update – boolean; States if an update is available to download (
true
) or not (false
) - user_uri –string;
- version –string; Version available for download.
Example:
/get_hashes.bin
Get hashes. Binary request.
Alias: /gethashes.bin.
Inputs:
- block_ids – binary array of hashes; first 10 blocks id goes sequential, next goes in pow(2,n) offset, like 2, 4, 8, 16, 32, 64 and so on, and the last one is always genesis block
- start_height – unsigned int
Outputs:
- current_height – unsigned int
- m_block_ids – binary array of hashes; if it's block_ids above.
- start_height – unsigned int
- status –string; General RPC error code. OK means everything looks good.
- untrusted – boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (
true
), or when the daemon is fully synced (false
).
/get_o_indexes.bin
Get global outputs of transactions. Binary request.
Alias: It is not.
Inputs:
- txid – binary txid
Outputs:
- o_indexes – array of unsigned ints; List of output indexes
- status –string; General RPC error code. OK means everything looks good.
- untrusted – boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (
true
), or when the daemon is fully synced (false
).
/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: It is not.
Inputs: It is not.
Outputs:
- spent_key_images – List of spent output key images:
- id_hash –string; Key image.
- txs_hashes – string list; tx hashes of the txes (usually one) spending that key image.
- status –string; General RPC error code. OK means everything looks good.
- transactions – List of transactions in the mempool are not in a block on the main chain at the moment:
- blob_size – unsigned int; The size of the full transaction blob.
- double_spend_seen – boolean; States if this transaction has been seen as double spend.
- do_not_relay; boolean; States if this transaction should not be relayed
- fee – unsigned int; The amount of the mining fee included in the transaction, in atomic units.
- id_hash –string; The transaction ID hash.
- kept_by_block – boolean; States if the tx was included in a block at least once (
true
) or not (false
). - last_failed_height – unsigned int; If the transaction validation has previously failed, this tells at what height that 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_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 – jsonstring; JSON structure of all information in the transaction:
- version – Transaction version
- unlock_time – If not 0, this tells when a transaction output is spendable.
- wine – List of inputs into transactions:
- key – The public key of the previous output spent in this transaction.
- amount – The amount of the input, in atomic units.
- key_offsets – A list of integer offsets to the input.
- k_image – The key image for the given input
- key – The public key of the previous output spent in this transaction.
- vout – List of outputs from transactions:
- amount – Amount of transaction output, in atomic units.
- target – Output destination information:
- key – The stealth public key of the receiver. Whoever owns the private key associated with this key controls this transaction output.
- extra – Usually called the “transaction ID” but can be used to include any random 32 bytes.
- rct_signatures – Ring signatures:
- type
- txn Fee
- ecdhInfo – array of Diffie Helman Elipctic curves structures as follows:
- mask – String
- amount – String
- outPk
- rctsig_prunable
- rangeSigs – array of structures as follows:
- asig
- There
- MGs – array of structures as follows:
- ss – array of arrays of two strings.
- cc – String
- rangeSigs – array of structures as follows:
Example (Note: Some lists in the returned information have been truncated for display reasons):
$ curl -X POST http://127.0.0.1:18081/get_transaction_pool -H 'Content-Type: application/json' { "spent_key_images": [{ "id_hash": "a2af919609db4ff5ab8d4ba18502e647d521760e1cbc30288f06fa87bf9a0c1c", "txs_hashes": ["1ee6a4873b638711795fc3b0b73fc7146505a09a7f4749534fd408d571a273cf" ] },{ "id_hash": "02d5f6559e9bca5ae5a335130aeeb05df2db518ab9837fa64ebbab276c100792", "txs_hashes": ["531aacc0ceb8514cdde5f104285202ccc3e969c77584e3c6fa614c987c583965"] }, ...], "status": "OK", "transactions": [{ "blob_size": 13193, "do_not_relay ": false, "double_spend_seen": false, "fee": 9694360000, "id_hash": "f8fb875cfc9e2e59bcf96a42474c79e01d50b69e6548d445d45984f7db66e50f", "kept_by_block": false, "last_failed_height": 0, "last_failed_id_hash": "0000000000000000000000000000000000000000000000000000000000000000", "last_relayed_time": 1525615049, "max_used_block_height": 1564924, "max_used_block_id_hash": "4bae7856979f46c7de31f3fb58cac36d4dfd2765bf33f876edf33d0e05ebb4a7", "receive_time": 1525615049, "relayed": true, "tx "", "_ "blob": "...\n\son": "jn\son": 2, \n \"unlock_time\": 0, \n \"vin\": [ {\n \"key\": {\n \"amount\": 0, \n \"key_offsets\": [ 2630347, 594429, 1047509, 758973, 464501, 61971, 22268\n ], \n \"k_image\": \"0731363c58dd4492f031fa20c82fe6ddcb9cc070d73938afe8a5f7f77897f8b4\"\n }\n }\n ], \n \"vout\": [ { \n \"amount\": 0, \n \"target\": {\n \"key\": \"f3b3dd09483616e343b9866eed50a0ce01d5c0d0f2612ce2c4d0e9cce5c218cd\"\n }\n }, {\n \"amount\": 0, \n \"target\": {\n \"key\": \"9796f2d477a696b6282bf3cb1a41cefba0c4604eedcc2e7a44904d7033643e0e\"\n }\n }\n ], \n \"extra\": [ 1, 25, 228, 80, 5 , 214, 117, 150, 9, 125, 98, 17, 113, 208, 89, 223, 242, 227, 188, 197, 141, 190, 135, 140, 152, 117, 240, 150, 21, 93 , 62, 108, 124\n ], \n \"rct_signatures\": {\n \"type\": 1, \n \"txnFee\": 9694360000, \n \"ecdhInfo\": [ {\ n \"mask\": \"645f06a2816aecf83d5041c3320eb31092b994fb2733bb74c8c47e288d452c04\", \n \"amount\": \"3908f14d39dcb3831331cb255eeadc5b0aea0143645b9cd3034abf613995740d\"\n }, {\n \"mask\": \"0785b5df0a994b14d59da810503a022721d8f629720f526e15bd848ad3c2c509\", \n \"amount \": \"fbd81cf2368dcd742905ded5287457030467aaf5bc9939e13f1d6bf8d4c8ca09\"\n }], \n \"outPk\": [ \"c19f5fa052859126e0eed0e3c860aadab049677b2b3dd14cc74d02f92f1d013f\", \"1581ef6368de1608ea366566b88272db220479cf215f6d88d7b60ec221d11e0a\"]\n }, \n \"rctsig_prunable\": {\n \ "rangeSigs\": [ {\n \"asig\": \" ... \", \n \"Ci\": \" .. \"\n }, {\n \"asig\": \" ... \", \n \"Ci\": \" ... \"\n }], \n \"MGs\": [ {\n \"ss\": [ [ \" 218a10a29e0f66e5a324af67b7734708a8a4cc8f16b28acd8cda538aaa495a02\", \"b368b4e956df5808c5c257f0dc3f7eff8c28463d0bb20759d19977fa02d6f205\"], [ \"f741d2c96bc23b362b4155a03fb6f1351ab5bf4445a43b3e52ba776f526af305\", \"a10ad1ee80dce3f311dd3dc141803daeecaa4d2a25a390cd9c35e4161b7c9e0c\"], ...], \n \"cc\": \"e93801b707261ca76e146fdf2085abae71ad9203a00edc843c74f4ead8a39601\"\n }]\n } \n}" }, ...] }
/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.
Alias: It is not.
Inputs: It is not.
Outputs:
- status –string; General RPC error code. OK means everything looks good. Any other value means that something went wrong.
Example:
/set_log_hash_rate
Set the log hash rate display mode.
Alias: It is not.
Inputs:
- 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. Any other value means that something went wrong.
Example while mining:
$ curl -X POST http://127.0.0.1:18081/set_log_hash_rate -d '{"visible":true}' -H 'Content-Type: application/json' { "status": "OK" }
Error while not mining: