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:
| Field | Description |
|---|---|
id | Peer index |
addr | IP address and port of the peer |
network | Network type (ipv4, ipv6, onion, i2p, cjdns, not_publicly_routable) |
services | Hex-encoded service flags |
servicesnames | Human-readable service names |
relaytxes | Whether transactions are relayed to this peer |
lastsend, lastrecv | Last send/receive timestamps |
bytessent, bytesrecv | Total bytes sent and received |
cpu_load | CPU time processing messages (per mille of connection duration) |
conntime | Connection establishment time |
pingtime, minping | Last and minimum observed ping times (seconds) |
version | Protocol version number |
subver | User agent string |
inbound | Whether the connection is inbound |
startingheight | Peer's starting block height |
synced_headers | Last common header height |
synced_blocks | Last common block height |
connection_type | Connection type: outbound-full-relay, block-relay-only, inbound, manual, addr-fetch, feeler |
transport_protocol_type | Transport 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
node | string | Yes | The node address (host:port) |
command | string | Yes | add, 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).
| Parameter | Type | Required | Description |
|---|---|---|---|
address | string | No | The IP address and port of the peer |
nodeid | number | No | The 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
node | string | No | The 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
state | boolean | Yes | true 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
count | number | No (default 1) | Number of addresses to return (max 2500) |
network | string | No | Filter 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
subnet | string | Yes | IP or IP/netmask (e.g. 192.168.0.0/24) |
command | string | Yes | add or remove |
bantime | number | No (default 86400) | Ban duration in seconds (0 = use default) |
absolute | boolean | No (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:
| Field | Description |
|---|---|
version | Server version |
subversion | User agent string |
protocolversion | Protocol version |
connections | Total connection count |
connections_in | Inbound connection count |
connections_out | Outbound connection count |
networkactive | Whether networking is enabled |
networks | Array of per-network info (name, limited, reachable, proxy) |
relayfee | Minimum relay fee (BTX/kvB) |
incrementalfee | Minimum fee increment for mempool limiting or replacement (BTX/kvB) |
localaddresses | List of local addresses |
warnings | Network 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.