A TypeScript implementation of the DiscV5 protocol
Included is a libp2p peer-discovery compatibility module.
import { Discv5Discovery, ENR } from "@chainsafe/discv5";
import Libp2p from "libp2p";
import PeerInfo from "peer-info";
const myPeerInfo: PeerInfo = ...;
const bootstrapEnrs: ENR[] = [...];
const libp2p = new Libp2p({
peerInfo: myPeerInfo,
modules: {
peerDiscovery: [Discv5Discovery],
},
config: {
discv5: {
enr: ENR.createFromPeerId(myPeerInfo.id),
bindAddr: "/ip4/0.0.0.0/udp/9000",
bootstrapEnrs: bootstrapEnrs,
},
},
});
Apache-2.0