Gossip is the primary PubSub (publish/subscribe) pattern used for sending Messages between Nodes in the Zero Grid. Publish/Subscribe is a common pattern to enable peers to converge around topics in which they share mutual interest. When a peer sends a Message to a particular topic, the Message is automatically relayed to all peers subscribed to the topic. For example, IPFS uses pub/sub topics to represent downloadable files on the IPFS network. Once uploaders and downloaders know which peers are holding what file fragments, they then connect together directly to coordinate the full-file download, outside of the pub/sub.
Zero utilizes libp2p's gossipsub modality. This enables peers to gossip which messages they have seen in order to maintain a message delivery network. Prior to subscribing to a topic, the Node must have a mechanism for finding other peers on the network using Peer Discovery, as outlined in the prior section.
Gossipsub enables peers to connect using one of two mechanisms: full-message peerings or metadata-only peerings. Together, these networks create two independant and connected virtual overlay networks. Full-message peerings maintain the full contents of Messages, and metadata-only peerings maintain only Message metadata. Gossipsub referrers to full-message networks as 'sparsely-connected', given that a much smaller number of the total Nodes in the network are connected relative to the total network size. The metadata-only network is referred to as 'densely-connected'. This network maintains the network of full-message pairings by sharing gossip about which peers have full-messages available.
Gossipsub enables the configuration of a lower and upper bound of how many full-message Nodes each Node must be connected in order to help regulate network traffic in what is called a peering degree. The peering degree is the central mechanism for managing the trade-offs between speed, reliability, resiliences and network efficacy. For instance, a network with more full-message Nodes will share data faster and maintain a higher level of data replication, however come with the cost of added storage space, computational energy and network bandwidth. The gossipsub-1.1 specification and documentation outlines additional core concepts, including grafting and pruning, the process of publishing and subscribing to topics, how messages are sent, fan-out, network-packets and state.
For public Messages, Zero utilizes a Member's social graph to determine which Message data to store and replicate. Given that each Node announces which Nodes they publicly follow, zOS can arrange the application state into a graph of who follows who. By default, Zero sets a graph depth of two, meaning that Messages will be downloaded from those followed by who you follow. This is a useful heuristic to establish trust between Peers that was pioneered by Secure Scuttlebutt.