Overview
Bitcoin Core operates on a peer-to-peer (P2P) network where nodes communicate directly with each other to relay transactions and blocks. The network is designed to be decentralized, resilient, and resistant to censorship.Network Types
Bitcoin Core supports multiple network types, each identified by a specific address format:- IPv4 - Traditional internet addresses (e.g.,
192.168.1.1) - IPv6 - Modern internet addresses (e.g.,
2001:db8::1) - Tor (Onion) - Privacy network addresses ending in
.onion - I2P - Privacy network addresses ending in
.b32.i2p - CJDNS - Encrypted IPv6 network using
fc00::/8range
Peer Discovery
Bitcoin Core uses several mechanisms to discover and connect to peers:DNS Seeds
When a node first starts or has few connections, it queries DNS seeds to obtain initial peer addresses.DNS seed queries are delayed based on the number of known peers:
- Few peers (< 1000): 11 second delay
- Many peers (≥ 1000): 5 minute delay
Address Manager (AddrMan)
The address manager maintains a database of known peer addresses, stored inpeers.dat. It implements a tried-and-new bucketing system:
- Tried table - Addresses of peers successfully connected to
- New table - Recently learned addresses not yet connected
Anchor Connections
Bitcoin Core maintains up to 2 block-relay-only anchor connections that persist across restarts. These connections are stored inanchors.dat and help prevent eclipse attacks.
Connection Types
Bitcoin Core establishes different types of connections for various purposes:Outbound Connections
- Full Relay - Full transaction and block relay
- Block Relay Only - Only blocks are relayed, no transactions
- Feeler - Short-lived connections to test peer responsiveness
- Address Fetch - Connections specifically to fetch peer addresses
Inbound Connections
Incoming connections from other nodes. By default, listening is enabled unless running behind a proxy.Configuration Options
Basic Network Configuration
Network Selection
External IP Advertisement
Network Discovery
Privacy Network Integration
Understand Network Separation
Bitcoin Core separates privacy networks from clearnet to prevent address correlation. Privacy network addresses (Tor, I2P) are not advertised to clearnet peers and vice versa.
Network Reachability
The network layer uses a reachability scoring system to determine the best local address to advertise to each peer:Monitoring and Debugging
Get Network Information
Network Statistics
Debug Logging
Enable network-specific debug logging:Performance Tuning
Upload Limits
Connection Limits
Security Considerations
Best Practices:
- Use multiple network types for redundancy
- Enable block-relay-only connections for privacy
- Monitor peer connections regularly
- Keep
peers.datbacked up for faster restarts - Consider using
-onlynet=onionfor maximum privacy
Advanced Features
Feeler Connections
Bitcoin Core periodically creates short-lived “feeler” connections to test if addresses in the new table are responsive. A random 0-1 second delay is added to prevent synchronization.Extra Network Peers
Every 5 minutes, Bitcoin Core attempts to connect to reachable networks it’s not currently connected to:Bridge Nodes
Nodes listening on multiple networks act as bridge nodes, increasing the cost and complexity of eclipse and partition attacks against the Bitcoin network.RPC Commands
| Command | Description |
|---|---|
getnetworkinfo | Returns network-related information |
getpeerinfo | Returns data about each connected peer |
getnodeaddresses | Return known addresses from addr manager |
addnode | Add/remove/query a node |
disconnectnode | Disconnect from a specified node |
setnetworkactive | Enable/disable all P2P network activity |
See Also
- Tor Support - Configure Bitcoin Core with Tor
- I2P Support - Configure Bitcoin Core with I2P
- CJDNS Support - Configure Bitcoin Core with CJDNS
- ZMQ Notifications - Real-time event notifications