Preliminary test results show that Kadcast is more than twice as performant as the popular Gossip protocol used by Bitcoin, Ethereum and Hyperledger. The preliminary test and benchmark can be viewed in the video demo. We use this article to explain what Kadcast is, what the benefits and differences are with Gossip and what the next steps look like. Enjoy!
As always, we start with taking a bird’s-eye view of our technical framework. Kadcast is part of the ‘node layer’, and takes care of the peer-to-peer (P2P) network. This means that it organizes the way that nodes talk to each other effectively, and is involved in the broadcasting of messages over the network.
This Technical Framework shows the different layers and components of the Dusk Network. Read more about how it all ties together.
In most blockchain systems the P2P network communicates transactions and blocks via a method that is unstructured (or random). The Gossip Network Protocol is the most commonly used unstructured P2P Network Protocol and its participants communicate in a way that is very similar to the way a virus spreads from one human to another - therefore in literature it is also referred to as the ‘epidemic’ framework.
The Gossip Network uses a form of random peer selection: with a given frequency, each node picks another node at random and shares any hot rumors. The Bitcoin network is one of those popular blockchain systems that uses gossip to spread messages.
The obvious downside to selecting peers at random is that some communication is unnecessary (i.e. the same message is shared over and over again with the same person) causing unnecessary network delays.
Figure 1. Example broadcast in an unstructured overlay, Rohrer & Tschorsch (2019), p2.
With the release of the Kadcast specification paper in 2019, the developers at Dusk Network saw an opportunity to further minimize network delay and improve the overall performance and stability of the network via Kadcast (which in turn impacts the reliability, security and fairness of the blockchain).
Kadcast - bringer of structure
Kadcast is an innovative new structured approach to information propagation in blockchain networks that creates a more predictable environment for optimized block transmission. Where the Gossip Network Protocol is unstructured, Kadcast is structured. Allow us to delve a little deeper into the two main differences:
As mentioned before, Kadcast is a structured protocol. It is based on the Kademlia-rooting state, where each network node has a particular position in the binary routing tree and is capable of propagating messages to other leaves. A node position is determined when the node first enters the network.
In other words, when a new node joins the network their position is known in a directory, which instructs them on what node(s) they need to pass on messages to.
Figure 2. Example broadcast by Node 1111 in a binary routing tree structure, Rohrer & Tschorsch (2019), p3.
Furthermore, Kadcast is based on the User Datagram Protocol (UDP) transport, whereas Gossip relies on persistent Transmission Control Protocol (TCP) connections. So what does that mean?
A brief explainer on TCP and UDP.
TCP is a connection-oriented protocol, TCP guarantees the recipient will receive the packets in order by numbering them. The recipient sends messages back to the sender saying it received the messages. If the sender does not get a correct response, it will resend the packets to ensure the recipient received them. Packets are also checked for errors.
UDP is a simpler message-based connectionless protocol. The UDP protocol works similarly to TCP, but it throws all the error-checking stuff out, because all the back-and-forth communication and deliverability guarantees slow things down.
Using UDP brings faster messaging, but does not include a method that checks if the message actually receives its destination. Which is why we need to use an add-on like RaptorQ: an error correction standard that fixes just that. RaptorQ allows the participants to recover data lost in transit and completely reconstruct it, without using a backchannel.
Increased Network performance
There are some main factors that influence the network performance, of which the largest are network latency and number of nodes. In a given operating blockchain, we find that there is an approximate 40-80 ms (milliseconds) latency between two nodes in the network. A higher latency negatively impacts the performance, consistency, and thus overall security of the blockchain.
As preliminary benchmark results we found that Kadcast is twice as fast as Gossip. And with a higher input of modeled network latency, we find that Kadcast is outperforming Gossip even more. In addition, the results were nearly constant in the case of Kadcast, adding to network stability. Besides, if we run tests with increasing numbers of nodes, Kadcast is becoming more and more efficient compared to Gossip. In other words:
- The higher the latency in a given network, the better Kadcast performs.
- With an increasing number of nodes in a given network, the better Kadcast performs.
A Network performance example
Watch the demo on Kadcast vs Gossip here.
The Kadcast repository can be found here: https://github.com/dusk-network/dusk-blockchain/tree/master/pkg/p2p/kadcast.
As network performance and stability are key to any scalable blockchain, we continue testing with an increased number of nodes (300-1000), while also working to further optimize the algorithms, for example to exclude non-active nodes from the messaging equation. Additionally, part of the optimization effort includes testing RaptorQ and viable alternatives. The documentation on the design, implementation details and benchmark results will also be made available via Gitbook.