• Stars
    star
    139
  • Rank 262,954 (Top 6 %)
  • Language
    TypeScript
  • License
    Apache License 2.0
  • Created over 6 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

TypeScript implementation of Gossipsub

js-libp2p-gossipsub

Travis CI ES Version Node Version

Table of Contents

Specs

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

libp2p-gossipsub currently implements the v1.1 of the spec.

Install

npm install @chainsafe/libp2p-gossipsub

Usage

import { gossipsub } from '@chainsafe/libp2p-gossipsub'


const libp2p = await createLibp2p({
  // ...
  services: {
    pubsub: gossipsub(options)
  }
});

libp2p.services.pubsub.addEventListener('message', (message) => {
  console.log(`${message.detail.topic}:`, new TextDecoder().decode(message.detail.data))
})

libp2p.services.pubsub.subscribe('fruit')

libp2p.services.pubsub.publish('fruit', new TextEncoder().encode('banana'))

API

Create a gossipsub implementation

const options = {}
const gossipsub = gossipsub(options)(libp2p)

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

  • emitSelf: boolean identifying whether the node should emit to self on publish, in the event of the topic being subscribed (defaults to false).
  • gossipIncoming: boolean identifying if incoming messages on a subscribed topic should be automatically gossiped (defaults to true).
  • fallbackToFloodsub: boolean identifying whether the node should fallback to the floodsub protocol, if another connecting peer does not support gossipsub (defaults to true).
  • floodPublish: boolean identifying if self-published messages should be sent to all peers, (defaults to true).
  • doPX: boolean identifying whether PX is enabled; this should be enabled in bootstrappers and other well connected/trusted nodes (defaults to false).
  • msgIdFn: a function with signature (message) => string defining the message id given a message, used internally to deduplicate gossip (defaults to (message) => message.from + message.seqno.toString('hex'))
  • signMessages: boolean identifying if we want to sign outgoing messages or not (default: true)
  • strictSigning: boolean identifying if message signing is required for incoming messages or not (default: true)
  • messageCache: optional, a customized MessageCache instance, see the implementation for the interface.
  • scoreParams: optional, a customized peer score parameters Object.
  • scoreThresholds: optional, a customized peer score thresholds Object.
  • directPeers: optional, an array of AddrInfo of peers with which we will maintain direct connections.

For the remaining API, see @libp2p/interface-pubsub.

Contribute

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

License

MIT © ChainSafe Systems

More Repositories

1

lodestar

🌟 TypeScript Implementation of Ethereum Consensus
TypeScript
1,012
star
2

web3.unity

🕹 Unity SDK for building games that interact with blockchains.
C#
817
star
3

forest

🌲 Rust Filecoin Node Implementation
Rust
553
star
4

dappeteer

[DEPRECATED]🏌🏼‍E2E testing for dApps using Puppeteer + MetaMask
TypeScript
491
star
5

ChainBridge

🌉 Modular Multi-Directional Blockchain Bridge to interact with Multiple Networks; Ethereum, Ethereum Classic, Substrate, based chains. Stay tuned for ChainBridge Hub!
Go
463
star
6

gossamer

🕸️ Go Implementation of the Polkadot Host
Go
392
star
7

mina-rs

Rust implementation of the Mina protocol, targeting Wasm and ARM architectures.
Rust
159
star
8

chainbridge-solidity

⚙️ Solidity contracts for Sygma (ChainBridge)
JavaScript
119
star
9

filsnap

MetaMask snap for interacting with Filecoin dapps.
HTML
107
star
10

chainbridge-core

🌁 Sygma core library (ChainBridge)
Go
96
star
11

bls

💻 Javascript Implementation of Boneh-Lynn-Shacham Signatures
TypeScript
92
star
12

go-schnorrkel

🍵 Schnorr Signatures over Ristretto255 in pure Go
Go
87
star
13

metamask-snap-polkadot

Metamask plugin for interacting with Polkadot dapps and other Substrate based chains.
TypeScript
84
star
14

Spectre

ZK coprocessor for verifying Beacon chain headers via Altair lightclient protocol
Rust
57
star
15

nodewatch-api

A devp2p crawler targeted at Eth2 nodes
Go
56
star
16

chainbridge-substrate

Rust
55
star
17

ui-monorepo

ChainSafe Files & Storage UI Monorepo
TypeScript
51
star
18

ssz

Typescript implementation of Simple Serialize (SSZ)
TypeScript
49
star
19

ChainGuardian

Eth2.0 desktop validator client
TypeScript
45
star
20

WeiPay

WeiPay is an open source cryptocurrency wallet available for both iOS and Android mobile devices. WeiPay will support Ethereum out of the box with added support for ERC-20 & ERC-223 tokens.
JavaScript
45
star
21

js-libp2p-noise

Noise libp2p handshake for js-libp2p
TypeScript
37
star
22

chainbridge-deploy

Deploy tooling for ChainBridge
JavaScript
35
star
23

Zipline-lightclient

Hackathon for EthBogota - An Eth2 light client using Cannon verifyable computation
C
30
star
24

nodewatch-ui

TypeScript
29
star
25

discv5

A Typescript implementation of the Discv5 protocol
TypeScript
28
star
26

web3js-example-react-app

TypeScript
28
star
27

Multix

Use a Multisig to do anything, on Polkadot
TypeScript
27
star
28

chainbridge-ui

TypeScript
26
star
29

filecoindot

Filecoin to substrate bridge
Rust
24
star
30

denode

a mechanism for incentivizing full nodes
24
star
31

chainbridge-substrate-chain

Simple Substrate chain for testing purposes
Rust
22
star
32

PINT

A Polkadot ecosystem index for investors. A self sustaining auction treasury for parachains.
Rust
21
star
33

