P2P Network - Algorand Specifications

Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Algorand Specifications

The Peer-to-Peer Network is currently in experimental mode!

Let’s define NPNP as an object that models a working Peer-to-Peer Network P2PP2P.

A minimal NPNP should have:

A P2PP2P network implements the GossipNode interface to manage peer-to-peer communication.

Currently, transactions are distributed using the GossipSub protocol (/meshsub/1.1.0). All other messages are forwarded over a stream /algorand-ws/1.0.0 that uses the same message serialization as the existing Relay Network implementation. These two streams are multiplexed over a single connection.

The following sketch represents a typical topology of a Peer-to-Peer Network NPNP, where:

The publishing/subscribing (pubsub) protocol is a system where peers congregate around topics they are interested in.

Peers interested in a topic (identified by a simple string) are said to be subscribed to that topic.

Functionally, topics can be thought of as generators of sub-networks: peers subscribed to a topic are discoverable and addressable by other peers capable of serving data about that topic.

The topic used to subscribe to transaction gossiping is algotx01.

The naming convention used for the topics is: the word algo, followed by a 2-byte protocol tagtag (TX in this case) followed by the 2-byte version identifier (01 in this case).

The makePubSub(.) function initializes the pubsub protocol with a list of options that set parameters for peer scoring, topic filters, message validation, and subscription handling.

The pubsub protocol makes use of the following functions:

The following is an enumeration of pubsub message validation results (where ValidationResult is an alias for a signed integer):

With direct P2PP2P network support, the notion of node capabilities acquires importance.

The capabilities of a P2PP2P node are:

Each node advertises its capabilities and keeps track of peers in a distributed hash table.

Peer-to-Peer networks, such as IPFS, use distributed hash tables (DHT) to look up files in the network. A DHT is a distributed system for mapping keys to values, storing resource locations throughout the network.

IPFS DHT is based on the Kadmelia algorithm, as a fundamental component for the content routing system, and acts like a cross between a catalog and a navigation system. It maps what users want to the peers storing the matching content.

The Algorand node reference implementation (go-algorand) uses Kadmelia DHT, to keep track of the peers’ capabilities.