Skip to main content

Network RPC Methods

Network RPCs provide information about network status, peer connections, and allow management of network settings.

Network Information

getnetworkinfo

Returns information about the node’s network state.
number
Bitcoin Core version number
string
User agent string
number
Protocol version
string
Services offered by this node (hex)
array
Human-readable service names
boolean
Whether transaction relay is enabled
number
Time offset in seconds
number
Total number of connections
number
Number of inbound connections
number
Number of outbound connections
boolean
Whether p2p networking is enabled
array
Information per network (ipv4, ipv6, onion, i2p, cjdns)
number
Minimum relay fee for transactions
number
Minimum fee increment for mempool replacement
array
List of local addresses
string
Network warnings

Peer Management

getpeerinfo

Returns data about each connected network peer.
Returns array of peer objects with detailed information:
number
Peer index
string
IP address and port of the peer
string
Bind address of the connection to the peer
string
Local address as reported by the peer
string
Network type: ipv4, ipv6, onion, i2p, cjdns, not_publicly_routable
string
Services offered by peer (hex)
array
Human-readable service names
boolean
Whether we relay transactions to this peer
number
Unix timestamp of last send
number
Unix timestamp of last receive
number
Unix timestamp of last valid transaction received
number
Unix timestamp of last block received
number
Total bytes sent
number
Total bytes received
number
Unix timestamp of connection time
number
Last ping time in seconds
number
Minimum observed ping time in seconds
number
Peer version
string
Peer user agent string
boolean
True for inbound connections, false for outbound
number
Last header we have in common with peer
number
Last block we have in common with peer
string
Connection type: outbound-full-relay, block-relay-only, inbound, manual, addr-fetch, feeler
string
Transport protocol: detecting, v1, v2 (BIP324 encrypted)
string
Session ID for v2 transport (empty for v1)

getconnectioncount

Returns the number of connections to other nodes.
number
Total number of connections

ping

Requests a ping be sent to all other nodes.
Results are provided in getpeerinfo. The ping command measures processing backlog, not just network ping.

addnode

Adds, removes, or tries a connection to a node.

disconnectnode

Disconnects from a specified node.
Provide either address or nodeid, not both.

getaddednodeinfo

Returns information about manually added nodes.
string
Node address
boolean
Whether currently connected
array
Connection addresses and connection status

getnodeaddresses

Returns known addresses from the node’s address manager.
number
Unix timestamp when address was last seen
number
Services offered by node
string
Network address
number
Network port
string
Network type

Network Control

setnetworkactive

Enables or disables all P2P network activity.
boolean
Current network state after command
Disabling network activity will disconnect all peers. Re-enabling will not automatically reconnect to previous peers.

Ban Management

listbanned

Lists all manually banned IP addresses/subnets.
string
Banned IP/subnet
number
Unix timestamp when ban was created
number
Unix timestamp when ban expires

setban

Adds or removes an IP/subnet from the banned list.

clearbanned

Clears all banned IPs.

Traffic Control

getnettotals

Returns information about network traffic, including bytes received and sent.
number
Total bytes received
number
Total bytes sent
number
Current Unix time in milliseconds
object
Upload target information:
  • timeframe: Target timeframe in seconds
  • target: Target in bytes (0 = no limit)
  • target_reached: Whether target was reached
  • serve_historical_blocks: Whether serving historical blocks
  • bytes_left_in_cycle: Bytes left in current cycle
  • time_left_in_cycle: Seconds left in current cycle

Connection Types

Bitcoin Core maintains different types of connections:

Transport Protocols

Network Types

Bitcoin Core supports multiple network types:
  • ipv4: IPv4 connections
  • ipv6: IPv6 connections
  • onion: Tor hidden service connections
  • i2p: I2P (Invisible Internet Project) connections
  • cjdns: CJDNS network connections
  • not_publicly_routable: Internal/private network connections