Daemon HTTP RPC API
The daemon HTTP RPC is a HTTP server which provides additional information regarding network and daemon connections.
Installation
Interacting with the API
API endpoint example
Configuration and Instantiation
To start the Daemon JSON RPC API server at http://localhost:11898
, run:
kryptokrona --rpc-bind-port=11898
To make the server accessible from another computer, use the --rpc-bind-ip 0.0.0.0
switch.
kryptokrona --rpc-bind-ip=0.0.0.0 --rpc-bind-port=11898
To enable block explorer API access (like for getblocks
, gettransactionpool
, etc.), use the --enable-blockexplorer
switch.
kryptokrona --enable-blockexplorer
The above given switches can be combined to achieve remote access with block explorer methods as shown below.
kryptokrona --enable-blockexplorer --rpc-bind-ip=0.0.0.0 --rpc-bind-port=11898
This would make the RPC server accessible at
http://<your ip address>:11898
and, locally at
http://localhost:11898
To make a HTTP RPC request to your Daemon RPC you should use a GET request that looks like this:
http://<service address>:<service port>
<service address>
IP of Daemon RPC, if it is located on local machine it is either 127.0.0.1 or localhost
<service port>
Daemon RPC port, by default it is bound to 11898 port, but it can be manually bound to any port you want
getheight
getheight()
returns the height of the daemon and the network
No Input.
Output
height
Current daemon height
int
network_height
Current Network height
int
status
Status of request
string
Expected Output
getinfo
getinfo()
returns information related to the network and daemon connection
No Input.
Output
alt_blocks_count
the number of blocks on alternative (split) chains since the start of the daemon
int
difficulty
difficulty of the top block
int
grey_peerlist_size
list of peers that were alive but not any more (offline)
int
hashrate
estimated network hashrate for given block (top block if general chain info) = difficulty / 30s (block time target)
int
height
daemon height. index of the last locally stored block. different from network_height when syncing the network, or when just found a block.
int
incoming_connections_count
Number of peers connected to and pulling from this daemon node.
int
last_known_block_index
?
int
major_version
blockchain major version. such as hash algorithm change
int
minor_version
blockchain minor version. for example, difficulty algo adjustment. rarely used.
int
network_height
blockchain length reported by peers. the longest value given by any connected peer.
int
outgoing_connections_count
number of outgoing connections from the daemon
int
start_time
the time when this daemon was started. epoch time in seconds
int
status
Status of request
string
supported_height
the height of the blockchain for supported fork. if forked after this block height, this version does not support it
int
synced
sync status. does the height of this node match the height of the network?
bool
testnet
whether the daemon is on testnet or not
bool
tx_count
Total number of non-coinbase transaction in the chain.
int
tx_pool_size
Number of transactions that have been broadcast but not included in a block.
int
upgrade_heights
pre-determined fork heights. blockchain heights where it forked.
array
version
version of the daemon software
string
white_peerlist_size
list of online peers
int
Expected Output
gettransactions
gettransactions()
method returns list of missed transactions. "Missed transactions" are invalid transactions in the sense that they do not exist in the blockchain. Input should include the transaction hashes to check. Try figuring that out. This method is likely to go away in near future.
No Input
Output
missed_tx
array of missed transactions
array
status
Status of request
string
txs_as_hex
array of hex values of missed transactions
array
Expected Output
getpeers
getpeers()
method returns the list of peers connected to the daemon
No Input.
Output
peers
array of peers (peer_ip:peer_port)
array
status
Status of request
string
Expected Output
feeinfo
feeinfo()
method returns information about the fee set for the remote node.
No Input.
Output
address
address to which the fee is paid
string
amount
fee amount
int
status
Status of fees for the node
string
Expected Output
License
The content in this document was originally written by the Bytecoin (BCN) Developers. It is licensed under the CC BY SA 3.0 license. The source material can be found at the Bytecoin Wiki.
Also of note, kryptokrona developers have altered and adapted the content to suit our implementation of the API. This was done independently of the Bytecoin development team. They neither endorse or acknowledge our changes. Feel free to adopt or change our content as per the CC BY SA 3.0 license requirements.
Last updated