Introduction¶
This is a list of the RPC calls, their inputs and outputs, and examples of each. This list is autogenerated and was last generated on: 2020-11-18
Many RPC calls use the JSON RPC interface while others use their own interfaces, as demonstrated below.
Note: "atomic units" refer to the smallest fraction of 1 LOKI which is 1e9 atomic units.
JSON¶
- BANNED
- FLUSH_CACHE
- FLUSH_TRANSACTION_POOL
- GENERATEBLOCKS
- GETBANS
- GETBLOCKCOUNT
- GETBLOCKHASH
- GETBLOCKTEMPLATE
- GET_ALTERNATE_CHAINS
- GET_BASE_FEE_ESTIMATE
- GET_BLOCK
- GET_BLOCK_HEADERS_RANGE
- GET_BLOCK_HEADER_BY_HASH
- GET_BLOCK_HEADER_BY_HEIGHT
- GET_CHECKPOINTS
- GET_COINBASE_TX_SUM
- GET_CONNECTIONS
- GET_HEIGHT
- GET_INFO
- GET_LAST_BLOCK_HEADER
- GET_LIMIT
- GET_NET_STATS
- GET_OUTPUTS
- GET_OUTPUT_DISTRIBUTION
- GET_OUTPUT_HISTOGRAM
- GET_PEER_LIST
- GET_PUBLIC_NODES
- GET_QUORUM_STATE
- GET_SERVICE_KEYS
- GET_SERVICE_NODES
- GET_SERVICE_NODE_BLACKLISTED_KEY_IMAGES
- GET_SERVICE_NODE_REGISTRATION_CMD
- GET_SERVICE_NODE_REGISTRATION_CMD_RAW
- GET_SERVICE_NODE_STATUS
- GET_SERVICE_PRIVKEYS
- GET_SN_STATE_CHANGES
- GET_STAKING_REQUIREMENT
- GET_TRANSACTIONS
- GET_TRANSACTION_POOL
- GET_TRANSACTION_POOL_BACKLOG
- GET_TRANSACTION_POOL_HASHES
- GET_TRANSACTION_POOL_STATS
- GET_VERSION
- HARD_FORK_INFO
- IN_PEERS
- IS_KEY_IMAGE_SPENT
- LNS_NAMES_TO_OWNERS
- LNS_OWNERS_TO_NAMES
- LNS_RESOLVE
- LOKINET_PING
- MINING_STATUS
- OUT_PEERS
- PERFORM_BLOCKCHAIN_TEST
- POP_BLOCKS
- PRUNE_BLOCKCHAIN
- RELAY_TX
- REPORT_PEER_SS_STATUS
- SAVE_BC
- SEND_RAW_TX
- SETBANS
- SET_BOOTSTRAP_DAEMON
- SET_LIMIT
- SET_LOG_CATEGORIES
- SET_LOG_HASH_RATE
- SET_LOG_LEVEL
- START_MINING
- STOP_DAEMON
- STOP_MINING
- STORAGE_SERVER_PING
- SUBMITBLOCK
- SYNC_INFO
Binary¶
- GET_ALT_BLOCKS_HASHES
- GET_BLOCKS_BY_HEIGHT
- GET_BLOCKS_FAST
- GET_HASHES_FAST
- GET_OUTPUTS_BIN
- GET_OUTPUT_BLACKLIST
- GET_OUTPUT_DISTRIBUTION_BIN
- GET_TRANSACTION_POOL_HASHES_BIN
- GET_TX_GLOBAL_OUTPUTS_INDEXES
JSON¶
BANNED¶
Determine whether a given IP address is banned
Endpoints: banned
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "banned",
"params": {
"address": "L8KJf3nRQ53NTX1YLjtHryjegFRa3ZCEGLKmRxUfvkBWK19UteEacVpYqpYscSJ2q8WRuHPFdk7Q5W8pQB7Py5kvUs8vKSk"
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"status": "OK",
"banned": true,
"seconds": 2130706433
}
}
Inputs:
address - string
: The IP address to check
Outputs:
status - string
: General RPC error code. "OK" means everything looks good.banned - bool
: True if the given address is banned, false otherwise.seconds - uint32
: The number of seconds remaining in the ban.
FLUSH_CACHE¶
Clear TXs from the daemon cache, currently only the cache storing TX hashes that were previously verified bad by the daemon.
Endpoints: flush_cache
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "flush_cache",
"params": {
"bad_txs": true,
"bad_blocks": true
}
}
EOF
Inputs:
bad_txs - bool
: Clear the cache storing TXs that failed verification.bad_blocks - bool
: Clear the cache storing blocks that failed verfication.
FLUSH_TRANSACTION_POOL¶
Flush tx ids from transaction pool..
Endpoints: flush_txpool
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "flush_txpool",
"params": {
"txids": ["b605cab7e3b9fe1f6d322e3167cd26e1e61c764afa9d733233ef716787786123"]
}
}
EOF
Inputs:
txids - string[]
: Optional, list of transactions IDs to flush from pool (all tx ids flushed if empty).
GENERATEBLOCKS¶
Developer only.
Endpoints: generateblocks
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "generateblocks",
"params": {
"amount_of_blocks": 123,
"wallet_address": "L8KJf3nRQ53NTX1YLjtHryjegFRa3ZCEGLKmRxUfvkBWK19UteEacVpYqpYscSJ2q8WRuHPFdk7Q5W8pQB7Py5kvUs8vKSk",
"prev_block": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"starting_nonce": 2130706433
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"height": 234767,
"blocks": ["bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70"],
"status": "OK"
}
}
Inputs:
amount_of_blocks - uint64
wallet_address - string
prev_block - string
starting_nonce - uint32
Outputs:
height - uint64
blocks - string[]
status - string
: General RPC error code. "OK" means everything looks good.
GETBANS¶
Get list of banned IPs.
Endpoints: get_bans
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_bans"
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"status": "OK",
"bans": [{
"host": "127.0.0.1",
"ip": 2130706433,
"seconds": 2130706433
}]
}
}
Outputs:
status - string
: General RPC error code. "OK" means everything looks good.bans - ban[]
: List of banned nodes:host - string
: Banned host (IP in A.B.C.D form).ip - uint32
: Banned IP address, in Int format.seconds - uint32
: Local Unix time that IP is banned until.
GETBLOCKCOUNT¶
Look up how many blocks are in the longest chain known to the node.
Endpoints: get_block_count, getblockcount
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_block_count"
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"count": 123,
"status": "OK"
}
}
Outputs:
count - uint64
: Number of blocks in longest chain seen by the node.status - string
: General RPC error code. "OK" means everything looks good.
GETBLOCKHASH¶
Look up a block's hash by its height.
Endpoints: get_block_hash, on_get_block_hash, on_getblockhash
Constants:
* `response - string`: Block hash (string).
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_block_hash",
"params": {
"height": [234767]
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": "061e5b4734c5e338c1d2a25acb007d806725e51cdb2aa8aac17101afd60cd002"
}
Inputs:
height - uint64[]
: Block height (int array of length 1).
Outputs:
result - string
: Block hash (string).
GETBLOCKTEMPLATE¶
Get a block template on which mining a new block.
Endpoints: get_block_template, getblocktemplate
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_block_template",
"params": {
"reserve_size": 123,
"wallet_address": "L8KJf3nRQ53NTX1YLjtHryjegFRa3ZCEGLKmRxUfvkBWK19UteEacVpYqpYscSJ2q8WRuHPFdk7Q5W8pQB7Py5kvUs8vKSk",
"prev_block": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"extra_nonce": "TODO(loki): Write example string"
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"difficulty": 123,
"height": 234767,
"reserved_offset": 123,
"expected_reward": 123,
"prev_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"seed_hash": "b605cab7e3b9fe1f6d322e3167cd26e1e61c764afa9d733233ef716787786123",
"next_seed_hash": "b605cab7e3b9fe1f6d322e3167cd26e1e61c764afa9d733233ef716787786123",
"blocktemplate_blob": "sd2b5f838e8cc7774d92f5a6ce0d72cb9bd8db2ef28948087f8a50ff46d188dd9",
"blockhashing_blob": "sd2b5f838e8cc7774d92f5a6ce0d72cb9bd8db2ef28948087f8a50ff46d188dd9",
"status": "OK",
"untrusted": false
}
}
Inputs:
reserve_size - uint64
: Max 255 byteswallet_address - string
: Address of wallet to receive coinbase transactions if block is successfully mined.prev_block - string
extra_nonce - string
Outputs:
difficulty - uint64
: Difficulty of next block.height - uint64
: Height on which to mine.reserved_offset - uint64
: Reserved offset.expected_reward - uint64
: Coinbase reward expected to be received if block is successfully mined.prev_hash - string
: Hash of the most recent block on which to mine the next block.seed_hash - string
: RandomX current seed hashnext_seed_hash - string
: RandomX upcoming seed hashblocktemplate_blob - string
: Blob on which to try to mine a new block.blockhashing_blob - string
: Blob on which to try to find a valid nonce.status - string
: General RPC error code. "OK" means everything looks good.untrusted - bool
: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true
), or when the daemon is fully synced (false
).
GET_ALTERNATE_CHAINS¶
Display alternative chains seen by the node.
Endpoints: get_alternative_chains
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_alternative_chains"
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"status": "OK",
"chains": [{
"block_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"height": 234767,
"length": 123,
"difficulty": 123,
"block_hashes": ["bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70"],
"main_chain_parent_block": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70"
}]
}
}
Outputs:
status - string
: General RPC error code. "OK" means everything looks good.chains - chain_info[]
: Array of Chains.block_hash - string
: The block hash of the first diverging block of this alternative chain.height - uint64
: The block height of the first diverging block of this alternative chain.length - uint64
: The length in blocks of this alternative chain, after divergence.difficulty - uint64
: The cumulative difficulty of all blocks in the alternative chain.block_hashes - string[]
main_chain_parent_block - string
GET_BASE_FEE_ESTIMATE¶
Gives an estimation of per-output + per-byte fees
Endpoints: get_fee_estimate
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_fee_estimate",
"params": {
"grace_blocks": 123
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"status": "OK",
"fee_per_byte": 123,
"fee_per_output": 123,
"blink_fee_per_byte": 123,
"blink_fee_per_output": 123,
"blink_fee_fixed": 123,
"quantization_mask": 123,
"untrusted": false
}
}
Inputs:
grace_blocks - uint64
: Optional
Outputs:
status - string
: General RPC error code. "OK" means everything looks good.fee_per_byte - uint64
: Amount of fees estimated per byte in atomic unitsfee_per_output - uint64
: Amount of fees per output generated by the tx (adds to thefee_per_byte
per-byte value)blink_fee_per_byte - uint64
:fee_per_byte
value for sending a blink. The portion of the overall blink fee above the overall base fee is burned.blink_fee_per_output - uint64
:fee_per_output
value for sending a blink. The portion of the overall blink fee above the overall base fee is burned.blink_fee_fixed - uint64
: Fixed blink fee in addition to the per-output and per-byte amounts. The portion of the overall blink fee above the overall base fee is burned.quantization_mask - uint64
untrusted - bool
: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true
), or when the daemon is fully synced (false
).
GET_BLOCK¶
Full block information can be retrieved by either block height or hash, like with the above block header calls.
For full block information, both lookups use the same method, but with different input parameters.
Endpoints: get_block, getblock
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_block",
"params": {
"hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"height": 234767,
"fill_pow_hash": true
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"status": "OK",
"block_header": {
"major_version": 11,
"minor_version": 11,
"timestamp": 123,
"prev_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"nonce": 2130706433,
"orphan_status": true,
"height": 234767,
"depth": 123,
"hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"difficulty": 25179406071,
"cumulative_difficulty": 25179406071,
"reward": 123,
"miner_reward": 123,
"block_size": 123,
"block_weight": 123,
"num_txes": 123,
"pow_hash": ["bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70"],
"long_term_weight": 123,
"miner_tx_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"tx_hashes": ["b605cab7e3b9fe1f6d322e3167cd26e1e61c764afa9d733233ef716787786123"],
"service_node_winner": "4a8c30cea9e729b06c91132295cce32d2a8e6e5bcf7b74a998e2ee1b3ed590b3"
},
"tx_hashes": ["b605cab7e3b9fe1f6d322e3167cd26e1e61c764afa9d733233ef716787786123"],
"blob": "0b0b85819be50599a27f959e4bf53d6ed1d862958ae9734bb53e2a3c9085c74dc9a64f1ffe7ecbac5c003b02bae50e01ff9ce50e02c6e5b7be3b02599dd5dd36f71ea8baaf0cdf06487954cdeefc08c4a015deabccfd322c539f6a85ffbd8c4202d568949320e96569773b68bf4a081bed23b7c18c8e0fcd12007e922f2b361deea301019d4c141e08ec3a567a179d544ee6c0fe5b301482c052e7f1b8fda08253dc8f19032100de2de1e442cbe12171e1e4a02acb1fb2f19d1edf1b34ea46beab4aa84a3b8c1e021b00000000000000000000000008b742a096fc00000000000000000001cff3b81be28f27c7967ace59ad6d4117bb59beb45b42b6e6628550de36e41e4372639c05971665ab70273c8a0827397f82face8f18c0380901e425554606a4a90a0000",
"json": "{\n \"major_version\": 11, \n \"minor_version\": 11, \n \"timestamp\": 1554432133, \n \"prev_id\": \"99a27f959e4bf53d6ed1d862958ae9734bb53e2a3c9085c74dc9a64f1ffe7ecb\", \n \"nonce\": 989879468, \n \"miner_tx\": {\n \"version\": 2, \n \"unlock_time\": 242362, \n \"vin\": [ {\n \"gen\": {\n \"height\": 242332\n }\n }\n ], \n \"vout\": [ {\n \"amount\": 15968629446, \n \"target\": {\n \"key\": \"599dd5dd36f71ea8baaf0cdf06487954cdeefc08c4a015deabccfd322c539f6a\"\n }\n }, {\n \"amount\": 17742921605, \n \"target\": {\n \"key\": \"d568949320e96569773b68bf4a081bed23b7c18c8e0fcd12007e922f2b361dee\"\n }\n }\n ], \n \"extra\": [ 1, 157, 76, 20, 30, 8, 236, 58, 86, 122, 23, 157, 84, 78, 230, 192, 254, 91, 48, 20, 130, 192, 82, 231, 241, 184, 253, 160, 130, 83, 220, 143, 25, 3, 33, 0, 222, 45, 225, 228, 66, 203, 225, 33, 113, 225, 228, 160, 42, 203, 31, 178, 241, 157, 30, 223, 27, 52, 234, 70, 190, 171, 74, 168, 74, 59, 140, 30, 2, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 183, 66, 160, 150, 252, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 207, 243, 184, 27, 226, 143, 39, 199, 150, 122, 206, 89, 173, 109, 65, 23, 187, 89, 190, 180, 91, 66, 182, 230, 98, 133,80, 222, 54, 228, 30, 67, 114, 99, 156, 5, 151, 22, 101, 171, 112, 39, 60, 138, 8, 39, 57, 127, 130, 250, 206, 143, 24, 192, 56, 9, 1, 228, 37, 85, 70, 6, 164, 169, 10\n], \n \"rct_signatures\": {\n \"type\": 0\n }\n }, \n \"tx_hashes\": [ ]\n}",
"untrusted": false
}
}
Inputs:
hash - string
: The block's hash.height - uint64
: The block's height.fill_pow_hash - bool
: Tell the daemon if it should fill out pow_hash field.
Outputs:
status - string
: General RPC error code. "OK" means everything looks good.block_header - block_header_response
: A structure containing block header information. See get_last_block_header.major_version - uint8
: The major version of the loki protocol at this block height.minor_version - uint8
: The minor version of the loki protocol at this block height.timestamp - uint64
: The unix time at which the block was recorded into the blockchain.prev_hash - string
: The hash of the block immediately preceding this block in the chain.nonce - uint32
: A cryptographic random one-time number used in mining a Loki block.orphan_status - bool
: Usuallyfalse
. Iftrue
, this block is not part of the longest chain.height - uint64
: The number of blocks preceding this block on the blockchain.depth - uint64
: The number of blocks succeeding this block on the blockchain. A larger number means an older block.hash - string
: The hash of this block.difficulty - uint64
: The strength of the Loki network based on mining power.cumulative_difficulty - uint64
: The cumulative strength of the Loki network based on mining power.reward - uint64
: The amount of new generated in this block and rewarded to the miner, foundation and service Nodes. Note: 1 LOKI = 1e9 atomic units.miner_reward - uint64
: The amount of new generated in this block and rewarded to the miner. Note: 1 LOKI = 1e9 atomic units.block_size - uint64
: The block size in bytes.block_weight - uint64
: The block weight in bytes.num_txes - uint64
: Number of transactions in the block, not counting the coinbase tx.pow_hash - string[]
: The hash of the block's proof of work (requiresfill_pow_hash
)long_term_weight - uint64
: Long term weight of the block.miner_tx_hash - string
: The TX hash of the miner transactiontx_hashes - string[]
: The TX hashes of all non-coinbase transactions (requiresget_tx_hashes
)service_node_winner - string
: Service node that received a reward for this blocktx_hashes - string[]
: List of hashes of non-coinbase transactions in the block. If there are no other transactions, this will be an empty list.blob - string
: Hexadecimal blob of block information.json - string
: JSON formatted block details.untrusted - bool
: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true
), or when the daemon is fully synced (false
).
GET_BLOCK_HEADERS_RANGE¶
Similar to get_block_header_by_height above, but for a range of blocks.
This method includes a starting block height and an ending block height as
parameters to retrieve basic information about the range of blocks.
Endpoints: get_block_headers_range, getblockheadersrange
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_block_headers_range",
"params": {
"start_height": 123,
"end_height": 123,
"fill_pow_hash": true,
"get_tx_hashes": true
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"status": "OK",
"headers": [{
"major_version": 11,
"minor_version": 11,
"timestamp": 123,
"prev_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"nonce": 2130706433,
"orphan_status": true,
"height": 234767,
"depth": 123,
"hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"difficulty": 25179406071,
"cumulative_difficulty": 25179406071,
"reward": 123,
"miner_reward": 123,
"block_size": 123,
"block_weight": 123,
"num_txes": 123,
"pow_hash": ["bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70"],
"long_term_weight": 123,
"miner_tx_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"tx_hashes": ["b605cab7e3b9fe1f6d322e3167cd26e1e61c764afa9d733233ef716787786123"],
"service_node_winner": "4a8c30cea9e729b06c91132295cce32d2a8e6e5bcf7b74a998e2ee1b3ed590b3"
}],
"untrusted": false
}
}
Inputs:
start_height - uint64
: The starting block's height.end_height - uint64
: The ending block's height.fill_pow_hash - bool
: Tell the daemon if it should fill out pow_hash field.get_tx_hashes - bool
: If true (default false) then include the hashes or txes in the block details
Outputs:
status - string
: General RPC error code. "OK" means everything looks good.headers - block_header_response[]
: Array of block_header (a structure containing block header information. See get_last_block_header).major_version - uint8
: The major version of the loki protocol at this block height.minor_version - uint8
: The minor version of the loki protocol at this block height.timestamp - uint64
: The unix time at which the block was recorded into the blockchain.prev_hash - string
: The hash of the block immediately preceding this block in the chain.nonce - uint32
: A cryptographic random one-time number used in mining a Loki block.orphan_status - bool
: Usuallyfalse
. Iftrue
, this block is not part of the longest chain.height - uint64
: The number of blocks preceding this block on the blockchain.depth - uint64
: The number of blocks succeeding this block on the blockchain. A larger number means an older block.hash - string
: The hash of this block.difficulty - uint64
: The strength of the Loki network based on mining power.cumulative_difficulty - uint64
: The cumulative strength of the Loki network based on mining power.reward - uint64
: The amount of new generated in this block and rewarded to the miner, foundation and service Nodes. Note: 1 LOKI = 1e9 atomic units.miner_reward - uint64
: The amount of new generated in this block and rewarded to the miner. Note: 1 LOKI = 1e9 atomic units.block_size - uint64
: The block size in bytes.block_weight - uint64
: The block weight in bytes.num_txes - uint64
: Number of transactions in the block, not counting the coinbase tx.pow_hash - string[]
: The hash of the block's proof of work (requiresfill_pow_hash
)long_term_weight - uint64
: Long term weight of the block.miner_tx_hash - string
: The TX hash of the miner transactiontx_hashes - string[]
: The TX hashes of all non-coinbase transactions (requiresget_tx_hashes
)service_node_winner - string
: Service node that received a reward for this blockuntrusted - bool
: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true
), or when the daemon is fully synced (false
).
GET_BLOCK_HEADER_BY_HASH¶
Block header information can be retrieved using either a block's hash or height. This method includes a block's hash as an input parameter to retrieve basic information about the block.
Endpoints: get_block_header_by_hash, getblockheaderbyhash
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_block_header_by_hash",
"params": {
"hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"hashes": ["TODO(loki): Write example string"],
"fill_pow_hash": true,
"get_tx_hashes": true
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"status": "OK",
"block_header": [{
"major_version": 11,
"minor_version": 11,
"timestamp": 123,
"prev_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"nonce": 2130706433,
"orphan_status": true,
"height": 234767,
"depth": 123,
"hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"difficulty": 25179406071,
"cumulative_difficulty": 25179406071,
"reward": 123,
"miner_reward": 123,
"block_size": 123,
"block_weight": 123,
"num_txes": 123,
"pow_hash": ["bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70"],
"long_term_weight": 123,
"miner_tx_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"tx_hashes": ["b605cab7e3b9fe1f6d322e3167cd26e1e61c764afa9d733233ef716787786123"],
"service_node_winner": "4a8c30cea9e729b06c91132295cce32d2a8e6e5bcf7b74a998e2ee1b3ed590b3"
}],
"block_headers": [{
"major_version": 11,
"minor_version": 11,
"timestamp": 123,
"prev_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"nonce": 2130706433,
"orphan_status": true,
"height": 234767,
"depth": 123,
"hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"difficulty": 25179406071,
"cumulative_difficulty": 25179406071,
"reward": 123,
"miner_reward": 123,
"block_size": 123,
"block_weight": 123,
"num_txes": 123,
"pow_hash": ["bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70"],
"long_term_weight": 123,
"miner_tx_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"tx_hashes": ["b605cab7e3b9fe1f6d322e3167cd26e1e61c764afa9d733233ef716787786123"],
"service_node_winner": "4a8c30cea9e729b06c91132295cce32d2a8e6e5bcf7b74a998e2ee1b3ed590b3"
}],
"untrusted": false
}
}
Inputs:
hash - string
: The block's SHA256 hash.hashes - string[]
: Request multiple blocks via an array of hashesfill_pow_hash - bool
: Tell the daemon if it should fill out pow_hash field.get_tx_hashes - bool
: If true (default false) then include the hashes of non-coinbase transactions
Outputs:
status - string
: General RPC error code. "OK" means everything looks good.block_header - block_header_response[]
: Block header information for the requestedhash
blockmajor_version - uint8
: The major version of the loki protocol at this block height.minor_version - uint8
: The minor version of the loki protocol at this block height.timestamp - uint64
: The unix time at which the block was recorded into the blockchain.prev_hash - string
: The hash of the block immediately preceding this block in the chain.nonce - uint32
: A cryptographic random one-time number used in mining a Loki block.orphan_status - bool
: Usuallyfalse
. Iftrue
, this block is not part of the longest chain.height - uint64
: The number of blocks preceding this block on the blockchain.depth - uint64
: The number of blocks succeeding this block on the blockchain. A larger number means an older block.hash - string
: The hash of this block.difficulty - uint64
: The strength of the Loki network based on mining power.cumulative_difficulty - uint64
: The cumulative strength of the Loki network based on mining power.reward - uint64
: The amount of new generated in this block and rewarded to the miner, foundation and service Nodes. Note: 1 LOKI = 1e9 atomic units.miner_reward - uint64
: The amount of new generated in this block and rewarded to the miner. Note: 1 LOKI = 1e9 atomic units.block_size - uint64
: The block size in bytes.block_weight - uint64
: The block weight in bytes.num_txes - uint64
: Number of transactions in the block, not counting the coinbase tx.pow_hash - string[]
: The hash of the block's proof of work (requiresfill_pow_hash
)long_term_weight - uint64
: Long term weight of the block.miner_tx_hash - string
: The TX hash of the miner transactiontx_hashes - string[]
: The TX hashes of all non-coinbase transactions (requiresget_tx_hashes
)service_node_winner - string
: Service node that received a reward for this blockblock_headers - block_header_response[]
: Block header information for the requestedhashes
blocksmajor_version - uint8
: The major version of the loki protocol at this block height.minor_version - uint8
: The minor version of the loki protocol at this block height.timestamp - uint64
: The unix time at which the block was recorded into the blockchain.prev_hash - string
: The hash of the block immediately preceding this block in the chain.nonce - uint32
: A cryptographic random one-time number used in mining a Loki block.orphan_status - bool
: Usuallyfalse
. Iftrue
, this block is not part of the longest chain.height - uint64
: The number of blocks preceding this block on the blockchain.depth - uint64
: The number of blocks succeeding this block on the blockchain. A larger number means an older block.hash - string
: The hash of this block.difficulty - uint64
: The strength of the Loki network based on mining power.cumulative_difficulty - uint64
: The cumulative strength of the Loki network based on mining power.reward - uint64
: The amount of new generated in this block and rewarded to the miner, foundation and service Nodes. Note: 1 LOKI = 1e9 atomic units.miner_reward - uint64
: The amount of new generated in this block and rewarded to the miner. Note: 1 LOKI = 1e9 atomic units.block_size - uint64
: The block size in bytes.block_weight - uint64
: The block weight in bytes.num_txes - uint64
: Number of transactions in the block, not counting the coinbase tx.pow_hash - string[]
: The hash of the block's proof of work (requiresfill_pow_hash
)long_term_weight - uint64
: Long term weight of the block.miner_tx_hash - string
: The TX hash of the miner transactiontx_hashes - string[]
: The TX hashes of all non-coinbase transactions (requiresget_tx_hashes
)service_node_winner - string
: Service node that received a reward for this blockuntrusted - bool
: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true
), or when the daemon is fully synced (false
).
GET_BLOCK_HEADER_BY_HEIGHT¶
Similar to get_block_header_by_hash above, this method includes a block's height as an input parameter to retrieve basic information about the block.
Endpoints: get_block_header_by_height, getblockheaderbyheight
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_block_header_by_height",
"params": {
"height": [234767],
"heights": [123],
"fill_pow_hash": true,
"get_tx_hashes": true
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"status": "OK",
"block_header": [{
"major_version": 11,
"minor_version": 11,
"timestamp": 123,
"prev_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"nonce": 2130706433,
"orphan_status": true,
"height": 234767,
"depth": 123,
"hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"difficulty": 25179406071,
"cumulative_difficulty": 25179406071,
"reward": 123,
"miner_reward": 123,
"block_size": 123,
"block_weight": 123,
"num_txes": 123,
"pow_hash": ["bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70"],
"long_term_weight": 123,
"miner_tx_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"tx_hashes": ["b605cab7e3b9fe1f6d322e3167cd26e1e61c764afa9d733233ef716787786123"],
"service_node_winner": "4a8c30cea9e729b06c91132295cce32d2a8e6e5bcf7b74a998e2ee1b3ed590b3"
}],
"block_headers": [{
"major_version": 11,
"minor_version": 11,
"timestamp": 123,
"prev_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"nonce": 2130706433,
"orphan_status": true,
"height": 234767,
"depth": 123,
"hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"difficulty": 25179406071,
"cumulative_difficulty": 25179406071,
"reward": 123,
"miner_reward": 123,
"block_size": 123,
"block_weight": 123,
"num_txes": 123,
"pow_hash": ["bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70"],
"long_term_weight": 123,
"miner_tx_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"tx_hashes": ["b605cab7e3b9fe1f6d322e3167cd26e1e61c764afa9d733233ef716787786123"],
"service_node_winner": "4a8c30cea9e729b06c91132295cce32d2a8e6e5bcf7b74a998e2ee1b3ed590b3"
}],
"untrusted": false
}
}
Inputs:
height - uint64[]
: A block height to look up; returned inblock_header
heights - uint64[]
: Block heights to retrieve; returned inblock_headers
fill_pow_hash - bool
: Tell the daemon if it should fill out pow_hash field.get_tx_hashes - bool
: If true (default false) then include the hashes of non-coinbase transactions
Outputs:
status - string
: General RPC error code. "OK" means everything looks good.block_header - block_header_response[]
: Block header information for the requestedheight
blockmajor_version - uint8
: The major version of the loki protocol at this block height.minor_version - uint8
: The minor version of the loki protocol at this block height.timestamp - uint64
: The unix time at which the block was recorded into the blockchain.prev_hash - string
: The hash of the block immediately preceding this block in the chain.nonce - uint32
: A cryptographic random one-time number used in mining a Loki block.orphan_status - bool
: Usuallyfalse
. Iftrue
, this block is not part of the longest chain.height - uint64
: The number of blocks preceding this block on the blockchain.depth - uint64
: The number of blocks succeeding this block on the blockchain. A larger number means an older block.hash - string
: The hash of this block.difficulty - uint64
: The strength of the Loki network based on mining power.cumulative_difficulty - uint64
: The cumulative strength of the Loki network based on mining power.reward - uint64
: The amount of new generated in this block and rewarded to the miner, foundation and service Nodes. Note: 1 LOKI = 1e9 atomic units.miner_reward - uint64
: The amount of new generated in this block and rewarded to the miner. Note: 1 LOKI = 1e9 atomic units.block_size - uint64
: The block size in bytes.block_weight - uint64
: The block weight in bytes.num_txes - uint64
: Number of transactions in the block, not counting the coinbase tx.pow_hash - string[]
: The hash of the block's proof of work (requiresfill_pow_hash
)long_term_weight - uint64
: Long term weight of the block.miner_tx_hash - string
: The TX hash of the miner transactiontx_hashes - string[]
: The TX hashes of all non-coinbase transactions (requiresget_tx_hashes
)service_node_winner - string
: Service node that received a reward for this blockblock_headers - block_header_response[]
: Block header information for the requestedheights
blocksmajor_version - uint8
: The major version of the loki protocol at this block height.minor_version - uint8
: The minor version of the loki protocol at this block height.timestamp - uint64
: The unix time at which the block was recorded into the blockchain.prev_hash - string
: The hash of the block immediately preceding this block in the chain.nonce - uint32
: A cryptographic random one-time number used in mining a Loki block.orphan_status - bool
: Usuallyfalse
. Iftrue
, this block is not part of the longest chain.height - uint64
: The number of blocks preceding this block on the blockchain.depth - uint64
: The number of blocks succeeding this block on the blockchain. A larger number means an older block.hash - string
: The hash of this block.difficulty - uint64
: The strength of the Loki network based on mining power.cumulative_difficulty - uint64
: The cumulative strength of the Loki network based on mining power.reward - uint64
: The amount of new generated in this block and rewarded to the miner, foundation and service Nodes. Note: 1 LOKI = 1e9 atomic units.miner_reward - uint64
: The amount of new generated in this block and rewarded to the miner. Note: 1 LOKI = 1e9 atomic units.block_size - uint64
: The block size in bytes.block_weight - uint64
: The block weight in bytes.num_txes - uint64
: Number of transactions in the block, not counting the coinbase tx.pow_hash - string[]
: The hash of the block's proof of work (requiresfill_pow_hash
)long_term_weight - uint64
: Long term weight of the block.miner_tx_hash - string
: The TX hash of the miner transactiontx_hashes - string[]
: The TX hashes of all non-coinbase transactions (requiresget_tx_hashes
)service_node_winner - string
: Service node that received a reward for this blockuntrusted - bool
: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true
), or when the daemon is fully synced (false
).
GET_CHECKPOINTS¶
Query hardcoded/service node checkpoints stored for the blockchain. Omit all arguments to retrieve the latest "count" checkpoints.
Endpoints: get_checkpoints
Constants:
* `MAX_COUNT - uint64 = 25`
* `NUM_CHECKPOINTS_TO_QUERY_BY_DEFAULT - uint32 = 6`
* `HEIGHT_SENTINEL_VALUE - uint64 = std::numeric_limits<uint64_t>::max() - `
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_checkpoints",
"params": {
"start_height": 123,
"end_height": 123,
"count": 2130706433
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"checkpoints": [{
"version": 11,
"type": "ServiceNode",
"height": 234767,
"block_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"signatures": [{
"voter_index": 12345,
"signature": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70"
}],
"prev_height": 123
}],
"status": "OK",
"untrusted": false
}
}
Inputs:
start_height - uint64
: Optional: Get the first count checkpoints starting from this height. Specify both start and end to get the checkpoints inbetween.end_height - uint64
: Optional: Get the first count checkpoints before end height. Specify both start and end to get the checkpoints inbetween.count - uint32
: Optional: Number of checkpoints to query.
Outputs:
checkpoints - checkpoint_serialized[]
: Array of requested checkpointsversion - uint8
type - string
: Either "Hardcoded" or "ServiceNode" for checkpoints generated by Service Nodes or declared in the codeheight - uint64
: The height the checkpoint is relevant forblock_hash - string
: The block hash the checkpoint is specifyingsignatures - quorum_signature_serialized[]
: Signatures from Service Nodes who agree on the block hashvoter_index - uint16
: Index of the voter in the relevant quorumsignature - string
: The signature generated by the voter in the quorum
prev_height - uint64
: The previous height the checkpoint is based offstatus - string
: Generic RPC error code. "OK" is the success value.untrusted - bool
: If the result is obtained using bootstrap mode, and therefore not trustedtrue
, or otherwisefalse
.
GET_COINBASE_TX_SUM¶
Get the coinbase amount and the fees amount for n last blocks starting at particular height.
Endpoints: get_coinbase_tx_sum
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_coinbase_tx_sum",
"params": {
"height": 234767,
"count": 123
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"status": "OK",
"emission_amount": 123,
"fee_amount": 123,
"burn_amount": 123
}
}
Inputs:
height - uint64
: Block height from which getting the amounts.count - uint64
: Number of blocks to include in the sum.
Outputs:
status - string
: General RPC error code. "OK" means everything looks good.emission_amount - uint64
: Amount of coinbase reward in atomic units.fee_amount - uint64
: Amount of fees in atomic units.burn_amount - uint64
: Amount of burnt loki.
GET_CONNECTIONS¶
Retrieve information about incoming and outgoing connections to your node.
Endpoints: get_connections
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_connections"
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"status": "OK",
"connections": [[{"address":"144.76.210.174:22243","address_type":1,"avg_download":0,"avg_upload":0,"connection_id":"5a4f1c03419641da9edb2fe6dcfec087","current_download":0,"current_upload":0,"height":0,"host":"144.76.210.174","incoming":false,"ip":"144.76.210.174","live_time":1,"local_ip":false,"localhost":false,"peer_id":"0","port":"22243","pruning_seed":0,"recv_count":0,"recv_idle_time":1,"rpc_port":0,"send_count":289,"send_idle_time":1,"state":"before_handshake","support_flags":0},{"address":"68.183.185.243:22022","address_type":1,"avg_download":38,"avg_upload":2,"connection_id":"6bb6e4412ad642bcbfb0e56a522da541","current_download":8,"current_upload":0,"height":532169,"host":"68.183.185.243","incoming":false,"ip":"68.183.185.243","live_time":2,"local_ip":false,"localhost":false,"peer_id":"3c9e48b830f60241","port":"22022","pruning_seed":0,"recv_count":79507,"recv_idle_time":1,"rpc_port":0,"send_count":4663,"send_idle_time":1,"state":"synchronizing","support_flags":1}]]
}
}
Outputs:
status - string
: General RPC error code. "OK" means everything looks good.connections - connection_info[]
: List of all connections and their info:
GET_HEIGHT¶
Get the node's current height.
Endpoints: get_height, getheight
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_height"
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"height": 234767,
"status": "OK",
"untrusted": false,
"hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"immutable_height": 123,
"immutable_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70"
}
}
Outputs:
height - uint64
: The current blockchain height according to the queried daemon.status - string
: Generic RPC error code. "OK" is the success value.untrusted - bool
: If the result is obtained using bootstrap mode, and therefore not trustedtrue
, or otherwisefalse
.hash - string
: Hash of the block at the current heightimmutable_height - uint64
: The latest height in the blockchain that can not be reorganized from (backed by atleast 2 Service Node, or 1 hardcoded checkpoint, 0 if N/A).immutable_hash - string
: Hash of the highest block in the chain that can not be reorganized.
GET_INFO¶
Retrieve general information about the state of your node and the network.
Note that all of the std::optional<> fields here are not included if the request is a public
(restricted) RPC request.
Endpoints: get_info, getinfo
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_info"
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"status": "OK",
"height": 234767,
"target_height": 123,
"immutable_height": 123,
"pulse_ideal_timestamp": 123,
"pulse_target_timestamp": 123,
"difficulty": 123,
"target": 123,
"tx_count": 123,
"tx_pool_size": 123,
"alt_blocks_count": [123],
"outgoing_connections_count": [123],
"incoming_connections_count": [123],
"white_peerlist_size": [123],
"grey_peerlist_size": [123],
"mainnet": true,
"testnet": true,
"devnet": true,
"nettype": "MAINNET",
"top_block_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"immutable_block_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"cumulative_difficulty": 123,
"block_size_limit": 123,
"block_weight_limit": 123,
"block_size_median": 123,
"block_weight_median": 123,
"service_node": [true],
"start_time": [123],
"last_storage_server_ping": [123],
"last_lokinet_ping": [123],
"free_space": [123],
"offline": true,
"untrusted": false,
"bootstrap_daemon_address": ["127.0.0.1:22023"],
"height_without_bootstrap": [123],
"was_bootstrap_ever_used": [true],
"database_size": 123,
"version": "7",
"status_line": "v15; Height: 531686"
}
}
Outputs:
status - string
: General RPC error code. "OK" means everything looks good.height - uint64
: Current length of longest chain known to daemon.target_height - uint64
: The height of the next block in the chain.immutable_height - uint64
: The latest height in the blockchain that can not be reorganized from (backed by atleast 2 Service Node, or 1 hardcoded checkpoint, 0 if N/A).pulse_ideal_timestamp - uint64
: For pulse blocks this is the ideal timestamp of the next block, that is, the timestamp if the network was operating with perfect 2-minute blocks since the pulse hard fork.pulse_target_timestamp - uint64
: For pulse blocks this is the target timestamp of the next block, which targets 2 minutes after the previous block but will be slightly faster/slower if the previous block is behind/ahead of the ideal timestamp.difficulty - uint64
: Network difficulty (analogous to the strength of the network).target - uint64
: Current target for next proof of work.tx_count - uint64
: Total number of non-coinbase transaction in the chain.tx_pool_size - uint64
: Number of transactions that have been broadcast but not included in a block.alt_blocks_count - uint64[]
: Number of alternative blocks to main chain.outgoing_connections_count - uint64[]
: Number of peers that you are connected to and getting information from.incoming_connections_count - uint64[]
: Number of peers connected to and pulling from your node.white_peerlist_size - uint64[]
: White Peerlist Sizegrey_peerlist_size - uint64[]
: Grey Peerlist Sizemainnet - bool
: States if the node is on the mainnet (true
) or not (false
).testnet - bool
: States if the node is on the testnet (true
) or not (false
).devnet - bool
: States if the node is on the devnet (true
) or not (false
).nettype - string
: Nettype value used.top_block_hash - string
: Hash of the highest block in the chain.immutable_block_hash - string
: Hash of the highest block in the chain that can not be reorganized.cumulative_difficulty - uint64
: Cumulative difficulty of all blocks in the blockchain.block_size_limit - uint64
: Maximum allowed block size.block_weight_limit - uint64
: Maximum allowed block weight.block_size_median - uint64
: Median block size of latest 100 blocks.block_weight_median - uint64
: Median block weight of latest 100 blocks.service_node - bool[]
: Will be true if the node is running in --service-node mode.start_time - uint64[]
: Start time of the daemon, as UNIX time.last_storage_server_ping - uint64[]
: Last ping time of the storage server (0 if never or not running as a service node)last_lokinet_ping - uint64[]
: Last ping time of lokinet (0 if never or not running as a service node)free_space - uint64[]
: Available disk space on the node.offline - bool
: States if the node is offline (true
) or online (false
).untrusted - bool
: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true
), or when the daemon is fully synced (false
).bootstrap_daemon_address - string[]
: Bootstrap node to give immediate usability to wallets while syncing by proxying RPC to it. (Note: the replies may be untrustworthy).height_without_bootstrap - uint64[]
: Current length of the local chain of the daemon.was_bootstrap_ever_used - bool[]
: States if a bootstrap node has ever been used since the daemon started.database_size - uint64
: Current size of Blockchain data. Over public RPC this is rounded up to the next-largest GB value.version - string
: Current version of software running.status_line - string
: A short one-line summary status of the node (requires an admin/unrestricted connection for most details)
GET_LAST_BLOCK_HEADER¶
Block header information for the most recent block is easily retrieved with this method. No inputs are needed.
Endpoints: get_last_block_header, getlastblockheader
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_last_block_header",
"params": {
"fill_pow_hash": true,
"get_tx_hashes": true
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"status": "OK",
"block_header": {
"major_version": 11,
"minor_version": 11,
"timestamp": 123,
"prev_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"nonce": 2130706433,
"orphan_status": true,
"height": 234767,
"depth": 123,
"hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"difficulty": 25179406071,
"cumulative_difficulty": 25179406071,
"reward": 123,
"miner_reward": 123,
"block_size": 123,
"block_weight": 123,
"num_txes": 123,
"pow_hash": ["bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70"],
"long_term_weight": 123,
"miner_tx_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"tx_hashes": ["b605cab7e3b9fe1f6d322e3167cd26e1e61c764afa9d733233ef716787786123"],
"service_node_winner": "4a8c30cea9e729b06c91132295cce32d2a8e6e5bcf7b74a998e2ee1b3ed590b3"
},
"untrusted": false
}
}
Inputs:
fill_pow_hash - bool
: Tell the daemon if it should fill out pow_hash field.get_tx_hashes - bool
: If true (default false) then include the hashes of non-coinbase transactions
Outputs:
status - string
: General RPC error code. "OK" means everything looks good.block_header - block_header_response
: A structure containing block header information.major_version - uint8
: The major version of the loki protocol at this block height.minor_version - uint8
: The minor version of the loki protocol at this block height.timestamp - uint64
: The unix time at which the block was recorded into the blockchain.prev_hash - string
: The hash of the block immediately preceding this block in the chain.nonce - uint32
: A cryptographic random one-time number used in mining a Loki block.orphan_status - bool
: Usuallyfalse
. Iftrue
, this block is not part of the longest chain.height - uint64
: The number of blocks preceding this block on the blockchain.depth - uint64
: The number of blocks succeeding this block on the blockchain. A larger number means an older block.hash - string
: The hash of this block.difficulty - uint64
: The strength of the Loki network based on mining power.cumulative_difficulty - uint64
: The cumulative strength of the Loki network based on mining power.reward - uint64
: The amount of new generated in this block and rewarded to the miner, foundation and service Nodes. Note: 1 LOKI = 1e9 atomic units.miner_reward - uint64
: The amount of new generated in this block and rewarded to the miner. Note: 1 LOKI = 1e9 atomic units.block_size - uint64
: The block size in bytes.block_weight - uint64
: The block weight in bytes.num_txes - uint64
: Number of transactions in the block, not counting the coinbase tx.pow_hash - string[]
: The hash of the block's proof of work (requiresfill_pow_hash
)long_term_weight - uint64
: Long term weight of the block.miner_tx_hash - string
: The TX hash of the miner transactiontx_hashes - string[]
: The TX hashes of all non-coinbase transactions (requiresget_tx_hashes
)service_node_winner - string
: Service node that received a reward for this blockuntrusted - bool
: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true
), or when the daemon is fully synced (false
).
GET_LIMIT¶
Get daemon bandwidth limits.
Endpoints: get_limit
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_limit"
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"status": "OK",
"limit_up": 123,
"limit_down": 123,
"untrusted": false
}
}
Outputs:
status - string
: General RPC error code. "OK" means everything looks good.limit_up - uint64
: Upload limit in kBytes per second.limit_down - uint64
: Download limit in kBytes per second.untrusted - bool
: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true
), or when the daemon is fully synced (false
).
GET_NET_STATS¶
Endpoints: get_net_stats
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_net_stats"
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"status": "OK",
"start_time": 123,
"total_packets_in": 123,
"total_bytes_in": 123,
"total_packets_out": 123,
"total_bytes_out": 123
}
}
Outputs:
status - string
start_time - uint64
total_packets_in - uint64
total_bytes_in - uint64
total_packets_out - uint64
total_bytes_out - uint64
GET_OUTPUTS¶
Endpoints: get_outs
Constants:
* `MAX_COUNT - uint64 = 500`
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_outs",
"params": {
"outputs": [{
"amount": 26734261552878,
"index": 123
}],
"get_txid": true
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"outs": [{
"key": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"mask": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"unlocked": true,
"height": 234767,
"txid": "b605cab7e3b9fe1f6d322e3167cd26e1e61c764afa9d733233ef716787786123"
}],
"status": "OK",
"untrusted": false
}
}
Inputs:
outputs - get_outputs_out[]
: Array of structureget_outputs_out
.amount - uint64
: Amount of Loki in TXID.index - uint64
get_txid - bool
: Request the TXID/hash of the transaction as well.
Outputs:
outs - outkey[]
: List of outkey information.key - string
: The public key of the output.mask - string
unlocked - bool
: States if output is locked (false
) or not (true
).height - uint64
: Block height of the output.txid - string
: Transaction id.status - string
: General RPC error code. "OK" means everything looks good.untrusted - bool
: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true
), or when the daemon is fully synced (false
).
GET_OUTPUT_DISTRIBUTION¶
Endpoints: get_output_distribution
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_output_distribution",
"params": {
"amounts": [123],
"from_height": 123,
"to_height": 123,
"cumulative": true,
"binary": true,
"compress": true
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"status": "OK",
"distributions": [{
"data": "TODO(loki): Write example string",
"amount": 26734261552878,
"compressed_data": "TODO(loki): Write example string",
"binary": true,
"compress": true
}],
"untrusted": false
}
}
Inputs:
amounts - uint64[]
: Amounts to look for in atomic units.from_height - uint64
: (optional, default is 0) starting height to check from.to_height - uint64
: (optional, default is 0) ending height to check up to.cumulative - bool
: (optional, default is false) States if the result should be cumulative (true) or not (false).binary - bool
compress - bool
Outputs:
status - string
: General RPC error code. "OK" means everything looks good.distributions - distribution[]
:data - rpc::output_distribution_data
amount - uint64
compressed_data - string
binary - bool
compress - bool
untrusted - bool
: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true
), or when the daemon is fully synced (false
).
GET_OUTPUT_HISTOGRAM¶
Get a histogram of output amounts. For all amounts (possibly filtered by parameters),
gives the number of outputs on the chain for that amount. RingCT outputs counts as 0 amount.
Endpoints: get_output_histogram
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_output_histogram",
"params": {
"amounts": [123],
"min_count": 123,
"max_count": 123,
"unlocked": true,
"recent_cutoff": 123
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"status": "OK",
"histogram": [{
"amount": 26734261552878,
"total_instances": 123,
"unlocked_instances": 123,
"recent_instances": 123
}],
"untrusted": false
}
}
Inputs:
amounts - uint64[]
: list of amounts in Atomic Units.min_count - uint64
: The minimum amounts you are requesting.max_count - uint64
: The maximum amounts you are requesting.unlocked - bool
: Look for locked only.recent_cutoff - uint64
Outputs:
status - string
: General RPC error code. "OK" means everything looks good.histogram - entry[]
: List of histogram entries:amount - uint64
: Output amount in atomic units.total_instances - uint64
unlocked_instances - uint64
recent_instances - uint64
untrusted - bool
: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true
), or when the daemon is fully synced (false
).
GET_PEER_LIST¶
Get the known peers list.
Endpoints: get_peer_list
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_peer_list",
"params": {
"public_only": true
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"status": "OK",
"white_list": [{
"id": 123,
"host": "127.0.0.1",
"ip": 2130706433,
"port": 12345,
"rpc_port": 12345,
"last_seen": 1554685440,
"pruning_seed": 2130706433
}],
"gray_list": [{
"id": 123,
"host": "127.0.0.1",
"ip": 2130706433,
"port": 12345,
"rpc_port": 12345,
"last_seen": 1554685440,
"pruning_seed": 2130706433
}]
}
}
Inputs:
public_only - bool
Outputs:
status - string
: General RPC error code. "OK" means everything looks good. Any other value means that something went wrong.white_list - peer[]
: Array of online peer structure.id - uint64
: Peer id.host - string
: IP address in string format.ip - uint32
: IP address in integer format.port - uint16
: TCP port the peer is using to connect to loki network.rpc_port - uint16
: RPC port the peer is usinglast_seen - uint64
: Unix time at which the peer has been seen for the last timepruning_seed - uint32
:gray_list - peer[]
: Array of offline peer structure.id - uint64
: Peer id.host - string
: IP address in string format.ip - uint32
: IP address in integer format.port - uint16
: TCP port the peer is using to connect to loki network.rpc_port - uint16
: RPC port the peer is usinglast_seen - uint64
: Unix time at which the peer has been seen for the last timepruning_seed - uint32
:
GET_PUBLIC_NODES¶
Query the daemon's peerlist and retrieve peers who have set their public rpc port.
Endpoints: get_public_nodes
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_public_nodes",
"params": {
"gray": true,
"white": true
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"status": "OK",
"gray": [{
"host": "127.0.0.1",
"last_seen": 1554685440,
"rpc_port": 12345
}],
"white": [{
"host": "127.0.0.1",
"last_seen": 1554685440,
"rpc_port": 12345
}]
}
}
Inputs:
gray - bool
: Get peers that have recently gone offline.white - bool
: Get peers that are online
Outputs:
status - string
: General RPC error code. "OK" means everything looks good. Any other value means that something went wrong.gray - public_node[]
: Graylist peershost - string
last_seen - uint64
rpc_port - uint16
white - public_node[]
: Whitelist peershost - string
last_seen - uint64
rpc_port - uint16
GET_QUORUM_STATE¶
Accesses the list of public keys of the nodes who are participating or being tested in a quorum.
Endpoints: get_quorum_state
Constants:
* `MAX_COUNT - uint64 = 25`
* `HEIGHT_SENTINEL_VALUE - uint64 = UINT64_MA`
* `ALL_QUORUMS_SENTINEL_VALUE - uint8 = 25`
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_quorum_state",
"params": {
"start_height": 123,
"end_height": 123,
"quorum_type": 11
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"status": "OK",
"quorums": [{
"height": 234767,
"quorum_type": 11,
"quorum": {
"validators": ["4a8c30cea9e729b06c91132295cce32d2a8e6e5bcf7b74a998e2ee1b3ed590b3"],
"workers": ["4a8c30cea9e729b06c91132295cce32d2a8e6e5bcf7b74a998e2ee1b3ed590b3"]
}
}],
"untrusted": false
}
}
Inputs:
start_height - uint64
: (Optional): Start height, omit both start and end height to request the latest quorum. Note that "latest" means different heights for different types of quorums as not all quorums exist at every block heights.end_height - uint64
: (Optional): End height, omit both start and end height to request the latest quorumquorum_type - uint8
: (Optional): Set value to request a specific quorum, 0 = Obligation, 1 = Checkpointing, 2 = Blink, 3 = Pulse, 255 = all quorums, default is all quorums. For Pulse quorums, requesting the blockchain height (or latest) returns the primary pulse quorum responsible for the next block; for heights with blocks this returns the actual quorum, which may be a backup quorum if the primary quorum did not produce in time.
Outputs:
status - string
: Generic RPC error code. "OK" is the success value.quorums - quorum_for_height[]
: An array of quorums associated with the requested heightheight - uint64
: The height the quorums are relevant forquorum_type - uint8
: The quorum typequorum - quorum_t
: Quorum of Service Nodesvalidators - string[]
: List of service node public keys in the quorum. For obligations quorums these are the testing nodes; for checkpoint and blink these are the participating nodes (there are no workers); for Pulse blink quorums these are the block signers.workers - string[]
: Public key of the quorum workers. For obligations quorums these are the nodes being tested; for Pulse quorums this is the block producer. Checkpoint and Blink quorums do not populate this field.
untrusted - bool
: If the result is obtained using bootstrap mode, and therefore not trustedtrue
, or otherwisefalse
.
GET_SERVICE_KEYS¶
Get the service public keys of the queried daemon, encoded in hex. All three keys are used
when running as a service node; when running as a regular node only the x25519 key is regularly
used for some RPC and and node-to-SN communication requests.
Endpoints: get_service_keys, get_service_node_key
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_service_keys"
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"service_node_pubkey": "4a8c30cea9e729b06c91132295cce32d2a8e6e5bcf7b74a998e2ee1b3ed590b3",
"service_node_ed25519_pubkey": "1de25fd280b9b08da62f06a5521c735fd94b7ecf237ca7409748295e75b48104",
"service_node_x25519_pubkey": "7a8d1961ec9d1ac77aa67a2cded9271b0b6b9e4406005b36e260d0a230943b0e",
"status": "OK"
}
}
Outputs:
service_node_pubkey - string
: The queried daemon's service node public key. Will be empty if not running as a service node.service_node_ed25519_pubkey - string
: The daemon's ed25519 auxiliary public key.service_node_x25519_pubkey - string
: The daemon's x25519 auxiliary public key.status - string
: Generic RPC error code. "OK" is the success value.
GET_SERVICE_NODES¶
Get information on some, all, or a random subset of Service Nodes.
Endpoints: get_service_nodes, get_n_service_nodes, get_all_service_nodes
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_service_nodes",
"params": {
"service_node_pubkeys": ["4a8c30cea9e729b06c91132295cce32d2a8e6e5bcf7b74a998e2ee1b3ed590b3"],
"include_json": true,
"limit": 2130706433,
"active_only": true,
"fields": [{
"all": true,
"service_node_pubkey": true,
"registration_height": true,
"registration_hf_version": true,
"requested_unlock_height": true,
"last_reward_block_height": true,
"last_reward_transaction_index": true,
"active": true,
"funded": true,
"state_height": true,
"decommission_count": true,
"earned_downtime_blocks": true,
"service_node_version": true,
"contributors": true,
"total_contributed": true,
"total_reserved": true,
"staking_requirement": true,
"portions_for_operator": true,
"swarm_id": true,
"operator_address": true,
"public_ip": true,
"storage_port": true,
"storage_lmq_port": true,
"quorumnet_port": true,
"pubkey_ed25519": true,
"pubkey_x25519": true,
"last_uptime_proof": true,
"storage_server_reachable": true,
"storage_server_reachable_timestamp": true,
"checkpoint_participation": true,
"pulse_participation": true,
"block_hash": true,
"height": true,
"target_height": true,
"hardfork": true
}],
"poll_block_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70"
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"service_node_states": [{
"service_node_pubkey": "4a8c30cea9e729b06c91132295cce32d2a8e6e5bcf7b74a998e2ee1b3ed590b3",
"registration_height": 234767,
"registration_hf_version": 12345,
"requested_unlock_height": 123,
"last_reward_block_height": 234767,
"last_reward_transaction_index": 2130706433,
"active": true,
"funded": true,
"state_height": 123,
"decommission_count": 2130706433,
"earned_downtime_blocks": 123,
"service_node_version": ["TODO(loki): Write example string"],
"contributors": [{
"amount": 26734261552878,
"reserved": 123,
"address": "L8KJf3nRQ53NTX1YLjtHryjegFRa3ZCEGLKmRxUfvkBWK19UteEacVpYqpYscSJ2q8WRuHPFdk7Q5W8pQB7Py5kvUs8vKSk",
"locked_contributions": [{
"key_image": "8d1bd8181bf7d857bdb281e0153d84cd55a3fcaa57c3e570f4a49f935850b5e3",
"key_image_pub_key": "b1b696dd0a0d1815e341d9fed85708703c57b5d553a3615bcf4a06a36fa4bc38",
"amount": 26734261552878
}]
}],
"total_contributed": 123,
"total_reserved": 123,
"staking_requirement": 100000000000,
"portions_for_operator": 18446744073709551612,
"swarm_id": 123,
"operator_address": "L8KJf3nRQ53NTX1YLjtHryjegFRa3ZCEGLKmRxUfvkBWK19UteEacVpYqpYscSJ2q8WRuHPFdk7Q5W8pQB7Py5kvUs8vKSk",
"public_ip": "8.8.8.8",
"storage_port": 12345,
"storage_lmq_port": 12345,
"quorumnet_port": 12345,
"pubkey_ed25519": "1de25fd280b9b08da62f06a5521c735fd94b7ecf237ca7409748295e75b48104",
"pubkey_x25519": "7a8d1961ec9d1ac77aa67a2cded9271b0b6b9e4406005b36e260d0a230943b0e",
"last_uptime_proof": 123,
"storage_server_reachable": true,
"storage_server_reachable_timestamp": 123,
"checkpoint_participation": ["TODO(loki): Write example string"],
"pulse_participation": ["TODO(loki): Write example string"]
}],
"height": 234767,
"target_height": 123,
"block_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"unchanged": true,
"hardfork": 11,
"status": "OK",
"as_json": "TODO(loki): Write example string"
}
}
Inputs:
service_node_pubkeys - string[]
: Array of public keys of registered Service Nodes to get information about. Omit to query all Service Nodes.include_json - bool
: When set, the response's as_json member is filled out.limit - uint32
: If non-zero, select a random sample (in random order) of the given number of service nodes to return from the full list.active_only - bool
: If true, only include results for active (fully staked, not decommissioned) service nodes.fields - requested_fields_t[]
: If omitted return all fields; otherwise return only the specified fieldsall - bool = fals
: If set, overrides any individual requested fields. Defaults to true if "fields" is entirely omittedservice_node_pubkey - bool
registration_height - bool
registration_hf_version - bool
requested_unlock_height - bool
last_reward_block_height - bool
last_reward_transaction_index - bool
active - bool
funded - bool
state_height - bool
decommission_count - bool
earned_downtime_blocks - bool
service_node_version - bool
contributors - bool
total_contributed - bool
total_reserved - bool
staking_requirement - bool
portions_for_operator - bool
swarm_id - bool
operator_address - bool
public_ip - bool
storage_port - bool
storage_lmq_port - bool
quorumnet_port - bool
pubkey_ed25519 - bool
pubkey_x25519 - bool
last_uptime_proof - bool
storage_server_reachable - bool
storage_server_reachable_timestamp - bool
checkpoint_participation - bool
pulse_participation - bool
block_hash - bool
height - bool
target_height - bool
hardfork - bool
poll_block_hash - string
: If specified this changes the behaviour to only return service node records if the block hash is not equal to the given hash; otherwise it omits the records and instead sets"unchanged": true
in the response. This is primarily used to poll for new results where the requested results only change with new blocks.
Outputs:
service_node_states - entry[]
: Array of service node registration informationservice_node_pubkey - string
: The public key of the Service Node.registration_height - uint64
: The height at which the registration for the Service Node arrived on the blockchain.registration_hf_version - uint16
: The hard fork at which the registration for the Service Node arrived on the blockchain.requested_unlock_height - uint64
: The height at which contributions will be released and the Service Node expires. 0 if not requested yet.last_reward_block_height - uint64
: The height that determines when this service node will next receive a reward. This field is updated when receiving a reward, but is also updated when a SN is activated, recommissioned, or has an IP change position reset.last_reward_transaction_index - uint32
: When multiple Service Nodes register (or become active/reactivated) at the same height (i.e. have the same last_reward_block_height), this field contains the activating transaction position in the block which is used to break ties in determining which SN is next in the reward list.active - bool
: True if fully funded and not currently decommissioned (and soactive && !funded
implicitly defines decommissioned)funded - bool
: True if the required stakes have been submitted to activate this Service Nodestate_height - uint64
: If active: the state at which the service node became active (i.e. fully staked height, or last recommissioning); if decommissioned: the decommissioning height; if awaiting: the last contribution (or registration) heightdecommission_count - uint32
: The number of times the Service Node has been decommissioned since registrationearned_downtime_blocks - int64
: The number of blocks earned towards decommissioning, or the number of blocks remaining until deregistration if currently decommissionedservice_node_version - uint16[3]
: The major, minor, patch version of the Service Node respectively.contributors - service_node_contributor[]
: Array of contributors, contributing to this Service Node.amount - uint64
: The total amount of locked Loki in atomic units for this contributor.reserved - uint64
: The amount of Loki in atomic units reserved by this contributor for this Service Node.address - string
: The wallet address for this contributor rewards are sent to and contributions came from.locked_contributions - service_node_contribution[]
: Array of contributions from this contributor.key_image - string
: The contribution's key image that is locked on the network.key_image_pub_key - string
: The contribution's key image, public key componentamount - uint64
: The amount that is locked in this contribution.
total_contributed - uint64
: The total amount of Loki in atomic units contributed to this Service Node.total_reserved - uint64
: The total amount of Loki in atomic units reserved in this Service Node.staking_requirement - uint64
: The staking requirement in atomic units that is required to be contributed to become a Service Node.portions_for_operator - uint64
: The operator percentage cut to take from each reward expressed in portions, see cryptonote_config.h's STAKING_PORTIONS.swarm_id - uint64
: The identifier of the Service Node's current swarm.operator_address - string
: The wallet address of the operator to which the operator cut of the staking reward is sent to.public_ip - string
: The public ip address of the service nodestorage_port - uint16
: The port number associated with the storage serverstorage_lmq_port - uint16
: The port number associated with the storage server (lokimq interface)quorumnet_port - uint16
: The port for direct SN-to-SN communicationpubkey_ed25519 - string
: The service node's ed25519 public key for auxiliary servicespubkey_x25519 - string
: The service node's x25519 public key for auxiliary serviceslast_uptime_proof - uint64
: The last time this Service Node's uptime proof was relayed by at least 1 Service Node other than itself in unix epoch time.storage_server_reachable - bool
: Whether the node's storage server has been reported as unreachable for a long timestorage_server_reachable_timestamp - uint64
: The last time this Service Node's storage server was contactedcheckpoint_participation - service_nodes::participation_entry[]
: Of the last N checkpoints the Service Node is in a checkpointing quorum, record whether or not the Service Node voted to checkpoint a blockpulse_participation - service_nodes::participation_entry[]
: Of the last N pulse blocks the Service Node is in a pulse quorum, record whether or not the Service Node voted (participated) in that blockheight - uint64
: Current block's height.target_height - uint64
: Blockchain's target height.block_hash - string
: Current block's hash.unchanged - bool
: Will be true (andservice_node_states
omitted) if you gave the current block hash to poll_block_hashhardfork - uint8
: Current hardfork version.status - string
: Generic RPC error code. "OK" is the success value.as_json - string
: Ifinclude_json
is set in the request, this contains the json representation of theentry
data structure
GET_SERVICE_NODE_BLACKLISTED_KEY_IMAGES¶
Get information on blacklisted Service Node key images.
Endpoints: get_service_node_blacklisted_key_images
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_service_node_blacklisted_key_images"
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"blacklist": [{
"key_image": "8d1bd8181bf7d857bdb281e0153d84cd55a3fcaa57c3e570f4a49f935850b5e3",
"unlock_height": 123,
"amount": 26734261552878
}],
"status": "OK"
}
}
Outputs:
blacklist - entry[]
: Array of blacklisted key images, i.e. unspendable transactionskey_image - string
: The key image of the transaction that is blacklisted on the network.unlock_height - uint64
: The height at which the key image is removed from the blacklist and becomes spendable.amount - uint64
: The total amount of locked Loki in atomic units in this blacklisted stake.status - string
: Generic RPC error code. "OK" is the success value.
GET_SERVICE_NODE_REGISTRATION_CMD¶
Endpoints: get_service_node_registration_cmd
Constants:
* `response - GET_SERVICE_NODE_REGISTRATION_CMD_RAW::response`
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_service_node_registration_cmd",
"params": {
"operator_cut": "1.1%",
"contributions": [{
"address": "L8KJf3nRQ53NTX1YLjtHryjegFRa3ZCEGLKmRxUfvkBWK19UteEacVpYqpYscSJ2q8WRuHPFdk7Q5W8pQB7Py5kvUs8vKSk",
"amount": 26734261552878
}],
"staking_requirement": 100000000000
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"status": "OK",
"registration_cmd": "register_service_node 18446744073709551612 L8KJf3nRQ53NTX1YLjtHryjegFRa3ZCEGLKmRxUfvkBWK19UteEacVpYqpYscSJ2q8WRuHPFdk7Q5W8pQB7Py5kvUs8vKSk 18446744073709551612 1555894565 f90424b23c7969bb2f0191bca45e6433a59b0b37039a5e38a2ba8cc7ea1075a3 ba24e4bfb4af0f5f9f74e35f1a5685dc9250ee83f62a9ee8964c9a689cceb40b4f125c83d0cbb434e56712d0300e5a23fd37a5b60cddbcd94e2d578209532a0d"
}
}
Inputs:
operator_cut - string
: The percentage of cut per reward the operator receives expressed as a string, i.e. "1.1%"contributions - contribution_t[]
: Array of contributors for this Service Nodeaddress - string
: The wallet address for the contributoramount - uint64
: The amount that the contributor will reserve in Loki atomic units towards the staking requirementstaking_requirement - uint64
: The staking requirement to become a Service Node the registration command will be generated upon
Outputs:
status - string
: Generic RPC error code. "OK" is the success value.registration_cmd - string
: The command to execute in the wallet CLI to register the queried daemon as a Service Node.
GET_SERVICE_NODE_REGISTRATION_CMD_RAW¶
Endpoints: get_service_node_registration_cmd_raw
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_service_node_registration_cmd_raw",
"params": {
"args": ["TODO(loki): Write example string"],
"make_friendly": true,
"staking_requirement": 100000000000
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"status": "OK",
"registration_cmd": "register_service_node 18446744073709551612 L8KJf3nRQ53NTX1YLjtHryjegFRa3ZCEGLKmRxUfvkBWK19UteEacVpYqpYscSJ2q8WRuHPFdk7Q5W8pQB7Py5kvUs8vKSk 18446744073709551612 1555894565 f90424b23c7969bb2f0191bca45e6433a59b0b37039a5e38a2ba8cc7ea1075a3 ba24e4bfb4af0f5f9f74e35f1a5685dc9250ee83f62a9ee8964c9a689cceb40b4f125c83d0cbb434e56712d0300e5a23fd37a5b60cddbcd94e2d578209532a0d"
}
}
Inputs:
args - string[]
: (Developer) The arguments used in raw registration, i.e. portionsmake_friendly - bool
: Provide information about how to use the command in the result.staking_requirement - uint64
: The staking requirement to become a Service Node the registration command will be generated upon
Outputs:
status - string
: Generic RPC error code. "OK" is the success value.registration_cmd - string
: The command to execute in the wallet CLI to register the queried daemon as a Service Node.
GET_SERVICE_NODE_STATUS¶
Get information on the queried daemon's Service Node state.
Endpoints: get_service_node_status
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_service_node_status",
"params": {
"include_json": true
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"service_node_state": "TODO(loki): Write example string",
"height": 234767,
"block_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"status": "OK",
"as_json": "TODO(loki): Write example string"
}
}
Inputs:
include_json - bool
: When set, the response's as_json member is filled out.
Outputs:
service_node_state - GET_SERVICE_NODES::response::entry
: Service node registration informationheight - uint64
: Current block's height.block_hash - string
: Current block's hash.status - string
: Generic RPC error code. "OK" is the success value.as_json - string
: Ifinclude_json
is set in the request, this contains the json representation of theentry
data structure
GET_SERVICE_PRIVKEYS¶
Get the service private keys of the queried daemon, encoded in hex. Do not ever share
these keys: they would allow someone to impersonate your service node. All three keys are used
when running as a service node; when running as a regular node only the x25519 key is regularly
used for some RPC and and node-to-SN communication requests.
Endpoints: get_service_privkeys, get_service_node_privkey
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_service_privkeys"
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"service_node_privkey": "4a8c30cea9e729b06c91132295cce32d2a8e6e5bcf7b74a998e2ee1b3ed590b3",
"service_node_ed25519_privkey": "1de25fd280b9b08da62f06a5521c735fd94b7ecf237ca7409748295e75b48104",
"service_node_x25519_privkey": "7a8d1961ec9d1ac77aa67a2cded9271b0b6b9e4406005b36e260d0a230943b0e",
"status": "OK"
}
}
Outputs:
service_node_privkey - string
: The queried daemon's service node private key. Will be empty if not running as a service node.service_node_ed25519_privkey - string
: The daemon's ed25519 private key (note that this is in sodium's format, which consists of the private and public keys concatenated together)service_node_x25519_privkey - string
: The daemon's x25519 private key.status - string
: Generic RPC error code. "OK" is the success value.
GET_SN_STATE_CHANGES¶
Query hardcoded/service node checkpoints stored for the blockchain. Omit all arguments to retrieve the latest "count" checkpoints.
Endpoints: get_service_nodes_state_changes
Constants:
* `HEIGHT_SENTINEL_VALUE - uint64 = std::numeric_limits<uint64_t>::max() - `
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_service_nodes_state_changes",
"params": {
"start_height": 123,
"end_height": 123
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"status": "OK",
"untrusted": false,
"total_deregister": 2130706433,
"total_ip_change_penalty": 2130706433,
"total_decommission": 2130706433,
"total_recommission": 2130706433,
"total_unlock": 2130706433,
"start_height": 123,
"end_height": 123
}
}
Inputs:
start_height - uint64
end_height - uint64
: Optional: If omitted, the tally runs until the current block
Outputs:
status - string
: Generic RPC error code. "OK" is the success value.untrusted - bool
: If the result is obtained using bootstrap mode, and therefore not trustedtrue
, or otherwisefalse
.total_deregister - uint32
total_ip_change_penalty - uint32
total_decommission - uint32
total_recommission - uint32
total_unlock - uint32
start_height - uint64
end_height - uint64
GET_STAKING_REQUIREMENT¶
Get the required amount of Loki to become a Service Node at the queried height.
For devnet and testnet values, ensure the daemon is started with the
`--devnet` or `--testnet` flags respectively.
Endpoints: get_staking_requirement
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_staking_requirement",
"params": {
"height": 234767
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"staking_requirement": 100000000000,
"height": 234767,
"status": "OK"
}
}
Inputs:
height - uint64
: The height to query the staking requirement for. 0 (or omitting) means current height.
Outputs:
staking_requirement - uint64
: The staking requirement in Loki, in atomic units.height - uint64
: The height requested (or current height if 0 was requested)status - string
: Generic RPC error code. "OK" is the success value.
GET_TRANSACTIONS¶
Look up one or more transactions by hash.
Endpoints: get_transactions, gettransactions
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_transactions",
"params": {
"txs_hashes": ["b605cab7e3b9fe1f6d322e3167cd26e1e61c764afa9d733233ef716787786123"],
"decode_as_json": true,
"tx_extra": true,
"split": true,
"prune": true
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"missed_tx": ["b605cab7e3b9fe1f6d322e3167cd26e1e61c764afa9d733233ef716787786123"],
"txs": [{
"tx_hash": "b605cab7e3b9fe1f6d322e3167cd26e1e61c764afa9d733233ef716787786123",
"as_hex": ["TODO(loki): Write example string"],
"pruned_as_hex": ["TODO(loki): Write example string"],
"prunable_as_hex": ["TODO(loki): Write example string"],
"prunable_hash": ["b605cab7e3b9fe1f6d322e3167cd26e1e61c764afa9d733233ef716787786123"],
"as_json": ["TODO(loki): Write example string"],
"size": 2130706433,
"in_pool": true,
"double_spend_seen": true,
"block_height": 123,
"block_timestamp": 123,
"output_indices": [123],
"received_timestamp": 123,
"relayed": true,
"blink": true,
"extra": [{
"pubkey": ["1de25fd280b9b08da62f06a5521c735fd94b7ecf237ca7409748295e75b48104"],
"burn_amount": [123],
"extra_nonce": ["TODO(loki): Write example string"],
"payment_id": ["f378710e54eeeb8d"],
"mm_depth": [2130706433],
"mm_root": ["TODO(loki): Write example string"],
"additional_pubkeys": ["TODO(loki): Write example string"],
"sn_winner": ["TODO(loki): Write example string"],
"sn_pubkey": ["TODO(loki): Write example string"],
"sn_registration": [{
"contributors": [{
"wallet": "TODO(loki): Write example string",
"portion": 2130706433
}],
"fee": 2130706433,
"expiry": 123
}],
"sn_contributor": ["TODO(loki): Write example string"],
"sn_state_change": [{
"old_dereg": [true],
"type": "TODO(loki): Write example string",
"height": 234767,
"index": 2130706433,
"voters": [2130706433]
}],
"tx_secret_key": ["TODO(loki): Write example string"],
"locked_key_images": ["TODO(loki): Write example string"],
"key_image_unlock": ["TODO(loki): Write example string"],
"lns": [{
"buy": [true],
"update": [true],
"renew": [true],
"type": "TODO(loki): Write example string",
"blocks": [123],
"name_hash": "TODO(loki): Write example string",
"prev_txid": ["f26efb11e8eb6b446c5e0247e8883f41689591356f7abe65afe9fe75f567d40e"],
"value": ["TODO(loki): Write example string"],
"owner": ["L8ssYFtxi1HTFQdbmG9Lt71tyudgageDgBqBLcgLnw5XBiJ1NQLFYNAAfYpYS3jHaSe8UsFYjSgKadKhC7edTSQB15s6T7g"],
"backup_owner": ["L8PYYYTh6yEewvuPmF75uhjDn9fBzKXp8CeMuwKNZBvZT8wAoe9hJ4favnZMvTTkNdT56DMNDcdWyheb3icfk4MS3udsP4R"]
}]
}]
}],
"status": "OK",
"untrusted": false
}
}
Inputs:
txs_hashes - string[]
: List of transaction hashes to look up.decode_as_json - bool
: Optional (false
by default). If set true, the returned transaction information will be decoded.tx_extra - bool
: Parse tx-extra informationsplit - bool
: Always split transactions into non-prunable and prunable parts in the response.False
by default.prune - bool
: Likesplit
, but also omits the prunable part (or details, for decode_as_json) of transactions from the response.False
by default.
Outputs:
missed_tx - string[]
: (Optional - returned if not empty) Transaction hashes that could not be found.txs - entry[]
: Array of tx datatx_hash - string
: Transaction hash.as_hex - string[]
: Full transaction information as a hex string. Always omitted if any ofdecode_as_json
,split
, orprune
is requested; or if the transaction has been pruned in the database.pruned_as_hex - string[]
: The non-prunable part of the transaction. Always included ifsplit
orprune
and specified; without those options it will be included instead ofas_hex
if the transaction has been pruned.prunable_as_hex - string[]
: The prunable part of the transaction. Only included whensplit
is specified, the transaction is prunable, and the tx has not been pruned from the database.prunable_hash - string[]
: The hash of the prunable part of the transaction. Will be provided if either: the tx has been pruned; or the tx is prunable and either ofprune
orsplit
are specified.as_json - string[]
: Transaction information parsed into json. Requires decode_as_json in request.size - uint32
: Size of the transaction, in bytes. Note that if the transaction has been pruned this is the post-pruning size, not the original size.in_pool - bool
: States if the transaction is in pool (true
) or included in a block (false
).double_spend_seen - bool
: States if the transaction is a double-spend (true
) or not (false
).block_height - uint64
: Block height including the transaction.block_timestamp - uint64
: Unix time at which the block has been added to the blockchain.output_indices - uint64[]
: List of transaction indexes.received_timestamp - uint64
: Timestamp transaction was received in the pool.relayed - bool
blink - bool
: True if this is an approved, blink transaction (only available for in_pool transactions or txes in recent blocks)extra - extra_entry[]
: Parsed tx_extra information (only if requested)pubkey - string[]
: The tx extra public keyburn_amount - uint64[]
: The amount of LOKI that this transaction burnsextra_nonce - string[]
: Optional extra nonce value (in hex); will be empty if nonce is recognized as a payment idpayment_id - string[]
: The payment ID, if present. This is either a 16 hex character (8-byte) encrypted payment id, or a 64 hex character (32-byte) deprecated, unencrypted payment IDmm_depth - uint32[]
: (Merge-mining) the merge-mined depthmm_root - string[]
: (Merge-mining) the merge mining merkle root hashadditional_pubkeys - string[]
: Additional public keyssn_winner - string[]
: Service node block reward winner public keysn_pubkey - string[]
: Service node public key (e.g. for registrations, stakes, unlocks)sn_registration - sn_reg_info[]
: Service node registration detailscontributors - contribution[]
: Operator contribution plus any reserved contributionswallet - string
: Contributor walletportion - uint32
: Reserved portion, as the rounded nearest value out of 1'000'000 (i.e. 234567 == 23.4567%).
fee - uint32
: Operator fee, as the rounded nearest value out of 1'000'000expiry - uint64
: unix timestamp at which the registration expiressn_contributor - string[]
: Service node contributor wallet address (for stakes)sn_state_change - state_change[]
: A state change transaction (deregistration, decommission, recommission, ip change)old_dereg - bool[]
: Will be present and set to true iff this record is an old (pre-HF12) deregistration fieldtype - string
: "dereg", "decom", "recom", or "ip" indicating the state change typeheight - uint64
: The voting block height for the changing service node and validatorsindex - uint32
: The index of all tested nodes at the given height for which this state change appliesvoters - uint32[]
: The position of validators in the testing quorum who validated and voted for this state change. This typically contains just 7 required voter slots (of 10 eligible voters).tx_secret_key - string[]
: The transaction secret key, included in registrations/stakes to decrypt transaction amounts and recipientslocked_key_images - string[]
: Key image(s) locked by the transaction (for registrations, stakes)key_image_unlock - string[]
: A key image being unlocked in a stake unlock request (an unlock will be started for all key images locked in the same SN contributions).lns - lns_details[]
: an LNS registration or updatebuy - bool[]
: Provided and true iff this is an LNS buy recordupdate - bool[]
: Provided and true iff this is an LNS record updaterenew - bool[]
: Provided and true iff this is an LNS record renewaltype - string
: The LNS request type. For registrations: "lokinet", "session", "wallet"; for a record update: "update"blocks - uint64[]
: The registration length in blocks (only applies to lokinet registrations; session/wallet registrations do not expire)name_hash - string
: The hashed name of the record being purchased/updated, in hex (the actual name is not provided on the blockchain).prev_txid - string[]
: For an update, this points at the txid of the previous lns update transaction.value - string[]
: The encrypted value of the record, in hex. Note that this is encrypted using the actual name itself (not the hashed name).owner - string[]
: The owner of this record; this can be a main wallet, wallet subaddress, or a plain public key.backup_owner - string[]
: Backup owner wallet/pubkey of the record, if provided.
status - string
: General RPC error code. "OK" means everything looks good.untrusted - bool
: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true
), or when the daemon is fully synced (false
).
GET_TRANSACTION_POOL¶
Show information about valid transactions seen by the node but not yet mined into a block,
as well as spent key image information for the txpool in the node's memory.
Endpoints: get_transaction_pool
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_transaction_pool",
"params": {
"tx_extra": true
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"status": "OK",
"transactions": [{
"id_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"tx_json": "TODO(loki): Write example string",
"blob_size": 123,
"weight": 123,
"fee": 123,
"max_used_block_id_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"max_used_block_height": 123,
"kept_by_block": true,
"last_failed_height": 123,
"last_failed_id_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"receive_time": 123,
"relayed": true,
"last_relayed_time": 123,
"do_not_relay": true,
"double_spend_seen": true,
"tx_blob": "0402f78b05f78b05f78b0501ffd98b0502b888ddcf730229f056f5594cfcfd8d44f8033c9fda22450693d1694038e1cecaaaac25a8fc12af8992bc800102534df00c14ead3b3dedea9e7bdcf71c44803349b5e9aee2f73e22d5385ac147b7601008e5729d9329320444666d9d9d9dc602a3ae585de91ab2ca125665e3a363610021100000001839fdb0000000000000000000001200408d5ad7ab79d9b05c94033c2029f4902a98ec51f5175564f6978467dbb28723f929cf806d4ee1c781d7771183a93a1fd74f0827bddee9baac7e3083ab2b5840000",
"blink": true,
"extra": ["TODO(loki): Write example string"]
}],
"spent_key_images": [{
"id_hash": "bf430a3279f576ed8a814be25193e5a1ec61d3ee5729e64f47d8480ce5a2da70",
"txs_hashes": ["b605cab7e3b9fe1f6d322e3167cd26e1e61c764afa9d733233ef716787786123"]
}],
"untrusted": false
}
}
Inputs:
tx_extra - bool
: Parse tx-extra information and adds it to theextra
field.
Outputs:
status - string
: General RPC error code. "OK" means everything looks good.transactions - tx_info[]
: List of transactions in the mempool are not in a block on the main chain at the moment:id_hash - string
: The transaction ID hash.tx_json - string
: JSON structure of all information in the transactionblob_size - uint64
: The size of the full transaction blob.weight - uint64
: The weight of the transaction.fee - uint64
: The amount of the mining fee included in the transaction, in atomic units.max_used_block_id_hash - string
: Tells the hash of the most recent block with an output used in this transaction.max_used_block_height - uint64
: Tells the height of the most recent block with an output used in this transaction.kept_by_block - bool
: States if the tx was included in a block at least once (true
) or not (false
).last_failed_height - uint64
: If the transaction validation has previously failed, this tells at what height that occured.last_failed_id_hash - string
: Like the previous, this tells the previous transaction ID hash.receive_time - uint64
: The Unix time that the transaction was first seen on the network by the node.relayed - bool
: States if this transaction has been relayedlast_relayed_time - uint64
: Last unix time at which the transaction has been relayed.do_not_relay - bool
: States if this transaction should not be relayed.double_spend_seen - bool
: States if this transaction has been seen as double spend.tx_blob - string
: Hexadecimal blob represnting the transaction.blink - bool
: True if this is a signed blink transactionextra - GET_TRANSACTIONS::extra_entry[]
: Parsed tx_extra information (only if requested)spent_key_images - spent_key_image_info[]
: List of spent output key images:id_hash - string
: Key image.txs_hashes - string[]
: List of tx hashes of the txes (usually one) spending that key image.untrusted - bool
: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true
), or when the daemon is fully synced (false
).
GET_TRANSACTION_POOL_BACKLOG¶
Get all transaction pool backlog.
Endpoints: get_txpool_backlog
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_txpool_backlog"
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"status": "OK",
"backlog": [{
"weight": 123,
"fee": 123,
"time_in_pool": 123
}],
"untrusted": false
}
}
Outputs:
status - string
: General RPC error code. "OK" means everything looks good.backlog - tx_backlog_entry[]
: Array of structures tx_backlog_entry (in binary form):weight - uint64
:fee - uint64
: Fee in Loki measured in atomic units.time_in_pool - uint64
untrusted - bool
: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true
), or when the daemon is fully synced (false
).
GET_TRANSACTION_POOL_HASHES¶
Get hashes from transaction pool.
Endpoints: get_transaction_pool_hashes
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_transaction_pool_hashes"
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"status": "OK",
"tx_hashes": ["b605cab7e3b9fe1f6d322e3167cd26e1e61c764afa9d733233ef716787786123"],
"untrusted": false
}
}
Outputs:
status - string
: General RPC error code. "OK" means everything looks good.tx_hashes - string[]
: List of transaction hashes,untrusted - bool
: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true
), or when the daemon is fully synced (false
).
GET_TRANSACTION_POOL_STATS¶
Get the transaction pool statistics.
Endpoints: get_transaction_pool_stats
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_transaction_pool_stats"
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"status": "OK",
"pool_stats": {
"bytes_total": 123,
"bytes_min": 2130706433,
"bytes_max": 2130706433,
"bytes_med": 2130706433,
"fee_total": 123,
"oldest": 123,
"txs_total": 2130706433,
"num_failing": 2130706433,
"num_10m": 2130706433,
"num_not_relayed": 2130706433,
"histo_98pc": 123,
"histo": [{
"txs": 2130706433,
"bytes": 123
}],
"num_double_spends": 2130706433
},
"untrusted": false
}
}
Outputs:
status - string
: General RPC error code. "OK" means everything looks good.pool_stats - txpool_stats
: List of pool stats:bytes_total - uint64
: Total size of all transactions in pool.bytes_min - uint32
: Min transaction size in pool.bytes_max - uint32
: Max transaction size in pool.bytes_med - uint32
: Median transaction size in pool.fee_total - uint64
: Total fee's in pool in atomic units.oldest - uint64
: Unix time of the oldest transaction in the pool.txs_total - uint32
: Total number of transactions.num_failing - uint32
: Bumber of failing transactions.num_10m - uint32
: Number of transactions in pool for more than 10 minutes.num_not_relayed - uint32
: Number of non-relayed transactions.histo_98pc - uint64
: the time 98% of txes are "younger" than.histo - txpool_histo[]
: List of txpool histo.txs - uint32
: Number of transactions.bytes - uint64
: Size in bytes.
num_double_spends - uint32
: Number of double spend transactions.untrusted - bool
: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true
), or when the daemon is fully synced (false
).
GET_VERSION¶
Get current RPC protocol version.
Endpoints: get_version
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "get_version"
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"status": "OK",
"version": 2130706433,
"untrusted": false
}
}
Outputs:
status - string
: General RPC error code. "OK" means everything looks good.version - uint32
: RPC current version.untrusted - bool
: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true
), or when the daemon is fully synced (false
).
HARD_FORK_INFO¶
Look up information regarding hard fork voting and readiness.
Endpoints: hard_fork_info
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "hard_fork_info",
"params": {
"version": 11
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"version": 11,
"enabled": true,
"window": 2130706433,
"votes": 2130706433,
"threshold": 2130706433,
"voting": 11,
"state": 2130706433,
"earliest_height": 123,
"status": "OK",
"untrusted": false
}
}
Inputs:
version - uint8
: The major block version for the fork.
Outputs:
version - uint8
: The major block version for the fork.enabled - bool
: Tells if hard fork is enforced.window - uint32
: Number of blocks over which current votes are cast. Default is 10080 blocks.votes - uint32
: Number of votes towards hard fork.threshold - uint32
: Minimum percent of votes to trigger hard fork. Default is 80.voting - uint8
: Hard fork voting status.state - uint32
: Current hard fork state: 0 (There is likely a hard fork), 1 (An update is needed to fork properly), or 2 (Everything looks good).earliest_height - uint64
: Block height at which hard fork would be enabled if voted in.status - string
: General RPC error code. "OK" means everything looks good.untrusted - bool
: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true
), or when the daemon is fully synced (false
).
IN_PEERS¶
Limit number of Incoming peers.
Endpoints: in_peers
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "in_peers",
"params": {
"set": true,
"in_peers": 2130706433
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"in_peers": 2130706433,
"status": "OK"
}
}
Inputs:
set - bool
: If true, set the number of incoming peers, otherwise the response returns the current limit of incoming peers. (Defaults to true)in_peers - uint32
: Max number of incoming peers
Outputs:
in_peers - uint32
: The current limit set for outgoing peersstatus - string
: General RPC error code. "OK" means everything looks good.
IS_KEY_IMAGE_SPENT¶
Check if outputs have been spent using the key image associated with the output.
Endpoints: is_key_image_spent
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "is_key_image_spent",
"params": {
"key_images": ["8d1bd8181bf7d857bdb281e0153d84cd55a3fcaa57c3e570f4a49f935850b5e3"]
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"spent_status": [0, 1],
"status": "OK",
"untrusted": false
}
}
Inputs:
key_images - string[]
: List of key image hex strings to check.
Outputs:
spent_status - int32[]
: List of statuses for each image checked. Statuses are follows: 0 = unspent, 1 = spent in blockchain, 2 = spent in transaction poolstatus - string
: General RPC error code. "OK" means everything looks good.untrusted - bool
: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true
), or when the daemon is fully synced (false
).
LNS_NAMES_TO_OWNERS¶
Get the name mapping for a Loki Name Service entry. Loki currently supports mappings
for Session and Lokinet.
Endpoints: lns_names_to_owners
Constants:
* `MAX_REQUEST_ENTRIES - uint64 = 25`
* `MAX_TYPE_REQUEST_ENTRIES - uint64`
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "lns_names_to_owners",
"params": {
"entries": [{
"name_hash": "BzT9ln2zY7/DxSqNeNXeEpYx3fxu2B+guA0ClqtSb0E=",
"types": [12345]
}],
"include_expired": true
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"entries": [{
"entry_index": 123,
"type": session,
"name_hash": "BzT9ln2zY7/DxSqNeNXeEpYx3fxu2B+guA0ClqtSb0E=",
"owner": "L8ssYFtxi1HTFQdbmG9Lt71tyudgageDgBqBLcgLnw5XBiJ1NQLFYNAAfYpYS3jHaSe8UsFYjSgKadKhC7edTSQB15s6T7g",
"backup_owner": ["L8PYYYTh6yEewvuPmF75uhjDn9fBzKXp8CeMuwKNZBvZT8wAoe9hJ4favnZMvTTkNdT56DMNDcdWyheb3icfk4MS3udsP4R"],
"encrypted_value": "8fe253e6f15addfbce5c87583e970cb09294ec5b9fc7a1891c2ac34937e5a5c116c210ddf313f5fcccd8ee28cfeb0fa8e9",
"update_height": 123,
"expiration_height": [123],
"txid": "b605cab7e3b9fe1f6d322e3167cd26e1e61c764afa9d733233ef716787786123"
}],
"status": "OK"
}
}
Inputs:
entries - request_entry[]
: Entries to look upname_hash - string
: The 32-byte BLAKE2b hash of the name to resolve to a public key via Loki Name Service. The value must be provided either in hex (64 hex digits) or base64 (44 characters with padding, or 43 characters without).types - uint16[]
: If empty, query all types. Currently supported types are 0 (session) and 2 (lokinet). In future updates more mapping types will be available.include_expired - bool
: Optional: if provided and true, include entries in the results even if they are expired
Outputs:
entries - response_entry[]
entry_index - uint64
: The index in request_entry'sentries
array that was resolved via Loki Name Service.type - lns::mapping_type
: The type of Loki Name Service entry that the owner owns: currently supported values are 0 (session), 2 (lokinet)name_hash - string
: The hash of the name that was queried, in base64owner - string
: The public key that purchased the Loki Name Service entry.backup_owner - string[]
: The backup public key that the owner specified when purchasing the Loki Name Service entry. Omitted if no backup owner.encrypted_value - string
: The encrypted value that the name maps to. See theLNS_RESOLVE
description for information on how this value can be decrypted.update_height - uint64
: The last height that this Loki Name Service entry was updated on the Blockchain.expiration_height - uint64[]
: For records that expire, this will be set to the expiration block height.txid - string
: The txid of the mapping's most recent update or purchase.status - string
: Generic RPC error code. "OK" is the success value.
LNS_OWNERS_TO_NAMES¶
Get all the name mappings for the queried owner. The owner can be either a ed25519 public key or Monero style
public key; by default purchases are owned by the spend public key of the purchasing wallet.
Endpoints: lns_owners_to_names
Constants:
* `MAX_REQUEST_ENTRIES - uint64 = 25`
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "lns_owners_to_names",
"params": {
"entries": ["25be5504d9f092f02f2c7ac8d2d277327dbfb00118c64faa5eccbecfa9bce90b"],
"include_expired": true
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"entries": [{
"request_index": 0,
"type": session,
"name_hash": "BzT9ln2zY7/DxSqNeNXeEpYx3fxu2B+guA0ClqtSb0E=",
"owner": "L8ssYFtxi1HTFQdbmG9Lt71tyudgageDgBqBLcgLnw5XBiJ1NQLFYNAAfYpYS3jHaSe8UsFYjSgKadKhC7edTSQB15s6T7g",
"backup_owner": ["L8PYYYTh6yEewvuPmF75uhjDn9fBzKXp8CeMuwKNZBvZT8wAoe9hJ4favnZMvTTkNdT56DMNDcdWyheb3icfk4MS3udsP4R"],
"encrypted_value": "8fe253e6f15addfbce5c87583e970cb09294ec5b9fc7a1891c2ac34937e5a5c116c210ddf313f5fcccd8ee28cfeb0fa8e9",
"update_height": 123,
"expiration_height": [123],
"txid": "b605cab7e3b9fe1f6d322e3167cd26e1e61c764afa9d733233ef716787786123"
}],
"status": "OK"
}
}
Inputs:
entries - string[]
: The owner's public key to find all Loki Name Service entries for.include_expired - bool
: Optional: if provided and true, include entries in the results even if they are expired
Outputs:
entries - response_entry[]
request_index - uint64
: (Deprecated) The index in request'sentries
array that was resolved via Loki Name Service.type - lns::mapping_type
: The category the Loki Name Service entry belongs to; currently 0 for Session and 2 for Lokinet.name_hash - string
: The hash of the name that the owner purchased via Loki Name Service in base64owner - string
: The backup public key specified by the owner that purchased the Loki Name Service entry.backup_owner - string[]
: The backup public key specified by the owner that purchased the Loki Name Service entry. Omitted if no backup owner.encrypted_value - string
: The encrypted value that the name maps to, in hex. This value is encrypted using the name (not the hash) as the secret.update_height - uint64
: The last height that this Loki Name Service entry was updated on the Blockchain.expiration_height - uint64[]
: For records that expire, this will be set to the expiration block height.txid - string
: The txid of the mapping's most recent update or purchase.status - string
: Generic RPC error code. "OK" is the success value.
LNS_RESOLVE¶
Performs a simple LNS lookup of a BLAKE2b-hashed name. This RPC method is meant for simple,
single-value resolutions that do not care about registration details, etc.; if you need more
information use LNS_NAMES_TO_OWNERS instead.
Technical details: the returned value is encrypted using the name itself so that neither this
lokid responding to the RPC request nor any other blockchain observers can (easily) obtain the
name of registered addresses or the registration details. Thus, from a client's point of view,
resolving an LNS record involves:
- Lower-case the name.
- Calculate the name hash as a null-key, 32-byte BLAKE2b hash of the lower-case name.
- Obtain the encrypted value and the nonce from this RPC call (or LNS_NAMES_TO_OWNERS); (encode
the name hash using either hex or base64.).
- Calculate the decryption key as a 32-byte BLAKE2b keyed hash of the name using the
(unkeyed) name hash calculated above as the hash key.
- Decrypt (and verify) using XChaCha20-Poly1305 (for example libsodium's
crypto_aead_xchacha20poly1305_ietf_decrypt) using the above decryption key and using the
first 24 bytes of the name hash as the public nonce.
Endpoints: lns_resolve
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "lns_resolve",
"params": {
"type": 12345,
"name_hash": "TODO(loki): Write example string"
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"encrypted_value": ["TODO(loki): Write example string"],
"nonce": ["TODO(loki): Write example string"]
}
}
Inputs:
type - uint16
: The LNS type (mandatory); currently supported values are: 0 = session, 2 = lokinet.name_hash - string
: The 32-byte BLAKE2b hash of the name to look up, encoded as 64 hex digits or 44/43 base64 characters (with/without padding).
Outputs:
encrypted_value - string[]
: The encrypted LNS value, in hex. Will be omitted from the response if the given name_hash is not registered.nonce - string[]
: The nonce value used for encryption, in hex.
LOKINET_PING¶
Endpoints: lokinet_ping
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "lokinet_ping",
"params": {
"version": ["TODO(loki): Write example string"]
}
}
EOF
Inputs:
version - int[3]
: Lokinet version
MINING_STATUS¶
Get the mining status of the daemon.
Endpoints: mining_status
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "mining_status"
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"status": "OK",
"active": true,
"speed": 123,
"threads_count": 8,
"address": "L8KJf3nRQ53NTX1YLjtHryjegFRa3ZCEGLKmRxUfvkBWK19UteEacVpYqpYscSJ2q8WRuHPFdk7Q5W8pQB7Py5kvUs8vKSk",
"pow_algorithm": "RandomX (LOKI variant)",
"block_target": 2130706433,
"block_reward": 123,
"difficulty": 123
}
}
Outputs:
status - string
: General RPC error code. "OK" means everything looks good. Any other value means that something went wrong.active - bool
: States if mining is enabled (true
) or disabled (false
).speed - uint64
: Mining power in hashes per seconds.threads_count - uint32
: Number of running mining threads.address - string
: Account address daemon is mining to. Empty if not mining.pow_algorithm - string
: Current hashing algorithm nameblock_target - uint32
: The expected time to solve per block, i.e. TARGET_BLOCK_TIMEblock_reward - uint64
: Block reward for the current block being mined.difficulty - uint64
: The difficulty for the current block being mined.
OUT_PEERS¶
Limit number of Outgoing peers.
Endpoints: out_peers
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "out_peers",
"params": {
"set": true,
"out_peers": 2130706433
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"out_peers": 2130706433,
"status": "OK"
}
}
Inputs:
set - bool
: If true, set the number of outgoing peers, otherwise the response returns the current limit of outgoing peers. (Defaults to true)out_peers - uint32
: Max number of outgoing peers
Outputs:
out_peers - uint32
: The current limit set for outgoing peersstatus - string
: General RPC error code. "OK" means everything looks good.
PERFORM_BLOCKCHAIN_TEST¶
TODO: Undocumented, -- unused
Endpoints: perform_blockchain_test
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "perform_blockchain_test",
"params": {
"max_height": 123,
"seed": 123
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"status": "OK",
"res_height": 123
}
}
Inputs:
max_height - uint64
seed - uint64
Outputs:
status - string
res_height - uint64
POP_BLOCKS¶
Endpoints: pop_blocks
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "pop_blocks",
"params": {
"nblocks": 123
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"status": "OK",
"height": 234767
}
}
Inputs:
nblocks - uint64
: Number of blocks in that span.
Outputs:
status - string
: General RPC error code. "OK" means everything looks good.height - uint64
PRUNE_BLOCKCHAIN¶
Endpoints: prune_blockchain
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "prune_blockchain",
"params": {
"check": true
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"pruned": true,
"pruning_seed": 2130706433,
"status": "OK"
}
}
Inputs:
check - bool
Outputs:
pruned - bool
pruning_seed - uint32
status - string
RELAY_TX¶
Relay a list of transaction IDs.
Endpoints: relay_tx
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "relay_tx",
"params": {
"txids": ["b605cab7e3b9fe1f6d322e3167cd26e1e61c764afa9d733233ef716787786123"]
}
}
EOF
Inputs:
txids - string[]
: List of transactions IDs to relay from pool.
REPORT_PEER_SS_STATUS¶
Endpoints: report_peer_storage_server_status
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "report_peer_storage_server_status",
"params": {
"type": "TODO(loki): Write example string",
"pubkey": "1de25fd280b9b08da62f06a5521c735fd94b7ecf237ca7409748295e75b48104",
"passed": true
}
}
EOF
Inputs:
type - string
: test type (currently used: ["reachability"])pubkey - string
: service node pubkeypassed - bool
: whether the node is passing the test
SAVE_BC¶
Save the blockchain. The blockchain does not need saving and is always saved when modified,
however it does a sync to flush the filesystem cache onto the disk for safety purposes against Operating System or Hardware crashes.
Endpoints: save_bc
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "save_bc"
}
EOF
SEND_RAW_TX¶
Broadcast a raw transaction to the network.
Endpoints: send_raw_transaction, sendrawtransaction
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "send_raw_transaction",
"params": {
"tx_as_hex": "TODO(loki): Write example string",
"do_not_relay": true,
"do_sanity_checks": true,
"blink": true
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"status": "OK",
"reason": "TODO(loki): Write example string",
"not_relayed": true,
"untrusted": false,
"tvc": {
"m_should_be_relayed": true,
"m_verifivation_failed": true,
"m_verifivation_impossible": true,
"m_added_to_pool": true,
"m_low_mixin": true,
"m_double_spend": true,
"m_invalid_input": true,
"m_invalid_output": true,
"m_too_few_outputs": true,
"m_too_big": true,
"m_overspend": true,
"m_fee_too_low": true,
"m_invalid_version": true,
"m_invalid_type": true,
"m_key_image_locked_by_snode": true,
"m_key_image_blacklisted": true,
"m_verbose_error": "TODO(loki): Write example string",
"m_vote_ctx": {
"m_verification_failed": true,
"m_invalid_block_height": true,
"m_duplicate_voters": true,
"m_validator_index_out_of_bounds": true,
"m_worker_index_out_of_bounds": true,
"m_signature_not_valid": true,
"m_added_to_pool": true,
"m_not_enough_votes": true,
"m_incorrect_voting_group": true,
"m_invalid_vote_type": true,
"m_votes_not_sorted": true
}
},
"sanity_check_failed": true,
"blink_status": "TODO(loki): Write example string"
}
}
Inputs:
tx_as_hex - string
: Full transaction information as hexidecimal string.do_not_relay - bool
: (Optional: Default false) Stop relaying transaction to other nodes. Ignored ifblink
is true.do_sanity_checks - bool
: (Optional: Default true) Verify TX params have sane values.blink - bool
: (Optional: Default false) Submit this as a blink tx rather than into the mempool.
Outputs:
status - string
: General RPC error code. "OK" means everything looks good. Any other value means that something went wrong.reason - string
: Additional information. Currently empty, "Not relayed" if transaction was accepted but not relayed, or some descriptive message of why the tx failed.not_relayed - bool
: Transaction was not relayed (true) or relayed (false).untrusted - bool
: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true
), or when the daemon is fully synced (false
).tvc - tx_verification_context
m_should_be_relayed - bool
m_verifivation_failed - bool
: bad tx, should drop connectionm_verifivation_impossible - bool
: the transaction is related with an alternative blockchainm_added_to_pool - bool
m_low_mixin - bool
m_double_spend - bool
m_invalid_input - bool
m_invalid_output - bool
m_too_few_outputs - bool
m_too_big - bool
m_overspend - bool
m_fee_too_low - bool
m_invalid_version - bool
m_invalid_type - bool
m_key_image_locked_by_snode - bool
m_key_image_blacklisted - bool
m_verbose_error - string
m_vote_ctx - vote_verification_context
m_verification_failed - bool
m_invalid_block_height - bool
m_duplicate_voters - bool
m_validator_index_out_of_bounds - bool
m_worker_index_out_of_bounds - bool
m_signature_not_valid - bool
m_added_to_pool - bool
m_not_enough_votes - bool
m_incorrect_voting_group - bool
m_invalid_vote_type - bool
m_votes_not_sorted - bool
sanity_check_failed - bool
blink_status - blink_result
: 0 for a non-blink tx. For a blink tx: 1 means rejected, 2 means accepted, 3 means timeout.
SETBANS¶
Ban another node by IP.
Endpoints: set_bans
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "set_bans",
"params": {
"bans": [{
"host": "127.0.0.1",
"ip": 2130706433,
"ban": true,
"seconds": 2130706433
}]
}
}
EOF
Inputs:
bans - ban[]
: List of nodes to ban.host - string
: Host to ban (IP in A.B.C.D form - will support I2P address in the future).ip - uint32
: IP address to ban, in Int format.ban - bool
: Set true to ban.seconds - uint32
: Number of seconds to ban node.
SET_BOOTSTRAP_DAEMON¶
Set the bootstrap daemon to use for data on the blockchain whilst syncing the chain.
Endpoints: set_bootstrap_daemon
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "set_bootstrap_daemon",
"params": {
"address": "L8KJf3nRQ53NTX1YLjtHryjegFRa3ZCEGLKmRxUfvkBWK19UteEacVpYqpYscSJ2q8WRuHPFdk7Q5W8pQB7Py5kvUs8vKSk",
"username": "TODO(loki): Write example string",
"password": "not_a_secure_password"
}
}
EOF
Inputs:
address - string
username - string
password - string
SET_LIMIT¶
Set daemon bandwidth limits.
Endpoints: set_limit
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "set_limit",
"params": {
"limit_down": 123,
"limit_up": 123
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"status": "OK",
"limit_up": 123,
"limit_down": 123
}
}
Inputs:
limit_down - int64
: Download limit in kBytes per second (-1 reset to default, 0 don't change the current limit)limit_up - int64
: Upload limit in kBytes per second (-1 reset to default, 0 don't change the current limit)
Outputs:
status - string
: General RPC error code. "OK" means everything looks good.limit_up - int64
: Upload limit in kBytes per second.limit_down - int64
: Download limit in kBytes per second.
SET_LOG_CATEGORIES¶
Set the daemon log categories. Categories are represented as a comma separated list of `<Category>:<level>` (similarly to syslog standard `<Facility>:<Severity-level>`), where:
Category is one of the following: * (all facilities), default, net, net.http, net.p2p, logging, net.trottle, blockchain.db, blockchain.db.lmdb, bcutil, checkpoints, net.dns, net.dl,
i18n, perf,stacktrace, updates, account, cn ,difficulty, hardfork, miner, blockchain, txpool, cn.block_queue, net.cn, daemon, debugtools.deserialize, debugtools.objectsizes, device.ledger,
wallet.gen_multisig, multisig, bulletproofs, ringct, daemon.rpc, wallet.simplewallet, WalletAPI, wallet.ringdb, wallet.wallet2, wallet.rpc, tests.core.
Level is one of the following: FATAL - higher level, ERROR, WARNING, INFO, DEBUG, TRACE.
Lower level A level automatically includes higher level. By default, categories are set to:
`*:WARNING,net:FATAL,net.p2p:FATAL,net.cn:FATAL,global:INFO,verify:FATAL,stacktrace:INFO,logging:INFO,msgwriter:INFO`
Setting the categories to "" prevent any logs to be outputed.
You can append to the current the log level for updating just one or more categories while
leaving other log levels unchanged by specifying one or more "<category>:<level>" pairs
preceded by a "+", for example "+difficulty:DEBUG,net:WARNING".
Endpoints: set_log_categories
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "set_log_categories",
"params": {
"categories": "TODO(loki): Write example string"
}
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"status": "OK",
"categories": "TODO(loki): Write example string"
}
}
Inputs:
categories - string
: Optional, daemon log categories to enable
Outputs:
status - string
: General RPC error code. "OK" means everything looks good. Any other value means that something went wrong.categories - string
: Daemon log enabled categories
SET_LOG_HASH_RATE¶
Set the log hash rate display mode.
Endpoints: set_log_hash_rate
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "set_log_hash_rate",
"params": {
"visible": true
}
}
EOF
Inputs:
visible - bool
: States if hash rate logs should be visible (true) or hidden (false)
SET_LOG_LEVEL¶
Set the daemon log level. By default, log level is set to `0`. For more fine-tuned logging
control set the set_log_categories command instead.
Endpoints: set_log_level
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "set_log_level",
"params": {
"level": 8
}
}
EOF
Inputs:
level - int8
: Daemon log level to set from0
(less verbose) to4
(most verbose)
START_MINING¶
Start mining on the daemon.
Endpoints: start_mining
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "start_mining",
"params": {
"miner_address": "L8KJf3nRQ53NTX1YLjtHryjegFRa3ZCEGLKmRxUfvkBWK19UteEacVpYqpYscSJ2q8WRuHPFdk7Q5W8pQB7Py5kvUs8vKSk",
"threads_count": 123,
"num_blocks": 123,
"slow_mining": true
}
}
EOF
Inputs:
miner_address - string
: Account address to mine to.threads_count - uint64
: Number of mining thread to run.num_blocks - uint64
: Mine until the blockchain has this many new blocks, then stop (no limit if 0, the default)slow_mining - bool
: Do slow mining (i.e. don't allocate RandomX cache); primarily intended for testing
STOP_DAEMON¶
Send a command to the daemon to safely disconnect and shut down.
Endpoints: stop_daemon
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "stop_daemon"
}
EOF
STOP_MINING¶
Stop mining on the daemon.
Endpoints: stop_mining
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "stop_mining"
}
EOF
STORAGE_SERVER_PING¶
Endpoints: storage_server_ping
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "storage_server_ping",
"params": {
"version_major": 12345,
"version_minor": 12345,
"version_patch": 12345,
"storage_lmq_port": 12345
}
}
EOF
Inputs:
version_major - int32
: Storage Server Major versionversion_minor - int32
: Storage Server Minor versionversion_patch - int32
: Storage Server Patch versionstorage_lmq_port - uint16
: Storage Server lmq port to include in uptime proofs
SUBMITBLOCK¶
Submit a mined block to the network.
Endpoints: submit_block, submitblock
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "submit_block",
"params": {
"blob": ["TODO(loki): Write example string"]
}
}
EOF
Inputs:
blob - string[]
: Block blob data - array containing exactly one block blob string which has been mined. See get_block_template to get a blob on which to mine.
SYNC_INFO¶
Get synchronisation information.
Endpoints: sync_info
Example Request
curl -X POST http://127.0.0.1:22023/json_rpc \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"jsonrpc": "2.0",
"id": "0",
"method": "sync_info"
}
EOF
Example Response
{
"jsonrpc": "2.0",
"id": "0",
"result": {
"status": "OK",
"height": 234767,
"target_height": 123,
"next_needed_pruning_seed": 2130706433,
"peers": [{
"info": "TODO(loki): Write example string"
}],
"spans": [{
"start_block_height": 123,
"nblocks": 123,
"connection_id": "083c301a3030329a487adb12ad981d2c",
"rate": 2130706433,
"speed": 2130706433,
"size": 123,
"remote_address": "127.0.0.1:22023"
}],
"overview": "TODO(loki): Write example string"
}
}
Outputs:
status - string
: General RPC error code. "OK" means everything looks good. Any other value means that something went wrong.height - uint64
: Block height.target_height - uint64
: Target height the node is syncing from (optional, absent if node is fully synced).next_needed_pruning_seed - uint32
peers - peer[]
: Array of Peer structureinfo - connection_info
: Structure of connection info, as defined in get_connections.spans - span[]
: Array of Span Structure.start_block_height - uint64
: Block height of the first block in that span.nblocks - uint64
: Number of blocks in that span.connection_id - string
: Id of connection.rate - uint32
: Connection rate.speed - uint32
: Connection speed.size - uint64
: Total number of bytes in that span's blocks (including txes).remote_address - string
: Peer address the node is downloading (or has downloaded) than span from.overview - string
Binary¶
GET_ALT_BLOCKS_HASHES¶
Get the known blocks hashes which are not on the main chain.
Endpoints: get_alt_blocks_hashes.bin
Outputs:
blks_hashes - string[]
: List of alternative blocks hashes to main chain.status - string
: General RPC error code. "OK" means everything looks good.untrusted - bool
: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true
), or when the daemon is fully synced (false
).
GET_BLOCKS_BY_HEIGHT¶
Get blocks by height. Binary request.
Endpoints: get_blocks_by_height.bin, getblocks_by_height.bin
Inputs:
heights - uint64[]
: List of block heights
Outputs:
blocks - block_complete_entry[]
: Array of block complete entriesblock - string
txs - string[]
checkpoint - string
blinks - serializable_blink_metadata[]
tx_hash - string[64]
height - uint64
quorum - uint8[]
position - uint8[]
signature - string[128][]
status - string
: General RPC error code. "OK" means everything looks good.untrusted - bool
: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true
), or when the daemon is fully synced (false
).
GET_BLOCKS_FAST¶
Get all blocks info. Binary request.
Endpoints: get_blocks.bin, getblocks.bin
Constants:
* `MAX_COUNT - uint64 = 100`
Inputs:
block_ids - string[64][]
: First 10 blocks id goes sequential, next goes in pow(2,n) offset, like 2, 4, 8, 16, 32, 64 and so on, and the last one is always genesis blockstart_height - uint64
: The starting block's height.prune - bool
: Prunes the blockchain, drops off 7/8 off the block iirc.no_miner_tx - bool
: Optional (false by default).
Outputs:
blocks - block_complete_entry[]
: Array of block complete entriesblock - string
txs - string[]
checkpoint - string
blinks - serializable_blink_metadata[]
tx_hash - string[64]
height - uint64
quorum - uint8[]
position - uint8[]
signature - string[128][]
start_height - uint64
: The starting block's height.current_height - uint64
: The current block height.status - string
: General RPC error code. "OK" means everything looks good.output_indices - block_output_indices[]
: Array of indices.indices - tx_output_indices[]
: Array of TX output indices:indices - uint64[]
: Array of unsigned int.
untrusted - bool
: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true
), or when the daemon is fully synced (false
).
GET_HASHES_FAST¶
Get hashes. Binary request.
Endpoints: get_hashes.bin, gethashes.bin
Inputs:
block_ids - string[64][]
: First 10 blocks id goes sequential, next goes in pow(2,n) offset, like 2, 4, 8, 16, 32, 64 and so on, and the last one is always genesis block */start_height - uint64
: The starting block's height.
Outputs:
m_block_ids - string[64][]
: Binary array of hashes, See block_ids above.start_height - uint64
: The starting block's height.current_height - uint64
: The current block height.status - string
: General RPC error code. "OK" means everything looks good.untrusted - bool
: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true
), or when the daemon is fully synced (false
).
GET_OUTPUTS_BIN¶
Get outputs. Binary request.
Endpoints: get_outs.bin
Constants:
* `MAX_COUNT - uint64 = 500`
Inputs:
outputs - get_outputs_out[]
: Array of structureget_outputs_out
.amount - uint64
: Amount of Loki in TXID.index - uint64
get_txid - bool
: TXID
Outputs:
outs - outkey[]
: List of outkey information.key - string[64]
: The public key of the output.mask - string[64]
unlocked - bool
: States if output is locked (false
) or not (true
).height - uint64
: Block height of the output.txid - string[64]
: Transaction id.status - string
: General RPC error code. "OK" means everything looks good.untrusted - bool
: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true
), or when the daemon is fully synced (false
).
GET_OUTPUT_BLACKLIST¶
Get information on output blacklist.
Endpoints: get_output_blacklist.bin
Outputs:
blacklist - uint64[]
: (Developer): Array of indexes from the global output list, corresponding to blacklisted key images.status - string
: Generic RPC error code. "OK" is the success value.untrusted - bool
: If the result is obtained using bootstrap mode, and therefore not trustedtrue
, or otherwisefalse
.
GET_OUTPUT_DISTRIBUTION_BIN¶
Exactly like GET_OUTPUT_DISTRIBUTION, but does a binary RPC transfer instead of JSON
Endpoints: get_output_distribution.bin
Constants:
* `response - GET_OUTPUT_DISTRIBUTION::response`
Inputs:
amounts - uint64[]
: Amounts to look for in atomic units.from_height - uint64
: (optional, default is 0) starting height to check from.to_height - uint64
: (optional, default is 0) ending height to check up to.cumulative - bool
: (optional, default is false) States if the result should be cumulative (true) or not (false).binary - bool
compress - bool
Outputs:
status - string
: General RPC error code. "OK" means everything looks good.distributions - distribution[]
:untrusted - bool
: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true
), or when the daemon is fully synced (false
).
GET_TRANSACTION_POOL_HASHES_BIN¶
Get hashes from transaction pool. Binary request.
Endpoints: get_transaction_pool_hashes.bin
Constants:
* `long_poll_timeout - std::chrono::seconds`
Inputs:
blinked_txs_only - bool
: Optional: If true only transactions that were sent via blink and approved are queried.long_poll - bool
: Optional: If true, this call is blocking until timeout OR tx pool has changed since the last query. TX pool change is detected by comparing the hash of all the hashes in the tx pool. Ignored when using LMQ RPC.tx_pool_checksum - string[64]
: Optional: Iflong_poll
is true the caller must pass the hashes of all their known tx pool hashes, XOR'ed together. Ignored when using LMQ RPC.
Outputs:
status - string
: General RPC error code. "OK" means everything looks good.tx_hashes - string[64][]
: List of transaction hashes,untrusted - bool
: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true
), or when the daemon is fully synced (false
).
GET_TX_GLOBAL_OUTPUTS_INDEXES¶
Get global outputs of transactions. Binary request.
Endpoints: get_o_indexes.bin
Inputs:
txid - string[64]
: Binary txid.
Outputs:
o_indexes - uint64[]
: List of output indexesstatus - string
: General RPC error code. "OK" means everything looks good.untrusted - bool
: States if the result is obtained using the bootstrap mode, and is therefore not trusted (true
), or when the daemon is fully synced (false
).