Episub: Proximity Aware Epidemic PubSub for libp2p

Overview

Libp2p-episub: Proximity Aware Epidemic PubSub for libp2p

This Rust library implements a libp2p behaviour for efficient large-scale pub/sub protocol based on ideas the following academic papers:

  • HyParView: For topic-peer-membership management and node discovery
  • Epidemic Broadcast Trees: For constructing efficient broadcast trees and efficient content dessamination
  • GoCast: Gossip-Enhanced Overlay Multicast for Fast and Dependable Group Communication

Originally speced by @vyzo as a successor of Gossipsub.

Running a topology with 201 peers:

$ docker-compose up --scale node_n=200 --remove-orphans

Testing and visualizing p2p network

First start the audit node and open it in the browser on port 80, you should see a P2P Protocols Lab empty page.

$ docker-compose up -d node_audit

Then start the bootstrap node

$ docker-compose up -d node_0

You should see it immediately showing up in the labs page, then start 50 peer nodes and watch the network discover itself.

$ docker-compose up --scale node_n=50

Usage Examples

let local_key = identity::Keypair::generate_ed25519();
let local_peer_id = PeerId::from(local_key.public());
let transport = libp2p::development_transport(local_key.clone()).await?;

// Create a Swarm to manage peers and events
let mut swarm = libp2p::Swarm::new(transport, Episub::new(), local_peer_id);

// Listen on all interfaces and whatever port the OS assigns
swarm
  .listen_on("/ip4/0.0.0.0/tcp/4001".parse().unwrap())
  .unwrap();

// subscribe to the topic specified on the command line
swarm.behaviour_mut().subscribe(opts.topic);
swarm.dial(bootstrap).unwrap()

while let Some(event) = swarm.next().await {
  match event {
     SwarmEvent::Behaviour(EpisubEvent::Message(m, t)) => {
        println!("got a message: {:?} on topic {}", m, t);
     }
     SwarmEvent::Behaviour(EpisubEvent::Subscribed(t)) => {}
     SwarmEvent::Behaviour(EpisubEvent::Unsubscribed(t)) => {}
     SwarmEvent::Behaviour(EpisubEvent::ActivePeerAdded(p)) => {}
     SwarmEvent::Behaviour(EpisubEvent::ActivePeerRemoved(p)) => {}
  }
}
You might also like...
LIBFFM - field-aware factorization machines - in Rust

LIBFFM Rust LIBFFM - field-aware factorization machines - in Rust Getting Started LIBFFM Rust is available as a Rust library and a command line tool.

Modular, structure-aware, and feedback-driven fuzzing engine for Rust functions

Fuzzcheck Fuzzcheck is a modular, structure-aware, and feedback-driven fuzzing engine for Rust functions. Given a function test: (T) - bool, you can

Like wc, but unicode-aware, and with per-line mode
Like wc, but unicode-aware, and with per-line mode

Like wc, but unicode-aware, and with per-line mode

A structure-aware HTTP fuzzing library
A structure-aware HTTP fuzzing library

🚀 FeroxFuzz 🚀 A structure-aware HTTP fuzzing library 🤔 Another ferox? why? 🤔 Chill, it's not another command-line tool, this one's a library! 😁 M

Validity is a next-generation, deduction-based language for formally verified, context-aware, autonomous & reactive smart contracts.
Validity is a next-generation, deduction-based language for formally verified, context-aware, autonomous & reactive smart contracts.

Validity Language Validity is a next-generation, deduction-based language for formally verified, context-aware, autonomous & reactive smart contracts.

Automatic application-aware keyboard layer switching for Windows

komokana Automatic application-aware keyboard layer switching for Windows About komokana is a daemon that listens to events emitted by komorebi and co

Owner
Terra
The official repositories for the Terra
Terra
basic rust-libp2p gossipsub network

gossipnet is Archived This repository has been archived and is no longer actively maintained. The project has been consolidated into a mono repository

Astria 9 May 25, 2023
Validity is a next-generation, deduction-based language for formally verified, context-aware, autonomous & reactive smart contracts.

Validity Language Validity is a next-generation, deduction-based language for formally verified, context-aware, autonomous & reactive smart contracts.

Tempest Labs 4 Nov 11, 2022
Easy c̵̰͠r̵̛̠ö̴̪s̶̩̒s̵̭̀-t̶̲͝h̶̯̚r̵̺͐e̷̖̽ḁ̴̍d̶̖̔ ȓ̵͙ė̶͎ḟ̴͙e̸̖͛r̶̖͗ë̶̱́ṉ̵̒ĉ̷̥e̷͚̍ s̷̹͌h̷̲̉a̵̭͋r̷̫̊ḭ̵̊n̷̬͂g̵̦̃ f̶̻̊ơ̵̜ṟ̸̈́ R̵̞̋ù̵̺s̷̖̅ţ̸͗!̸̼͋

Rust S̵̓i̸̓n̵̉ I̴n̴f̶e̸r̵n̷a̴l mutability! Howdy, friendly Rust developer! Ever had a value get m̵̯̅ð̶͊v̴̮̾ê̴̼͘d away right under your nose just when

null 294 Dec 23, 2022
The Rust Implementation of libp2p networking stack.

Central repository for work on libp2p This repository is the central place for Rust development of the libp2p spec. Warning: While we are trying our b

libp2p 3k Jan 4, 2023
A standalone libp2p rendezvous server binary.

Standalone Rendezvous Server A standalone libp2p rendezvous server binary. Usage Run the rendezvous_server: rendezvous_server --secret-file <PATH-TO-S

COMIT 15 Jul 20, 2022
Rust libp2p and tokio demo

Rust libp2p and tokio demo This repository contains code to show basic usage of the async programming using tokio and p2p - libp2p library in Rust. Th

anant asthana 8 Nov 7, 2022
(Pre-Release Software) Secure, Encrypted, P2P chat written atop Warp, IPFS, LibP2P, Dioxus and many more awesome projects and protocols.

Uplink Privacy First, Modular, P2P messaging client built atop Warp. Uplink is written in pure Rust with a UI in Dioxus (which is also written in Rust

Satellite 13 Jan 25, 2023
basic rust-libp2p gossipsub network

gossipnet is Archived This repository has been archived and is no longer actively maintained. The project has been consolidated into a mono repository

Astria 9 May 25, 2023
Everyday-use client-side map-aware Arch Linux mirror ranking tool

Rate Arch Mirrors This is a tool, which fetches mirrors, skips outdated/syncing Arch Linux mirrors, then uses info about submarine cables and internet

Nikita Almakov 196 Jan 2, 2023
Structure-aware, in-process, coverage-guided, evolutionary fuzzing engine for Rust functions.

fuzzcheck Fuzzcheck is a structure-aware, in-process, coverage-guided, evolutionary fuzzing engine for Rust functions. Given a function test: (T) -> b

Loïc Lecrenier 394 Dec 20, 2022