Skip to content
JavaScript implementation of Gossipsub
Branch: master
Clone or download
Latest commit c03a087 Jul 30, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github add stale bot Jul 5, 2019
benchmarks Fix up benchmark Jun 4, 2019
src chore: update dependencies Jul 26, 2019
test chore: update dependencies Jul 26, 2019
.gitattributes Added .gitattributes Mar 13, 2019
.gitignore Clean up packages version / lock Apr 17, 2019
.travis.yml chore: enable some browser tests May 29, 2019 chore: release version v0.0.2 Jun 4, 2019
LICENSE change license Jun 15, 2019 feat: self emit option added Jul 25, 2019
package.json Update package.json Jul 30, 2019


Travis CI

Lead Maintainer

Cayman Nava

Table of Contents


Gossipsub is an implementation of pubsub based on meshsub and floodsub. You can read the specification here.


npm install libp2p-gossipsub


const Gossipsub = require('libp2p-gossipsub')

const gsub = new Gossipsub(node)

gsub.start((err) => {
  if (err) {
    console.log('Upsy', err)
  gsub.on('fruit', (data) => {

  gsub.publish('fruit', new Buffer('banana'))


Create a gossipsub implementation

const options = {…}
const gossipsub = new Gossipsub(libp2pNode, options)

Options is an optional object with the following key-value pairs:

  • fallbackToFloodsub: boolean identifying whether the node should fallback to the floodsub protocol, if another connecting peer does not support gossipsub (defaults to true).
  • emitSelf: boolean identifying whether the node should emit to self on publish, in the event of the topic being subscribed (defaults to false).


This module is actively under development. Please check out the issues and submit PRs!


MIT © ChainSafe Systems

You can’t perform that action at this time.