eth-local

The purpose of eth-local is to offer a standardized way to store your keystore files on your local machine. While also allowing you to use them in browser.
JavaScript
21
star
34

rust-libp2p-nym

implementation of a libp2p transport using the Nym mixnet
Rust
20
star
35

chaindb

go key-value store using badgerDB
Go
20
star
36

as-sha256

AssemblyScript implementation of SHA256
WebAssembly
19
star
37

blst-ts

Typescript wrapper for https://github.com/supranational/blst native bindings, a highly performant BLS12-381 signature library
TypeScript
18
star
38

bls-keygen

Key management for BLS curves written in TypeScript and browser compatible
TypeScript
17
star
39

chainlink-cosmos

Chainlink on Cosmos: Cosmos SDK module for Chainlink data feeds
Go
17
star
40

das-prototype

Research prototypes of Data Availability Sampling for Ethereum (WIP)
Rust
16
star
41

bls-keystore

Implementation of bls keystore - EIP 2335
TypeScript
16
star
42

bls-js

BLS signature implementation
TypeScript
15
star
43

truffle-plugin-abigen

Truffle plugin to post-process contracts for go-ethereum's abigen
Solidity
14
star
44

web3-context

A React context implementation of Onboard.js & general utilities
TypeScript
13
star
45

Anemone

A testing tool that broadcasts batches of transactions and tests opcodes
TypeScript
12
star
46

persistent-merkle-tree

TypeScript
12
star
47

js-libp2p-yamux

Typescript implementation of Yamux
TypeScript
12
star
48

chainbridge-core-example

Go
11
star
49

ethermint-deploy

JavaScript
11
star
50

audits

This is public repository that holds ChainSafe audit reports
11
star
51

hardhat-plugin-multichain-deploy

Solidity
11
star
52

forest-iac

Infrastructure as Code to support the Forest Filecoin project
HCL
10
star
53

ssz-js

Simple Serialize in TypeScript
TypeScript
9
star
54

chainbridge-utils

Go
9
star
55

dapp-boilerplate

A shared boilerplate for Dapp development
TypeScript
9
star
56

ens-aztec-privacy

[BETA] Sending private transactions to ENS domains using Aztec and custom ENS Resolver contract.
Solidity
9
star
57

go-signature-adaptor

A pure Go implementation of ECDSA signature adaptors
Go
9
star
58

dotcon-0.5

Decentralized Networking with Libp2p
Go
8
star
59

lodestar-quickstart

Scripts to quick start Lodestar and execution clients pre and post-merge Ethereum.
Shell
8
star
60

api3-rust

Rewrite API3 Solidity contracts in Rust (for Solana, Near, Oasis)
Rust
8
star
61

foundry-multichain-deploy

Solidity
8
star
62

W-OTS

Winternitz OTS+ implementation
Rust
7
star
63

hobbits-ts

A TypeScript implementation of the Hobbits Ethereum Wire Protocol
TypeScript
7
star
64

simpleserialize.com

TypeScript
7
star
65

WebZjs

A fully-featured javascript/typescript library for interacting with the Zcash network from the browser
Rust
7
star
66

js-libp2p-quic

Rust
6
star
67

go-cumulus

Go implementation of cumulus. for creating parachains with gossamer
Makefile
6
star
68

ChainSafe-Demo-WebGLProject-Files

Project Files For The ChainSafe Demo
C#
6
star
69

lazy-minting-server

Sample implementation of a lazy minting server
TypeScript
6
star
70

ethersjs-genaddress

a simple script to generate an eth address utilizing ethers.js
JavaScript
6
star
71

game-web3wallet

JavaScript
6
star
72

bls-hd-key

BLS key derivation and hd key utilities
TypeScript
6
star
73

eth-drive

eth-drive is the first disk utility tool designed for ethereum addresses
HTML
6
star
74

mina-snap

Metamask snap for interacting with mina procotol
HTML
6
star
75

eth2-light-client-demo

TypeScript
5
star
76

enr-app

TypeScript
5
star
77

fil-secondary-retrieval-markets

Client and Provider implementations to enable secondary retrieval markets on Filecoin
Go
5
star
78

engineering-handbook

ChainSafe Engineering Handbook
JavaScript
5
star
79

serde-bin-prot

A Rust crate that adds serde support for the bin_prot serialization format
Rust
5
star
80

game-web3gl

JavaScript
5
star
81

files-cli

A cli tool to download and decrypt any file uploaded using ChainSafe Files
TypeScript
5
star
82

chainbridge-docs

HTML
5
star
83

TypeScript-Cli-Generator

A TypeScript CLI Template
TypeScript
5
star
84

AGP-Report

Report for the Aragon Chain
4
star
85

rust-bls-derivation

Rust
4
star
86

beacon-state-upload

TypeScript
4
star
87

EthIndia2019

JavaScript
4
star
88

sha256-rust-wasm

A wrapper around rust implementation of sha256
Rust
4
star
89

zcash-wasm-benchmark

Rust
4
star
90

marketplace-landing

This is the marketplace landing page, currently a waitlist.
TypeScript
4
star
91

Zipline-Casper

A prototype implementation of the Zipline block root oracle using Casper finality
Solidity
4
star
92

aleo-snap

JavaScript
4
star
93

subgraph-arweave-example

Example subgraph for Arweave
TypeScript
4
star
94

web3-plugin-zksync

TypeScript
4
star
95

near-snap

TypeScript
4
star
96

cypress-polkadot-wallet

TypeScript
4
star
97

game-docs-v2

JavaScript
4
star
98

persistent-ts

TypeScript
3
star
99

ECOHacks

JavaScript
3
star
100

web3.js-plugin-chainlink

TypeScript
3
star