Skip to content
Allister Beharry edited this page Oct 1, 2023 · 1 revision

Welcome to the flubber wiki! img

Inspiration

There are many different commercial offerings for cloud-based real-time pub/sub messaging and data streaming like Ably and PubNub and Google PubSub. However there doesn't seem to be an open-source library that allows users to easily build their own peer-peer messaging and data storage network using the capabilities of libp2p and IPFS. Right now in order to use libp2p PubSub messaging in their apps for instance, a developer must either:

  • Use an implemention of libp2p in their target language. These have varying levels of maturity and capability e.g the Python implementation is currently under development.
  • Run a Kubo node and use the pubsub RPC APIs of the node.

The 2nd method is easier but both these methods still leave the chores of implementing necessary things like authentication and push-based message delivery up to the developer.

What it does

Flubber provides a language-agnostic API for creating a peer-peer authenticated messaging and data storage fabric using libp2p and IPFS. Flubber embeds an IPFS node and runs as a REST and WebSocket server and provides a simple-to-use API for the following tasks

  • Authentication using DIDs
  • Authenticated direct messaging between nodes
  • Pub-sub message queues
  • Binary and linked data storage and retrieval
  • Using IPFS data pinning services like Pinata

The goal of Flubber is to make it easy for developers across all languages and platforms to use the peer-peer communication abilities of libp2p and IPFS in their own apps and services. Flubber can be used to to add peer-peer communication to apps apps or as a low-level service API for building enterprise or commercial peer-peer communication and data storage services, without having to wrangle with integration of the native libp2p and IPFS libraries or building out a server around the Kubo RPC API.

How it works

Overview

  • Written in Go
  • Embeds an IPFS node using the Kubo package and related packages
  • Exposes a REST server for server control and pull-based message delivery. A Swagger spec is generated from code and included for easy generation of client interfaces to the API in any language: img
  • Exposes a WebSocket server for push-based message delivery.

Authentication

Rather than rely on a centralized authentication service or identity provider, Flubber uses DIDs for authentication, provided by ENS, Each ENS name used by a node contains a text record with the IPFS public key of the identity the node runs under...checking the a IPFS node identity matches the text record of the ENS name verifies that this node is under the control of the associated ENS name. img

Flubber nodes look up this text record during communication with another node and verify that the keys match. img

Direct messaging

Flubber nodes can direct message each other using libp2p message streams. The nodes' identity is verified during communication.

Pubsub messaging

Nodes can publish messages to topics and other nodes can subscribe to topics and be notified when messages are posted in-order to the topics. Pubsub messaging uses a flexible datatype:

type SubscriptionMessage struct {
	Did   string
	Type  string
	Data  string
	Time  time.Time
	Topic string
	Read  bool
}

The Type field indicates the type of data being carried by the message e.g. a message of type "float64" would have data that can be parsed into an array of floats.

IPFS file storage

Nodes can store file using IPFS and pin files using the Pinata pinning service