Skip to main content

Network RPCs

RPC commands for peer management, network statistics, banning, and connectivity on the BTX network.

getpeerinfo

Returns data about each connected network peer as a JSON array of objects.

btx-cli getpeerinfo

Key response fields per peer:

FieldDescription
idPeer index
addrIP address and port of the peer
networkNetwork type (ipv4, ipv6, onion, i2p, cjdns, not_publicly_routable)
servicesHex-encoded service flags
servicesnamesHuman-readable service names
relaytxesWhether transactions are relayed to this peer
lastsend, lastrecvLast send/receive timestamps
bytessent, bytesrecvTotal bytes sent and received
cpu_loadCPU time processing messages (per mille of connection duration)
conntimeConnection establishment time
pingtime, minpingLast and minimum observed ping times (seconds)
versionProtocol version number
subverUser agent string
inboundWhether the connection is inbound
startingheightPeer's starting block height
synced_headersLast common header height
synced_blocksLast common block height
connection_typeConnection type: outbound-full-relay, block-relay-only, inbound, manual, addr-fetch, feeler
transport_protocol_typeTransport type: detecting, v1, or v2 (BIP324)

getconnectioncount

Returns the number of connections to other nodes.

btx-cli getconnectioncount

Returns a single integer. No parameters.

addnode

Attempt to add or remove a node from the addnode list, or try a connection to a node once.

ParameterTypeRequiredDescription
nodestringYesThe node address (host:port)
commandstringYesadd, remove, or onetry
btx-cli addnode "100.85.221.75:19333" "add"

disconnectnode

Immediately disconnect from a specified peer. Specify either the address or the peer id (not both).

ParameterTypeRequiredDescription
addressstringNoThe IP address and port of the peer
nodeidnumberNoThe node id (from getpeerinfo)
btx-cli disconnectnode "100.85.221.75:19333"
btx-cli disconnectnode "" 5

getaddednodeinfo

Returns information about the given added node, or all added nodes if no node is specified.

ParameterTypeRequiredDescription
nodestringNoThe node address to query (default: all added nodes)
btx-cli getaddednodeinfo

Returns array of objects with addednode, connected, and addresses (array of address and connected type).

setnetworkactive

Enable or disable all p2p network activity.

ParameterTypeRequiredDescription
statebooleanYestrue to enable networking, false to disable
btx-cli setnetworkactive false

Returns the new state as a boolean.

getnodeaddresses

Return known addresses from the address manager, useful for finding peers to connect to.

ParameterTypeRequiredDescription
countnumberNo (default 1)Number of addresses to return (max 2500)
networkstringNoFilter by network: ipv4, ipv6, onion, i2p, cjdns
btx-cli getnodeaddresses 10

Returns array of objects with time, services, address, port, and network.

setban

Add or remove an IP/subnet from the banned list.

ParameterTypeRequiredDescription
subnetstringYesIP or IP/netmask (e.g. 192.168.0.0/24)
commandstringYesadd or remove
bantimenumberNo (default 86400)Ban duration in seconds (0 = use default)
absolutebooleanNo (default false)If true, bantime is an absolute UNIX timestamp
btx-cli setban "192.168.0.6" "add" 86400

listbanned

List all banned IPs/subnets.

btx-cli listbanned

Returns array of objects with address, ban_created, banned_until, and ban_reason.

clearbanned

Clear all banned IPs.

btx-cli clearbanned

Returns nothing on success.

getnetworkinfo

Returns an object containing various state info regarding P2P networking.

btx-cli getnetworkinfo

Key response fields:

FieldDescription
versionServer version
subversionUser agent string
protocolversionProtocol version
connectionsTotal connection count
connections_inInbound connection count
connections_outOutbound connection count
networkactiveWhether networking is enabled
networksArray of per-network info (name, limited, reachable, proxy)
relayfeeMinimum relay fee (BTX/kvB)
incrementalfeeMinimum fee increment for mempool limiting or replacement (BTX/kvB)
localaddressesList of local addresses
warningsNetwork warnings

getnettotals

Returns information about network traffic, including bytes in, bytes out, and current time.

btx-cli getnettotals

Returns totalbytesrecv, totalbytessent, timemillis, and uploadtarget (with timeframe, target, target_reached, serve_historical_blocks, bytes_left_in_cycle, time_left_in_cycle).

ping

Request that a ping be sent to all other nodes, to measure ping time. Results are provided in getpeerinfo via pingtime. Measures processing backlog, not just network ping.

btx-cli ping

Returns nothing. No parameters.