What Is the Gossip Protocol?-banner-imageAcademy

What Is the Gossip Protocol?

The Gossip Protocol is a P2P (Peer-to-Peer) communication protocol that allows state sharing in distributed systems. The Gossip Protocol got its name from the way people share information with each other and the spread of information by word of mouth.

Let’s say you learned that the company you work for is launching a new outerwear collection, and you pass this information on to a colleague during a coffee break. He is interested in the information you have provided, and while you are informing another colleague, he is informing another colleague. In a brief time, everyone in the company will be aware of the outerwear collection. Computer nodes share information similarly. Professor Márk Jelasity of the University of Szeged claimed that there are two types of Gossip Protocols: Information dissemination and information aggregation.

How Does the Gossip Protocol Work?

The Gossip Protocol allows each node in the cluster to check information about other nodes, such as reachable nodes, key ranges for which they are responsible, etc. Nodes periodically share information about their states by updating it through the P2P mechanism in order to stay in sync. Every second, a node starts a Gossip Protocol round to exchange state information with a random node. Thus, the latest information spreads quickly and all nodes are informed.

For example, a node named Alice is randomly paired with a node named Bob. Alice shares all the information she has with Bob and gets information from him. Alice then shares the information she has received from Bob with another node named John. Alice, Bob, John, and all the nodes in the ecosystem repeat this action. So, if a single node is aware of new information, it will spread rapidly until all nodes are aware of it. The Gossip Protocol allows information synchronization between nodes.

After a synchronization is complete, each participating member restarts it to receive information. In the Gossip Protocol, an event is stored as a data structure consisting of a timestamp, an array of zero or more transactions, two parent hashes, and a cryptographic signature.

On the Bitcoin network, the Gossip Protocol is used to transmit the “nonce” values among mining nodes. Most of the major blockchain networks such as Bitcoin, Hashgraph, and Hyperledger use the Gossip Protocol. Hashgraph specifically uses the Gossip Protocol to transfer information from one location to another.

Today, our lives are intertwined with technology. Therefore, it is unlikely that you have never used an application that uses the Gossip Protocol. If you have Bitcoin, if you have used a search engine or social media platform, if you have downloaded movies using torrents, you have used the Gossip Protocol.