Cardano has dynamic P2P networking

Published 20.3.2023

Many people think that the decentralization of blockchains is based only on block production. Underneath the Proof-of-Stake (or another consensus) layer is the peer-to-peer network (or gossip network) that is used to connect the nodes. This is a physical infrastructure that you can think of as nodes connected by a network cable. Above these layers, there is the governance layer that is used for project management. Decentralization could not be achieved without the existence of a distributed network. Security depends on both of these layers. It is important to consider security and decentralization comprehensively and include all three layers. An attack on the blockchain can target any layer. If the network layer is successfully attacked, the consensus layer may also be compromised. With the new Cardano node version 1.35.6, network participants can start using automated dynamically updated P2P configuration without a need for manual maintenance. The Cardano network layer is becoming more secure and performant.


  • With the older version of the Cardano node, SPOs had to manually maintain an unnecessarily large number of connections to peers.
  • Dynamic P2P enables an automated process that through self-discovery and optimization finds the most suitable peers.
  • The network is more resistant to DoS attacks.
  • The Cardano node will automatically reconfigure connections to peer nodes to make the speed of data distribution in the P2P network near optimal.

Peer-to-Peer network

Peer-to-Peer network, also called gossip network, is used for the efficient dissemination of information throughout the network. In a blockchain network, nodes need to be informed about new transactions, blocks, and other relevant information in order to maintain the integrity of the network. Each node must establish multiple incoming and outgoing connections to the selected peers. This ensures the reception of information and its distribution.

When a node receives new information, it shares it with a subset of randomly selected nodes in the network. Those nodes, in turn, share the information with their own randomly selected subset of nodes, and the process continues until all nodes in the network are aware of the new information. Thanks to this, information from a single node (e.g. newly minted block) reaches all nodes in the entire network.

This method of information sharing is highly resilient to node failures or network partitions, as nodes will continue to share information with other nodes they are able to communicate with, even if some nodes are unreachable. Potentially, however, a node may have a connection to a small number of peers and they may all be offline due to some bug or attack. Therefore, it is important to actively monitor the availability of peers.

When a new node is started for the first time, who should it connect to? Most blockchains including Bitcoin and Ethereum require so-called bootstrap nodes to usher a new node into the network and help it initialize the peer list. The bootstrap node is often the entry point into the P2P network, from which point every new node can then organically find new peers. In most cases, this happens randomly, or the user can manually set up connections to reliable peers (different tools can be used for that). Once a node has a table of peers, it can start exchanging information (first of all, the blockchain needs to be synchronized).

A newly connected node does not have to randomly contact nodes in the network and look for someone to provide the necessary information to connect. The danger with a bootstrap node is that if it is not authenticated, it could be malicious and perform a man-in-the-middle or eclipse attack.

It is important to know that at the network level, there are usually several trusted bootstrap nodes (usually run by the team) to which new nodes connect. Note that the dynamic P2P connectivity feature in the new version of the Cardano node does not solve the bootstrapping.

Since the Shelley era, block-producing nodes send and receive communications through trusted relays. SPOs could use a manual community-developed and managed tool called the topology updater to set up a static list of peers in the configuration file.

Let us add that in the Cardano network, block-producing nodes are hidden behind relay nodes for better security.

The consensus layer is dependent on the P2P network, as it needs information on which it can reach a new consensus (add a new block). The slot leader must be able to distribute the newly minted block in a timely manner. If he fails to do so, the block may become orphaned as another node mints another block which propagates faster. This condition (blockchain forks) is undesirable. Ideally, it must be ensured that all nodes in the network have all information available in a timely manner. This means that the connection to the peers should be configured to be as optimal and reliable as possible.

Dynamic P2P connectivity

Before the Cardano node update, the so-called hybrid mode was used. Each node must have set incoming and outgoing connections to the selected peers in the configuration. The topology updater tool helped SPOs to configure the node and get information about changes. SPOs need to spend time and effort running the tool manually (it can be automated to some extent).

Cardano node version 1.35.6 automates connectivity to peers. Dynamic P2P enables an automated process that through self-discovery and optimization finds the most suitable peers for a given node at a given time. It removes the need for maintaining the static configuration manually as required by the hybrid setup.

The update makes the network more performant and resilient to changes. The node automatically reacts to changes, such as peer failure or degradation in data distribution speed, and changes the static configuration in the most appropriate way. It streamlines the flow of information between the thousands of distributed nodes.

In an older version of the Cardano node, SPOs had to manually configure connections to multiple peers, such as 50. This is an unnecessarily large number but justified because the SPOs wanted to make sure that if a large number of nodes were offline at least a few of them would remain available. 20 is a sufficiently large number of peers, provided that the node is able to respond automatically to changes in the network.

Node distinguishes between 3 types of peers. Cold peers are known to the node, but no connection is currently established with them. Warm peers are nodes with which a connection is established, but only for network measurements (monitoring of the performance). Hot peers are actively used for consensus.

In a Dynamic P2P setup, SPOs can target to configure 20 connections to peers (hot peers), which can be picked from thousands of SPO relays (cold peers), not just 50. And if any go offline, the node will automatically pick new ones, to meet the set target. So the configuration is no longer limited to a static pool of 50 peers.

The benefit of the dynamic P2P setup is that it optimizes peer selection to minimize the propagation of the block through the entire network. This happens continuously based on changes in the network.

Research conducted by the IOG team has shown that by optimizing the configuration of nodes at the local level, a near-ideal setup can be achieved in the context of the entire network. It measures the frequency with which peers first provide a block header that later ends up in the chain. Peers that are least useful (slower) by this metric are periodically "weeded out" and replaced by other randomly selected peers. Simulations have shown that this simple method leads to an optimal network setup resulting in high performance regarding data distribution.

Automated dynamic optimization makes the network more resilient to any communication delays or downtime. Moreover, it strengthens security by deterring denial of service (DoS) attacks. If a node is under attack, other nodes will automatically notice the outage and change their settings to other peers.


The automatic dynamic configuration of connections to peers will make the work of SPOs easier and more importantly increase the speed of information distribution. Manual setup can be equally or more efficient but requires knowledge. An automated process has the advantage that it can respond flexibly to changes in a dynamically evolving network. If a peer node gets offline, the configuration is automatically changed and the best possible connection is found. If full node operators rely on a randomly selected list of peers, this may not be optimal. The Cardano node can measure the connection speed to peers and automatically change the settings to keep the overall network performance near optimal. Let's add that SPOs can stay with their manually set list of peers and do not need to use this new feature.


Related articles

Did you enjoy this article? Other great articles by the same author