Peer discovery in Bitcoin
At startup, each node must connect to at least one active peer on the network. After consulting the list of hardcoded IP addresses, or following the query of DNS seeds, the node is able to establish a connection with at least one other peer node. This connection is established through the TCP protocol by contacting port 8333 of the peer if the connection is established on the Bitcoin mainnet, or port 18333 in the case of the Bitcoin testnet. Once the connection is established, the handshake phase takes place, during which the nodes exchange the version message containing the updated information on the network (such as the version number, IP addresses, and the height of the blockchain).
At this point, with the information ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access