@chainsafe/discv5
TypeScript icon, indicating that this package has built-in type declarations

10.0.1 • Public • Published

discv5

ES Version Node Version

A TypeScript implementation of the DiscV5 protocol

Libp2p compatibility

Peer Discovery Compatible

Included is a libp2p peer-discovery compatibility module.

Example

import { Discv5Discovery, ENR } from "@chainsafe/discv5";
import Libp2p from "libp2p";
import PeerId from "peer-id";

const myPeerId: PeerId = ...;

const bootstrapEnrs: ENR[] = [...];

const libp2p = new Libp2p({
  peerId: myPeerId,
  modules: {
    peerDiscovery: [Discv5Discovery],
  },
  config: {
    discv5: {
      enr: ENR.createFromPeerId(myPeerInfo.id),
      bindAddr: "/ip4/0.0.0.0/udp/9000",
      bootstrapEnrs: bootstrapEnrs,
      searchInterval: 30000, // wait 30s between searches
    },
  },
});

Additional features

By default, importing this library will, as a side-effect, change the enr crypto implementation to use bcrypto. If you'd like to remain using @chainsafe/enr's default crypto you can add this after importing @chainsafe/discv5:

import {setV4Crypto, defaultCrypto} from "@chainsafe/enr";

setV4Crypto(defaultCrypto)

License

Apache-2.0

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
10.0.136latest
0.6.710beta

Version History

VersionDownloads (Last 7 Days)Published
10.0.136
10.0.00
9.0.154
9.0.0678
7.1.00
7.0.10
7.0.00
5.1.20
5.1.174
5.0.10
5.0.00
4.0.00
3.0.0107
2.1.10
2.1.00
2.0.00
1.5.00
1.4.00
1.3.10
1.3.00
1.2.10
1.2.00
1.1.20
1.1.10
1.1.00
1.0.20
1.0.10
1.0.00
0.8.10
0.8.00
0.7.13
0.7.00
0.6.710
0.6.60
0.6.50
0.6.40
0.6.30
0.6.20
0.6.10
0.6.00
0.5.14
0.5.07
0.4.20
0.4.10
0.4.00
0.3.20
0.3.10
0.3.00
0.2.70
0.2.60
0.2.50
0.2.40
0.2.30
0.2.20
0.1.30
0.1.20
0.2.10
0.2.00
0.1.10
0.1.00

Package Sidebar

Install

npm i @chainsafe/discv5

Weekly Downloads

973

Version

10.0.1

License

Apache-2.0

Unpacked Size

433 kB

Total Files

211

Last publish

Collaborators

  • sadiq1971
  • ansermino
  • gregthegreek
  • priom
  • wemeetagain
  • mpetrunic