On this page

latest contributor to this doc

Last Edit:

@gaeacodes

Network

The following RPC calls interact with the komodod software, and are made available through the komodo-cli software.

addnode "node" "add|remove|onetry"

The addnode method attempts to add or remove a node from the addnode list, or to make a single attempt to connect to a node.

NameTypeDescription
"node"(string, required)the node (see getpeerinfo for nodes)
"command"(string, required)'add' to add a node to the list, 'remove' to remove a node from the list, 'onetry' to try a connection to the node once

NameTypeDescription
(none)

Command:

./komodo-cli addnode "192.168.0.6:8233" "onetry"

You can find your rpcuser, rpcpassword, and rpcport in the coin's .conf file.

Command:

curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "addnode", "params": ["192.168.0.6:8233", "onetry"] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/

clearbanned

The clearbanned method clears all banned IPs.

NameTypeDescription
(none)

NameTypeDescription
(none)

Command:

./komodo-cli clearbanned

You can find your rpcuser, rpcpassword, and rpcport in the coin's .conf file.

Command:

curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "clearbanned", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/

disconnectnode "node"

The disconnectnode method instructs the daemon to immediately disconnect from the specified node.

Use getpeerinfo to determine the result.

NameTypeDescription
"node"(string, required)the node's address (see getpeerinfo for nodes)

NameTypeDescription
(none)

Command:

./komodo-cli disconnectnode "192.168.0.6:8233"

You can find your rpcuser, rpcpassword, and rpcport in the coin's .conf file.

Command:

curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "disconnectnode", "params": ["192.168.0.6:8233"] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/

getaddednodeinfo dns ( "node" )

The getaddednodeinfo method returns information about the given added node, or all added nodes.

If dns is set to false, only a list of added nodes is returned. Otherwise, connection information is also provided.

Nodes added via onetry are not listed here.

NameTypeDescription
dns(boolean, required)if false, only a list of added nodes will be provided; otherwise, connection information is also provided
"node"(string, optional)if provided, the method returns information about this specific node; otherwise, all nodes are returned

NameTypeDescription
"addednode"(string)the node ip address
"connected"(boolean)if connected
"addresses" : [ ... ](array of jsons)
"address"(string)the server host and port
"connected"(string)"connected" accepts two possible values: "inbound" or "outbound"

Command:

./komodo-cli getaddednodeinfo true

Command:

./komodo-cli getaddednodeinfo true "78.47.205.239"

You can find your rpcuser, rpcpassword, and rpcport in the coin's .conf file.

Command:

curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getaddednodeinfo", "params": [true, "78.47.205.239"] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/

getconnectioncount

The getconnectioncount method returns the number of connections to other nodes.

NameTypeDescription
(none)

NameTypeDescription
n(numeric)the connection count

Command:

./komodo-cli getconnectioncount

You can find your rpcuser, rpcpassword, and rpcport in the coin's .conf file.

Command:

curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getconnectioncount", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/

getdeprecationinfo

The getdeprecationinfo method returns an object containing current version and deprecation block height.

This method is applicable only to the KMD main net.

NameTypeDescription
(none)

NameTypeDescription
"version"(numeric)the server version
"subversion"(string)the server sub-version string (i.e. "/MagicBean:x.y.z[-v]/")
"deprecationheight"(numeric)the block height at which this version will deprecate and shut down (unless disabledeprecation is set)

Command:

./komodo-cli getdeprecationinfo

You can find your rpcuser, rpcpassword, and rpcport in the coin's .conf file.

Command:

curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getdeprecationinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/

getnettotals

The getnettotals method returns information about network traffic, including bytes in, bytes out, and current time.

NameTypeDescription
(none)

NameTypeDescription
"totalbytesrecv"(numeric)total bytes received
"totalbytessent"(numeric)total bytes sent
"timemillis"(numeric)total cpu time

Command:

./komodo-cli getnettotals

You can find your rpcuser, rpcpassword, and rpcport in the coin's .conf file.

Command:

curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getnettotals", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/

getnetworkinfo

The getnetworkinfo method returns an object containing various state info regarding p2p networking.

NameTypeDescription
(none)

