Module 4. Peer-to-peer (P2P) networking
Last updated
Last updated
Through automatic P2P, registered nodes can discover and establish connections with each other
Nodes can establish full-duplex connections, operating simultaneously as servers and clients for the mini-protocols
Nodes can maintain certain static topologies, including their own relays and block producers, as well as trusted peers with which continuous connections are desired
Root peers can be reloaded using the SIGHUP signal, eliminating the need for a restart
The node can dynamically manage the connections, each node maintains a set of peers mapped into three categories:
cold peers ‒ existing (known) peers without an established network connection
warm peers ‒ peers with an established bearer connection, which is only used for network measurements without implementing any of the node-to-node mini-protocols (not active)
hot peers ‒ peers that have a connection, which is being used by all three node-to-node mini-protocols (active peers)
Newly discovered peers are initially added to the cold peer set. The P2P governor is then responsible for peer connection management.
Maintaining diversity in hop distances contributes to better block distribution times across the globally distributed network
In the case of adversarial behavior, the peer can be immediately demoted from the hot, warm, or cold sets
Upstream peers are classified into three categories: known, established, and active.
Peer sharing
Ouroboros Genesis release
Interview with the networking team lead
{% embed url="input-output-hk/cardano-node#4559" %}
The block-producing node includes its own relays (x.x.x.x
and y.y.y.y
) under local roots. Note that the example uses "useLedgerAfterSlot": -1
to indicate that it should never use LedgerPeers
.
The relay x.x.x.x
includes its own block-producing node (z.z.z.z
), the other relay (y.y.y.y
) under local roots, and a few other root peers under public roots. Note that this time, the example does use LedgerPeers - "useLedgerAfterSlot": 10000000
.
You can enable P2P from the configuration file. For example, in the preview testnet configuration file, you will find the field EnableP2P
, which can be set to either false
or true
.
On the preview testnet, the default is true
since this network is already running with P2P. You will also need to configure the target number of active, established and known peers, together with the target number of root peers: