Bitcoin Peer Discovery Explained: DNS Seeds, AddrMan, and Outbound Connections
A newly started Bitcoin node needs potential peer addresses before it can exchange blocks and transactions. Bitcoin Core uses several discovery mechanisms rather than a mandatory central directory. Discovery finds possible connections; it does not confer trust on the discovered peers.
Initial discovery
A fresh node may consult DNS seeds for candidate peer IP addresses. DNS seeds are a bootstrap aid, not an authority for blockchain history or consensus. Users can also configure manual peers, seed nodes, or connection restrictions. The exact discovery behavior depends on configuration and software version.
Address management
Bitcoin Core maintains a database of known network addresses commonly called AddrMan. Nodes learn addresses from peers and other discovery sources and can remember candidates across restarts. Address records may include metadata useful for deciding which candidates to try. Learning an address does not mean that the peer is reachable or honest.
Address relay and peer selection
Peers can share reachable node addresses through address-relay messages, including addr and addrv2 where supported. BIP155 extends address messages to handle additional network address types. Outbound selection aims to maintain useful connections while limiting the impact of address poisoning and overconcentration; its precise heuristics evolve in Bitcoin Core.
Network boundaries
Mainnet, testnet, signet, and regtest use separate network identities and should not be mixed. Nodes can operate with restricted connectivity or explicit peers, but fewer independent sources can increase isolation risk. DNS seeds are not needed for consensus validation after a node has obtained data; the node still verifies that data locally.
What a developer should test
Test clean bootstrap, restart with cached addresses, temporary DNS failure, unreachable peers, and deliberate network isolation. Monitor connection diversity rather than treating a successful TCP handshake as proof of synchronization or correctness.
Primary references
Bitcoin Developer Guide — Peer Discovery: https://developer.bitcoin.org/devguide/p2p_network.html
BIP155 — addrv2 message: https://github.com/bitcoin/bips/blob/master/bip-0155.mediawiki
Bitcoin Core source repository: https://github.com/bitcoin/bitcoin