NameTypeDescription
"version"(numeric)the server version
"subversion"(string)the server subversion string (i.e. "/MagicBean:x.y.z[-v]/")
"protocolversion"(numeric)the protocol version
"localservices"(string)the services we offer to the network
"timeoffset"(numeric)the time offset
"connections"(numeric)the number of connections
"networks": [ ... ](array of jsons)information per network
"name"(string)network (ipv4, ipv6 or onion)
"limited"(boolean)whether the network is limited using -onlynet
"reachable"(boolean)whether the network is reachable
"proxy"(string)(submitted as "host:port") the proxy that is used for this network, or empty if none
"relayfee"(numeric)minimum relay fee for non-free transactions in COIN/kB
"localaddresses": [ ... ](array of jsons)list of local addresses
"address"(string)network address
"port"(numeric)network port
"score"(numeric)relative score
"warnings"(string)any network warnings (such as alert messages)

Command:

./komodo-cli getnetworkinfo

You can find your rpcuser, rpcpassword, and rpcport in the coin's .conf file.

Command:

curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getnetworkinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/

getpeerinfo

The getpeerinfo method returns data about each connected network node as a json array of objects.

NameTypeDescription
(none)

NameTypeDescription
"id"(numeric)peer index
"addr":,(string)the ip address and port of the peer ("host:port")
"addrlocal"(string)local address ("ip:port")
"services"(string)the services offered
"lastsend"(numeric)the time in seconds since epoch (Jan 1 1970 GMT) of the last send
"lastrecv"(numeric)the time in seconds since epoch (Jan 1 1970 GMT) of the last receive
"bytessent"(numeric)the total bytes sent
"bytesrecv"(numeric)the total bytes received
"conntime"(numeric)the connection time in seconds since epoch (Jan 1 1970 GMT)
"timeoffset"(numeric)the time offset in seconds
"pingtime"(numeric)ping time
"pingwait"(numeric)ping wait
"version"(numeric)the peer version, such as 170002
"subver"(string)the string version (i.e. "/MagicBean:x.y.z[-v]/")
"inbound"(boolean)inbound (true) or outbound (false)
"startingheight"(numeric)the starting height (block) of the peer
"banscore"(numeric)the ban score
"synced_headers"(numeric)the last header we have in common with this peer
"synced_blocks"(numeric)the last block we have in common with this peer
"inflight": [ ... ](array)
number(numeric)the block height requested from this peer

Command:

./komodo-cli getpeerinfo

You can find your rpcuser, rpcpassword, and rpcport in the coin's .conf file.

Command:

curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getpeerinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/

listbanned

The listbanned method lists all banned IP addresses and subnets.

NameTypeDescription
(none)

NameTypeDescription
"address"(string)the address/subnet that is banned
"banned_until"(numeric)the timestamp, at which point the ban will be removed

Command:

./komodo-cli listbanned

You can find your rpcuser, rpcpassword, and rpcport in the coin's .conf file.

Command:

curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "listbanned", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/

ping

The ping method requests that a ping be sent to all other nodes, to measure ping time.

Results provided in getpeerinfo, pingtime and pingwait fields are decimal seconds.

The ping command is handled in queue with all other commands, so it measures processing backlog, not just network ping.

Use getpeerinfo to see ping results.

NameTypeDescription
(none)

NameTypeDescription
(none)

Command:

./komodo-cli ping

You can find your rpcuser, rpcpassword, and rpcport in the coin's .conf file.

Command:

curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "ping", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/

setban "ip(/netmask)" "add|remove" (bantime) (absolute)

The setban method attempts to add or remove an IP address (and subnet, if indicated) from the banned list.

NameTypeDescription
"ip(/netmask)"(string, ip required)the IP/subnet (see getpeerinfo for nodes ip) with an optional netmask (default is /32 = single ip)
"command"(string, required)use "add" to add an IP/subnet to the list, or "remove" to remove an IP/subnet from the list
bantime(numeric, optional)indicates how long (in seconds) the ip is banned (or until when, if [absolute] is set). 0 or empty means the ban is using the default time of 24h, which can also be overwritten using the -bantime runtime parameter.
absolute(boolean, optional)if set to true, the bantime must be an absolute timestamp (in seconds) since epoch (Jan 1 1970 GMT)

NameTypeDescription
(none)

Use listbanned to view results.

Command:

./komodo-cli setban "192.168.0.6" "add" 86400

Command:

./komodo-cli setban "192.168.0.0/24" "add"

You can find your rpcuser, rpcpassword, and rpcport in the coin's .conf file.

Command:

curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "setban", "params": ["78.47.205.239", "add", 86400] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/